Fix naming

This commit is contained in:
Christian Semmler 2024-06-08 17:21:51 -04:00
parent 4ae52e4b5b
commit f924c576d0
6 changed files with 19 additions and 15 deletions

View File

@ -56,7 +56,7 @@ class LegoCacheSound : public MxCore {
MxString FUN_10006d80(const MxString& p_str);
// [library:audio] WAVE_FORMAT_PCM (audio in .SI files only used this format)
static const MxU32 supportedFormatTag = 1;
static const MxU32 g_supportedFormatTag = 1;
ma_audio_buffer m_buffer;
ma_sound m_cacheSound;

View File

@ -48,7 +48,7 @@ MxResult LegoCacheSound::Create(
// [library:audio] These should never be null
assert(p_data != NULL && p_dataSize != 0);
assert(p_pwfx.m_formatTag == supportedFormatTag);
assert(p_pwfx.m_formatTag == g_supportedFormatTag);
assert(p_pwfx.m_bitsPerSample == 8 || p_pwfx.m_bitsPerSample == 16);
CopyData(p_data, p_dataSize);

View File

@ -35,8 +35,12 @@ class MxSoundManager : public MxAudioManager {
// Not sure how DirectSound handles this when different buffers have different rates.
static const MxU32 sampleRate = 44100;
static void SDLCALL
AudioStreamCallback(void* p_userdata, SDL_AudioStream* p_stream, int p_additionalAmount, int p_totalAmount);
static void AudioStreamCallback(
void* p_userdata,
SDL_AudioStream* p_stream,
int p_additionalAmount,
int p_totalAmount
);
ma_engine m_engine;
SDL_AudioStream* m_stream;

View File

@ -79,13 +79,13 @@ class MxWavePresenter : public MxSoundPresenter {
MxBool WriteToSoundBuffer(void* p_audioPtr, MxU32 p_length);
// [library:audio] One chunk has up to 1 second worth of frames
static const MxU32 millisecondsPerChunk = 1000;
static const MxU32 g_millisecondsPerChunk = 1000;
// [library:audio] Store up to 2 chunks worth of frames (same as in original game)
static const MxU32 rbSizeInMilliseconds = millisecondsPerChunk * 2;
static const MxU32 g_rbSizeInMilliseconds = g_millisecondsPerChunk * 2;
// [library:audio] WAVE_FORMAT_PCM (audio in .SI files only used this format)
static const MxU32 supportedFormatTag = 1;
static const MxU32 g_supportedFormatTag = 1;
WaveFormat* m_waveFormat; // 0x54
ma_pcm_rb m_rb;

View File

@ -127,7 +127,7 @@ MxResult MxSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
return status;
}
void SDLCALL MxSoundManager::AudioStreamCallback(
void MxSoundManager::AudioStreamCallback(
void* p_userdata,
SDL_AudioStream* p_stream,
int p_additionalAmount,

View File

@ -56,11 +56,11 @@ void MxWavePresenter::Destroy(MxBool p_fromDestructor)
MxBool MxWavePresenter::WriteToSoundBuffer(void* p_audioPtr, MxU32 p_length)
{
ma_uint32 requestedFrames =
ma_calculate_buffer_size_in_frames_from_milliseconds(millisecondsPerChunk, m_waveFormat->m_samplesPerSec);
ma_calculate_buffer_size_in_frames_from_milliseconds(g_millisecondsPerChunk, m_waveFormat->m_samplesPerSec);
ma_uint32 acquiredFrames = requestedFrames;
void* p_bufferOut;
void* bufferOut;
ma_pcm_rb_acquire_write(&m_rb, &acquiredFrames, &p_bufferOut);
ma_pcm_rb_acquire_write(&m_rb, &acquiredFrames, &bufferOut);
// [library:audio] If there isn't enough space in the buffer for a full chunk, try again later.
if (acquiredFrames != requestedFrames) {
@ -71,11 +71,11 @@ MxBool MxWavePresenter::WriteToSoundBuffer(void* p_audioPtr, MxU32 p_length)
ma_uint32 acquiredBytes = acquiredFrames * ma_get_bytes_per_frame(m_rb.format, m_rb.channels);
assert(p_length <= acquiredBytes);
memcpy(p_bufferOut, p_audioPtr, p_length);
memcpy(bufferOut, p_audioPtr, p_length);
// [library:audio] Pad with silence data if we don't have a full chunk.
if (p_length < acquiredBytes) {
memset((ma_uint8*) p_bufferOut + p_length, m_silenceData, acquiredBytes - p_length);
memset((ma_uint8*) bufferOut + p_length, m_silenceData, acquiredBytes - p_length);
}
ma_pcm_rb_commit_write(&m_rb, acquiredFrames);
@ -105,7 +105,7 @@ void MxWavePresenter::StartingTickle()
MxBool success = FALSE;
m_chunkLength = chunk->GetLength();
assert(m_waveFormat->m_formatTag == supportedFormatTag);
assert(m_waveFormat->m_formatTag == g_supportedFormatTag);
assert(m_waveFormat->m_bitsPerSample == 8 || m_waveFormat->m_bitsPerSample == 16);
// [library:audio]
@ -132,7 +132,7 @@ void MxWavePresenter::StartingTickle()
m_waveFormat->m_bitsPerSample == 16 ? ma_format_s16 : ma_format_u8,
m_waveFormat->m_channels,
ma_calculate_buffer_size_in_frames_from_milliseconds(
rbSizeInMilliseconds,
g_rbSizeInMilliseconds,
m_waveFormat->m_samplesPerSec
),
NULL,