ref: aede7b6069cc6b7502d2f73f8969034df40206bc
parent: 00d016183268476ec6be3572af26d7349e5a92bc
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Sep 10 10:04:06 EDT 2019
Restore the FREQUENCY constant Cave Story at 2000Hz is fun
--- a/src/Backends/Audio/SDL2.cpp
+++ b/src/Backends/Audio/SDL2.cpp
@@ -10,6 +10,8 @@
#include "../../Organya.h"
#include "../../WindowsWrapper.h"
+#define OUTPUT_FREQUENCY 44100
+
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define clamp(x, y, z) MIN(MAX((x), (y)), (z))
@@ -45,7 +47,7 @@
static void SetSoundFrequency(AudioBackend_Sound *sound, unsigned int frequency)
{sound->frequency = frequency;
- sound->advance_delta = frequency / 44100.0;
+ sound->advance_delta = (double)frequency / (double)OUTPUT_FREQUENCY;
}
static void SetSoundVolume(AudioBackend_Sound *sound, long volume)
@@ -148,7 +150,7 @@
if (organya_countdown == 0)
{- organya_countdown = (organya_timer * 44100) / 1000; // organya_timer is in milliseconds, so convert it to audio frames
+ organya_countdown = (organya_timer * OUTPUT_FREQUENCY) / 1000; // organya_timer is in milliseconds, so convert it to audio frames
UpdateOrganya();
}
@@ -168,10 +170,10 @@
return FALSE;
SDL_AudioSpec specification;
- specification.freq = 44100;
+ specification.freq = OUTPUT_FREQUENCY;
specification.format = AUDIO_F32;
specification.channels = 2;
- specification.samples = 0x400; // Roughly 10 milliseconds
+ specification.samples = 0x400; // Roughly 10 milliseconds for 44100Hz
specification.callback = Callback;
specification.userdata = NULL;
--- a/src/Sound.cpp
+++ b/src/Sound.cpp
@@ -24,8 +24,6 @@
#include "PixTone.h"
#include "Tags.h"
-#define FREQUENCY 44100
-
AudioBackend_Sound *lpSECONDARYBUFFER[SE_MAX];
// DirectSoundの開始 (Starting DirectSound)
--
⑨