Bumped default sample rate for generating computer speaker beeps to avoid artifacts and made it a setting.

This commit is contained in:
Florian Nücke 2015-01-17 14:54:53 +01:00
parent 6f9f27fe02
commit d869ba4df9
3 changed files with 10 additions and 1 deletions

View File

@ -105,6 +105,13 @@ opencomputers {
# importantly, can only render code page 437 (as opposed to...
# a *lot* of unicode).
fontRenderer: "unifont"
# The sample rate used for generating beeps of computers' internal
# speakers. Use custom values at your own responsibility here; if it
# breaks OC you'll get no support. Some potentially reasonable
# lower values are 16000 or even 8000 (which was the old default, but
# leads to artifacting on certain frequencies).
beepSampleRate: 44100
}
# Computer related settings, concerns server performance and security.

View File

@ -49,6 +49,7 @@ class Settings(val config: Config) {
}
val monochromeColor = Integer.decode(config.getString("client.monochromeColor"))
val fontRenderer = config.getString("client.fontRenderer")
val beepSampleRate = config.getInt("client.beepSampleRate")
// ----------------------------------------------------------------------- //
// computer

View File

@ -6,6 +6,7 @@ import cpw.mods.fml.common.FMLCommonHandler
import cpw.mods.fml.common.eventhandler.SubscribeEvent
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent
import li.cil.oc.OpenComputers
import li.cil.oc.Settings
import net.minecraft.client.Minecraft
import net.minecraft.client.audio.SoundCategory
import org.lwjgl.BufferUtils
@ -23,7 +24,7 @@ import scala.collection.mutable
* tick handler.
*/
object Audio {
private def sampleRate = 8000
private def sampleRate = Settings.get.beepSampleRate
private val sources = mutable.Set.empty[Source]