Restore the FREQUENCY constant

Cave Story at 2000Hz is fun
This commit is contained in:
Clownacy 2019-09-10 14:04:06 +00:00
parent 00d0161832
commit aede7b6069
2 changed files with 6 additions and 6 deletions

View file

@ -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 double MillibelToScale(long volume)
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 @@ static void Callback(void *user_data, Uint8 *stream_uint8, int len)
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 @@ BOOL AudioBackend_Init(void)
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;

View file

@ -24,8 +24,6 @@ equivalents.
#include "PixTone.h"
#include "Tags.h"
#define FREQUENCY 44100
AudioBackend_Sound *lpSECONDARYBUFFER[SE_MAX];
// DirectSoundの開始 (Starting DirectSound)