summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/CubebStream.cpp
diff options
context:
space:
mode:
authorMichael M <mchtly@gmail.com>2017-10-21 16:23:40 -0700
committerMichael M <mchtly@gmail.com>2017-11-19 12:09:54 -0800
commit0baddbf9a8152ab7dd3ab200e516a998a0c9433f (patch)
tree66ef68e2df83ed39845082818506778271bfcbe3 /Source/Core/AudioCommon/CubebStream.cpp
parentad4a89d64b0d346553be473c1d877b34b896bfeb (diff)
SoundStream: change Start/Stop to Init/SetRunning/destruct
Diffstat (limited to 'Source/Core/AudioCommon/CubebStream.cpp')
-rw-r--r--Source/Core/AudioCommon/CubebStream.cpp33
1 files changed, 8 insertions, 25 deletions
diff --git a/Source/Core/AudioCommon/CubebStream.cpp b/Source/Core/AudioCommon/CubebStream.cpp
index c2f3cc30cb..754db1d957 100644
--- a/Source/Core/AudioCommon/CubebStream.cpp
+++ b/Source/Core/AudioCommon/CubebStream.cpp
@@ -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,
- &params, 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, &params, 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);