diff options
| -rw-r--r-- | src/audio_core/stream.cpp | 8 | ||||
| -rw-r--r-- | src/audio_core/stream.h | 3 | ||||
| -rw-r--r-- | src/core/hle/service/audio/audout_u.cpp | 10 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp index afe68c9ed..5b0b285cd 100644 --- a/src/audio_core/stream.cpp +++ b/src/audio_core/stream.cpp | |||
| @@ -51,6 +51,14 @@ void Stream::Stop() { | |||
| 51 | UNIMPLEMENTED(); | 51 | UNIMPLEMENTED(); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | bool Stream::Flush() { | ||
| 55 | const bool had_buffers = !queued_buffers.empty(); | ||
| 56 | while (!queued_buffers.empty()) { | ||
| 57 | queued_buffers.pop(); | ||
| 58 | } | ||
| 59 | return had_buffers; | ||
| 60 | } | ||
| 61 | |||
| 54 | void Stream::SetVolume(float volume) { | 62 | void Stream::SetVolume(float volume) { |
| 55 | game_volume = volume; | 63 | game_volume = volume; |
| 56 | } | 64 | } |
diff --git a/src/audio_core/stream.h b/src/audio_core/stream.h index 506ac536b..559844b9b 100644 --- a/src/audio_core/stream.h +++ b/src/audio_core/stream.h | |||
| @@ -56,6 +56,9 @@ public: | |||
| 56 | /// Queues a buffer into the audio stream, returns true on success | 56 | /// Queues a buffer into the audio stream, returns true on success |
| 57 | bool QueueBuffer(BufferPtr&& buffer); | 57 | bool QueueBuffer(BufferPtr&& buffer); |
| 58 | 58 | ||
| 59 | /// Flush audio buffers | ||
| 60 | bool Flush(); | ||
| 61 | |||
| 59 | /// Returns true if the audio stream contains a buffer with the specified tag | 62 | /// Returns true if the audio stream contains a buffer with the specified tag |
| 60 | [[nodiscard]] bool ContainsBuffer(Buffer::Tag tag) const; | 63 | [[nodiscard]] bool ContainsBuffer(Buffer::Tag tag) const; |
| 61 | 64 | ||
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 02ca711fb..273a46265 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp | |||
| @@ -58,7 +58,7 @@ public: | |||
| 58 | {8, &IAudioOut::GetReleasedAudioOutBufferImpl, "GetReleasedAudioOutBufferAuto"}, | 58 | {8, &IAudioOut::GetReleasedAudioOutBufferImpl, "GetReleasedAudioOutBufferAuto"}, |
| 59 | {9, &IAudioOut::GetAudioOutBufferCount, "GetAudioOutBufferCount"}, | 59 | {9, &IAudioOut::GetAudioOutBufferCount, "GetAudioOutBufferCount"}, |
| 60 | {10, nullptr, "GetAudioOutPlayedSampleCount"}, | 60 | {10, nullptr, "GetAudioOutPlayedSampleCount"}, |
| 61 | {11, nullptr, "FlushAudioOutBuffers"}, | 61 | {11, &IAudioOut::FlushAudioOutBuffers, "FlushAudioOutBuffers"}, |
| 62 | {12, &IAudioOut::SetAudioOutVolume, "SetAudioOutVolume"}, | 62 | {12, &IAudioOut::SetAudioOutVolume, "SetAudioOutVolume"}, |
| 63 | {13, &IAudioOut::GetAudioOutVolume, "GetAudioOutVolume"}, | 63 | {13, &IAudioOut::GetAudioOutVolume, "GetAudioOutVolume"}, |
| 64 | }; | 64 | }; |
| @@ -185,6 +185,14 @@ private: | |||
| 185 | rb.Push(static_cast<u32>(stream->GetQueueSize())); | 185 | rb.Push(static_cast<u32>(stream->GetQueueSize())); |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | void FlushAudioOutBuffers(Kernel::HLERequestContext& ctx) { | ||
| 189 | LOG_DEBUG(Service_Audio, "called"); | ||
| 190 | |||
| 191 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 192 | rb.Push(RESULT_SUCCESS); | ||
| 193 | rb.Push(stream->Flush()); | ||
| 194 | } | ||
| 195 | |||
| 188 | void SetAudioOutVolume(Kernel::HLERequestContext& ctx) { | 196 | void SetAudioOutVolume(Kernel::HLERequestContext& ctx) { |
| 189 | IPC::RequestParser rp{ctx}; | 197 | IPC::RequestParser rp{ctx}; |
| 190 | const float volume = rp.Pop<float>(); | 198 | const float volume = rp.Pop<float>(); |