mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 22:34:54 +00:00
Split SetSoundStreamRunning
into StartSoundStream
and StopSoundStream
This commit is contained in:
parent
ac0d6cbaaa
commit
8cc18164ee
3 changed files with 30 additions and 12 deletions
|
@ -73,7 +73,7 @@ void PostInitSoundStream(Core::System& system)
|
||||||
// This needs to be called after AudioInterface::Init and SerialInterface::Init (for GBA devices)
|
// This needs to be called after AudioInterface::Init and SerialInterface::Init (for GBA devices)
|
||||||
// where input sample rates are set
|
// where input sample rates are set
|
||||||
UpdateSoundStream(system);
|
UpdateSoundStream(system);
|
||||||
SetSoundStreamRunning(system, true);
|
StartSoundStream(system);
|
||||||
|
|
||||||
if (Config::Get(Config::MAIN_DUMP_AUDIO) && !system.IsAudioDumpStarted())
|
if (Config::Get(Config::MAIN_DUMP_AUDIO) && !system.IsAudioDumpStarted())
|
||||||
StartAudioDump(system);
|
StartAudioDump(system);
|
||||||
|
@ -86,7 +86,7 @@ void ShutdownSoundStream(Core::System& system)
|
||||||
if (Config::Get(Config::MAIN_DUMP_AUDIO) && system.IsAudioDumpStarted())
|
if (Config::Get(Config::MAIN_DUMP_AUDIO) && system.IsAudioDumpStarted())
|
||||||
StopAudioDump(system);
|
StopAudioDump(system);
|
||||||
|
|
||||||
SetSoundStreamRunning(system, false);
|
StopSoundStream(system);
|
||||||
system.SetSoundStream(nullptr);
|
system.SetSoundStream(nullptr);
|
||||||
|
|
||||||
INFO_LOG_FMT(AUDIO, "Done shutting down sound stream");
|
INFO_LOG_FMT(AUDIO, "Done shutting down sound stream");
|
||||||
|
@ -170,23 +170,40 @@ void UpdateSoundStream(Core::System& system)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSoundStreamRunning(Core::System& system, bool running)
|
void StartSoundStream(Core::System& system)
|
||||||
{
|
{
|
||||||
SoundStream* sound_stream = system.GetSoundStream();
|
SoundStream* sound_stream = system.GetSoundStream();
|
||||||
|
|
||||||
if (!sound_stream)
|
if (!sound_stream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (system.IsSoundStreamRunning() == running)
|
if (system.IsSoundStreamRunning())
|
||||||
return;
|
return;
|
||||||
system.SetSoundStreamRunning(running);
|
|
||||||
|
|
||||||
if (sound_stream->SetRunning(running))
|
system.SetSoundStreamRunning(true);
|
||||||
|
|
||||||
|
if (sound_stream->SetRunning(true))
|
||||||
return;
|
return;
|
||||||
if (running)
|
|
||||||
ERROR_LOG_FMT(AUDIO, "Error starting stream.");
|
ERROR_LOG_FMT(AUDIO, "Error starting stream.");
|
||||||
else
|
}
|
||||||
ERROR_LOG_FMT(AUDIO, "Error stopping stream.");
|
|
||||||
|
void StopSoundStream(Core::System& system)
|
||||||
|
{
|
||||||
|
SoundStream* sound_stream = system.GetSoundStream();
|
||||||
|
|
||||||
|
if (!sound_stream)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!system.IsSoundStreamRunning())
|
||||||
|
return;
|
||||||
|
|
||||||
|
system.SetSoundStreamRunning(false);
|
||||||
|
|
||||||
|
if (sound_stream->SetRunning(false))
|
||||||
|
return;
|
||||||
|
|
||||||
|
ERROR_LOG_FMT(AUDIO, "Error stopping stream.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendAIBuffer(Core::System& system, const short* samples, unsigned int num_samples)
|
void SendAIBuffer(Core::System& system, const short* samples, unsigned int num_samples)
|
||||||
|
|
|
@ -30,7 +30,8 @@ bool SupportsDPL2Decoder(std::string_view backend);
|
||||||
bool SupportsLatencyControl(std::string_view backend);
|
bool SupportsLatencyControl(std::string_view backend);
|
||||||
bool SupportsVolumeChanges(std::string_view backend);
|
bool SupportsVolumeChanges(std::string_view backend);
|
||||||
void UpdateSoundStream(Core::System& system);
|
void UpdateSoundStream(Core::System& system);
|
||||||
void SetSoundStreamRunning(Core::System& system, bool running);
|
void StartSoundStream(Core::System& system);
|
||||||
|
void StopSoundStream(Core::System& system);
|
||||||
void SendAIBuffer(Core::System& system, const short* samples, unsigned int num_samples);
|
void SendAIBuffer(Core::System& system, const short* samples, unsigned int num_samples);
|
||||||
void StartAudioDump(Core::System& system);
|
void StartAudioDump(Core::System& system);
|
||||||
void StopAudioDump(Core::System& system);
|
void StopAudioDump(Core::System& system);
|
||||||
|
|
|
@ -176,7 +176,7 @@ void CPUManager::RunAdjacentSystems(bool running)
|
||||||
m_system.GetFifo().EmulatorState(running);
|
m_system.GetFifo().EmulatorState(running);
|
||||||
// Core is responsible for shutting down the sound stream.
|
// Core is responsible for shutting down the sound stream.
|
||||||
if (m_state != State::PowerDown)
|
if (m_state != State::PowerDown)
|
||||||
AudioCommon::SetSoundStreamRunning(m_system, running);
|
running ? AudioCommon::StartSoundStream(m_system) : AudioCommon::StopSoundStream(m_system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUManager::Stop()
|
void CPUManager::Stop()
|
||||||
|
|
Loading…
Add table
Reference in a new issue