diff --git a/src/Sound.cpp b/src/Sound.cpp index 126a029f..1f5b14ff 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -70,7 +70,6 @@ u16 soundFinalWave [1470]; int soundBufferLen = sizeof soundFinalWave; int soundDebug = 0; -u32 soundNextPosition = 0; bool soundPaused = true; void interp_rate() { /* empty for now */ } @@ -548,8 +547,6 @@ void soundReset() SOUND_CLOCK_TICKS = SOUND_CLOCK_TICKS_; soundTicks = SOUND_CLOCK_TICKS_; - soundNextPosition = 0; - soundEvent( NR52, (u8) 0x80 ); } @@ -570,13 +567,11 @@ void soundSetQuality(int quality) { soundShutdown(); soundQuality = quality; - soundNextPosition = 0; soundInit(); } else { soundQuality = quality; - soundNextPosition = 0; } remake_stereo_buffer(); diff --git a/src/Sound.h b/src/Sound.h index 52875460..cc53913e 100644 --- a/src/Sound.h +++ b/src/Sound.h @@ -59,8 +59,6 @@ extern int soundInterpolation; // 1 if PCM should have low-pass filtering extern float soundFiltering; // 0.0 = none, 1.0 = max (only if soundInterpolation!=0) // Unknown purpose -extern int soundBufferTotalLen; -extern u32 soundNextPosition; extern bool soundPaused; #endif // VBA_SOUND_H diff --git a/src/dmg/gbSound.cpp b/src/dmg/gbSound.cpp index 839f8385..fa45581c 100644 --- a/src/dmg/gbSound.cpp +++ b/src/dmg/gbSound.cpp @@ -41,7 +41,6 @@ extern int soundQuality; extern bool soundPaused; extern int soundTicks; extern int SOUND_CLOCK_TICKS; -extern u32 soundNextPosition; int const ticks_to_time = 2 * GB_APU_OVERCLOCK; @@ -189,7 +188,6 @@ void gbSoundReset() reset_apu(); soundPaused = 1; - soundNextPosition = 0; gbSoundEvent(0xff10, 0x80); gbSoundEvent(0xff11, 0xbf); @@ -235,13 +233,11 @@ void gbSoundSetQuality(int quality) { soundShutdown(); soundQuality = quality; - soundNextPosition = 0; soundInit(); } else { soundQuality = quality; - soundNextPosition = 0; } remake_stereo_buffer(); diff --git a/src/win32/DirectSound.cpp b/src/win32/DirectSound.cpp index 6b9b74fb..9be2dfad 100644 --- a/src/win32/DirectSound.cpp +++ b/src/win32/DirectSound.cpp @@ -47,6 +47,7 @@ private: HANDLE dsbEvent; WAVEFORMATEX wfx; // Primary buffer wave format int soundBufferTotalLen; + unsigned int soundNextPosition; public: DirectSound(); @@ -69,6 +70,7 @@ DirectSound::DirectSound() dsbEvent = NULL; soundBufferTotalLen = 14700; + soundNextPosition = 0; } @@ -144,6 +146,7 @@ bool DirectSound::init() // then multiply it with the size of a sample frame (16 bit * stereo) soundBufferLen = ( freq / 60 ) * 4; soundBufferTotalLen = soundBufferLen * 10; + soundNextPosition = 0; ZeroMemory( &wfx, sizeof(WAVEFORMATEX) ); wfx.wFormatTag = WAVE_FORMAT_PCM; @@ -227,6 +230,8 @@ void DirectSound::reset() dsbSecondary->Stop(); dsbSecondary->SetCurrentPosition( 0 ); + + soundNextPosition = 0; }