yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Merge pull request #5809 from ogniK5377/FlushAudioOutBuffers

audout: FlushAudioOutBuffers
This commit is contained in:
bunnei 2021-01-28 21:54:46 -08:00 committed by GitHub
commit b786568c5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -51,6 +51,14 @@ void Stream::Stop() {
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
bool Stream::Flush() {
const bool had_buffers = !queued_buffers.empty();
while (!queued_buffers.empty()) {
queued_buffers.pop();
}
return had_buffers;
}
void Stream::SetVolume(float volume) { void Stream::SetVolume(float volume) {
game_volume = volume; game_volume = volume;
} }

View File

@ -56,6 +56,9 @@ public:
/// Queues a buffer into the audio stream, returns true on success /// Queues a buffer into the audio stream, returns true on success
bool QueueBuffer(BufferPtr&& buffer); bool QueueBuffer(BufferPtr&& buffer);
/// Flush audio buffers
bool Flush();
/// Returns true if the audio stream contains a buffer with the specified tag /// Returns true if the audio stream contains a buffer with the specified tag
[[nodiscard]] bool ContainsBuffer(Buffer::Tag tag) const; [[nodiscard]] bool ContainsBuffer(Buffer::Tag tag) const;

View File

@ -58,7 +58,7 @@ public:
{8, &IAudioOut::GetReleasedAudioOutBufferImpl, "GetReleasedAudioOutBufferAuto"}, {8, &IAudioOut::GetReleasedAudioOutBufferImpl, "GetReleasedAudioOutBufferAuto"},
{9, &IAudioOut::GetAudioOutBufferCount, "GetAudioOutBufferCount"}, {9, &IAudioOut::GetAudioOutBufferCount, "GetAudioOutBufferCount"},
{10, nullptr, "GetAudioOutPlayedSampleCount"}, {10, nullptr, "GetAudioOutPlayedSampleCount"},
{11, nullptr, "FlushAudioOutBuffers"}, {11, &IAudioOut::FlushAudioOutBuffers, "FlushAudioOutBuffers"},
{12, &IAudioOut::SetAudioOutVolume, "SetAudioOutVolume"}, {12, &IAudioOut::SetAudioOutVolume, "SetAudioOutVolume"},
{13, &IAudioOut::GetAudioOutVolume, "GetAudioOutVolume"}, {13, &IAudioOut::GetAudioOutVolume, "GetAudioOutVolume"},
}; };
@ -185,6 +185,14 @@ private:
rb.Push(static_cast<u32>(stream->GetQueueSize())); rb.Push(static_cast<u32>(stream->GetQueueSize()));
} }
void FlushAudioOutBuffers(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Audio, "called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
rb.Push(stream->Flush());
}
void SetAudioOutVolume(Kernel::HLERequestContext& ctx) { void SetAudioOutVolume(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const float volume = rp.Pop<float>(); const float volume = rp.Pop<float>();