diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index 6c067f3ca..446cd4b96 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -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. diff --git a/src/main/scala/li/cil/oc/Settings.scala b/src/main/scala/li/cil/oc/Settings.scala index 56f5537e9..c0140ee1a 100644 --- a/src/main/scala/li/cil/oc/Settings.scala +++ b/src/main/scala/li/cil/oc/Settings.scala @@ -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 diff --git a/src/main/scala/li/cil/oc/util/Audio.scala b/src/main/scala/li/cil/oc/util/Audio.scala index 468dee7ec..ae8f9b515 100644 --- a/src/main/scala/li/cil/oc/util/Audio.scala +++ b/src/main/scala/li/cil/oc/util/Audio.scala @@ -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]