mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
SoundStream: change Start/Stop to Init/SetRunning/destruct
This commit is contained in:
@ -32,7 +32,7 @@ void CubebStream::StateCallback(cubeb_stream* stream, void* user_data, cubeb_sta
|
||||
{
|
||||
}
|
||||
|
||||
bool CubebStream::Start()
|
||||
bool CubebStream::Init()
|
||||
{
|
||||
m_ctx = CubebUtils::GetContext();
|
||||
if (!m_ctx)
|
||||
@ -60,37 +60,20 @@ bool CubebStream::Start()
|
||||
ERROR_LOG(AUDIO, "Error getting minimum latency");
|
||||
INFO_LOG(AUDIO, "Minimum latency: %i frames", minimum_latency);
|
||||
|
||||
if (cubeb_stream_init(m_ctx.get(), &m_stream, "Dolphin Audio Output", nullptr, nullptr, nullptr,
|
||||
¶ms, std::max(BUFFER_SAMPLES, minimum_latency), DataCallback,
|
||||
StateCallback, this) != CUBEB_OK)
|
||||
{
|
||||
ERROR_LOG(AUDIO, "Error initializing cubeb stream");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cubeb_stream_start(m_stream) != CUBEB_OK)
|
||||
{
|
||||
ERROR_LOG(AUDIO, "Error starting cubeb stream");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return cubeb_stream_init(m_ctx.get(), &m_stream, "Dolphin Audio Output", nullptr, nullptr,
|
||||
nullptr, ¶ms, std::max(BUFFER_SAMPLES, minimum_latency),
|
||||
DataCallback, StateCallback, this) == CUBEB_OK;
|
||||
}
|
||||
|
||||
void CubebStream::SetRunning(bool running)
|
||||
bool CubebStream::SetRunning(bool running)
|
||||
{
|
||||
if (running)
|
||||
{
|
||||
if (cubeb_stream_start(m_stream) != CUBEB_OK)
|
||||
ERROR_LOG(AUDIO, "Error starting cubeb stream");
|
||||
}
|
||||
return cubeb_stream_start(m_stream) == CUBEB_OK;
|
||||
else
|
||||
{
|
||||
if (cubeb_stream_stop(m_stream) != CUBEB_OK)
|
||||
ERROR_LOG(AUDIO, "Error stopping cubeb stream");
|
||||
}
|
||||
return cubeb_stream_stop(m_stream) == CUBEB_OK;
|
||||
}
|
||||
|
||||
void CubebStream::Stop()
|
||||
CubebStream::~CubebStream()
|
||||
{
|
||||
SetRunning(false);
|
||||
cubeb_stream_destroy(m_stream);
|
||||
|
Reference in New Issue
Block a user