mirror of https://github.com/stella-emu/stella.git
Fixed sound crash in Windows.
This commit is contained in:
parent
bd607a37dc
commit
a4bd8a562b
|
@ -52,14 +52,14 @@ SoundSDL::SoundSDL(OSystem& osystem, AudioSettings& audioSettings)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reserve 8K for the audio buffer; seems to be enough on most systems
|
||||||
|
myBuffer.reserve(8_KB);
|
||||||
|
|
||||||
SDL_zero(mySpec);
|
SDL_zero(mySpec);
|
||||||
if(!myAudioSettings.enabled() || !openDevice())
|
if(!myAudioSettings.enabled())
|
||||||
Logger::info("Sound disabled\n");
|
Logger::info("Sound disabled\n");
|
||||||
|
|
||||||
Logger::debug("SoundSDL::SoundSDL initialized");
|
Logger::debug("SoundSDL::SoundSDL initialized");
|
||||||
|
|
||||||
// Reserve 8K for the audio buffer; seems to be enough on most systems
|
|
||||||
myBuffer.reserve(8_KB);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -105,8 +105,11 @@ bool SoundSDL::openDevice()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void SoundSDL::setEnabled(bool enable)
|
void SoundSDL::setEnabled(bool enable)
|
||||||
{
|
{
|
||||||
|
if(myIsInitializedFlag)
|
||||||
|
{
|
||||||
mute(!enable);
|
mute(!enable);
|
||||||
pause(!enable);
|
pause(!enable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -140,6 +143,7 @@ void SoundSDL::open(shared_ptr<AudioQueue> audioQueue,
|
||||||
// Adjust volume to that defined in settings
|
// Adjust volume to that defined in settings
|
||||||
setVolume(myAudioSettings.volume());
|
setVolume(myAudioSettings.volume());
|
||||||
|
|
||||||
|
// Initialize resampler; must be done after the sound device has opened
|
||||||
initResampler();
|
initResampler();
|
||||||
|
|
||||||
// Show some info
|
// Show some info
|
||||||
|
|
Loading…
Reference in New Issue