CubebStream: implement SetRunning

This commit is contained in:
Michael M 2017-10-21 12:49:34 -07:00
parent 28f9034536
commit ad4a89d64b
2 changed files with 16 additions and 4 deletions

View File

@ -76,12 +76,23 @@ bool CubebStream::Start()
return true; return true;
} }
void CubebStream::Stop() void CubebStream::SetRunning(bool running)
{ {
if (cubeb_stream_stop(m_stream) != CUBEB_OK) if (running)
{ {
if (cubeb_stream_start(m_stream) != CUBEB_OK)
ERROR_LOG(AUDIO, "Error starting cubeb stream");
}
else
{
if (cubeb_stream_stop(m_stream) != CUBEB_OK)
ERROR_LOG(AUDIO, "Error stopping cubeb stream"); ERROR_LOG(AUDIO, "Error stopping cubeb stream");
} }
}
void CubebStream::Stop()
{
SetRunning(false);
cubeb_stream_destroy(m_stream); cubeb_stream_destroy(m_stream);
m_ctx.reset(); m_ctx.reset();
} }

View File

@ -17,6 +17,7 @@ class CubebStream final : public SoundStream
public: public:
bool Start() override; bool Start() override;
void Stop() override; void Stop() override;
void SetRunning(bool running) override;
void SetVolume(int) override; void SetVolume(int) override;
private: private: