mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-30 09:35:40 +00:00
CubebAudioStream: Use cubeb's volume control
This commit is contained in:
parent
907e0de35a
commit
eefbd8f6a6
|
@ -126,7 +126,7 @@ long CubebAudioStream::DataCallback(cubeb_stream* stm, void* user_ptr, const voi
|
||||||
long nframes)
|
long nframes)
|
||||||
{
|
{
|
||||||
CubebAudioStream* const this_ptr = static_cast<CubebAudioStream*>(user_ptr);
|
CubebAudioStream* const this_ptr = static_cast<CubebAudioStream*>(user_ptr);
|
||||||
this_ptr->ReadFrames(reinterpret_cast<SampleType*>(output_buffer), static_cast<u32>(nframes), true);
|
this_ptr->ReadFrames(reinterpret_cast<SampleType*>(output_buffer), static_cast<u32>(nframes), false);
|
||||||
return nframes;
|
return nframes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,6 +139,12 @@ void CubebAudioStream::StateCallback(cubeb_stream* stream, void* user_ptr, cubeb
|
||||||
|
|
||||||
void CubebAudioStream::FramesAvailable() {}
|
void CubebAudioStream::FramesAvailable() {}
|
||||||
|
|
||||||
|
void CubebAudioStream::SetOutputVolume(u32 volume)
|
||||||
|
{
|
||||||
|
AudioStream::SetOutputVolume(volume);
|
||||||
|
cubeb_stream_set_volume(m_cubeb_stream, static_cast<float>(m_output_volume) / 100.0f);
|
||||||
|
}
|
||||||
|
|
||||||
void CubebAudioStream::DestroyContext()
|
void CubebAudioStream::DestroyContext()
|
||||||
{
|
{
|
||||||
cubeb_destroy(m_cubeb_context);
|
cubeb_destroy(m_cubeb_context);
|
||||||
|
|
|
@ -18,6 +18,7 @@ protected:
|
||||||
void PauseDevice(bool paused) override;
|
void PauseDevice(bool paused) override;
|
||||||
void CloseDevice() override;
|
void CloseDevice() override;
|
||||||
void FramesAvailable() override;
|
void FramesAvailable() override;
|
||||||
|
void SetOutputVolume(u32 volume) override;
|
||||||
|
|
||||||
void DestroyContext();
|
void DestroyContext();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue