diff --git a/src/main.cpp b/src/main.cpp index 220072c..23c6084 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -719,9 +719,8 @@ void emulator() unsigned caddyIndex; int headSoundCounter = 0; int headSoundFreqCounter = 0; - //const int headSoundFreq = 3333; // 300Hz = 1/300 * 10^6; - //const int headSoundFreq = 1666; // 600Hz = 1/600 * 10^6; - const int headSoundFreq = 833; // 1200Hz = 1/1200 * 10^6; +// const int headSoundFreq = 833; // 1200Hz = 1/1200 * 10^6; + const int headSoundFreq = 1000000 / options.SoundOnGPIOFreq(); // 1200Hz = 1/1200 * 10^6; unsigned char oldHeadDir; unsigned numberOfImages = diskCaddy.GetNumberOfImages(); @@ -801,7 +800,7 @@ void emulator() oldHeadDir = headDir; if (options.SoundOnGPIO()) { - headSoundCounter = 1000000; + headSoundCounter = 1000 * options.SoundOnGPIODuration(); headSoundFreqCounter = headSoundFreq; } else diff --git a/src/options.cpp b/src/options.cpp index 26c3b31..64c9ff4 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -131,6 +131,8 @@ Options::Options(void) , quickBoot(0) , displayPNGIcons(0) , soundOnGPIO(0) + , soundOnGPIODuration(1000) + , soundOnGPIOFreq(1200) , invertIECInputs(0) , invertIECOutputs(1) , splitIECLines(0) @@ -192,6 +194,8 @@ void Options::Process(char* buffer) ELSE_CHECK_DECIMAL_OPTION(quickBoot) ELSE_CHECK_DECIMAL_OPTION(displayPNGIcons) ELSE_CHECK_DECIMAL_OPTION(soundOnGPIO) + ELSE_CHECK_DECIMAL_OPTION(soundOnGPIODuration) + ELSE_CHECK_DECIMAL_OPTION(soundOnGPIOFreq) ELSE_CHECK_DECIMAL_OPTION(invertIECInputs) ELSE_CHECK_DECIMAL_OPTION(invertIECOutputs) ELSE_CHECK_DECIMAL_OPTION(splitIECLines) diff --git a/src/options.h b/src/options.h index aa80a2b..c51760c 100644 --- a/src/options.h +++ b/src/options.h @@ -58,6 +58,8 @@ public: inline unsigned int QuickBoot() const { return quickBoot; } inline unsigned int DisplayPNGIcons() const { return displayPNGIcons; } inline unsigned int SoundOnGPIO() const { return soundOnGPIO; } + inline unsigned int SoundOnGPIODuration() const { return soundOnGPIODuration; } + inline unsigned int SoundOnGPIOFreq() const { return soundOnGPIOFreq; } inline unsigned int SplitIECLines() const { return splitIECLines; } inline unsigned int InvertIECInputs() const { return invertIECInputs; } inline unsigned int InvertIECOutputs() const { return invertIECOutputs; } @@ -89,6 +91,8 @@ private: unsigned int quickBoot; unsigned int displayPNGIcons; unsigned int soundOnGPIO; + unsigned int soundOnGPIODuration; + unsigned int soundOnGPIOFreq; unsigned int invertIECInputs; unsigned int invertIECOutputs; unsigned int splitIECLines;