diff options
author | kleines Filmröllchen <filmroellchen@serenityos.org> | 2022-11-13 17:36:55 +0100 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2022-12-15 00:21:00 -0700 |
commit | cc9192a1e729bd9adf2c3daf93f4b709a582e3a0 (patch) | |
tree | 939af04edf5a2ffd02f56fbbeb43c23b13b7fcc7 | |
parent | 836f28392d9cb5936fa438c2e6305b6c9deeee6a (diff) | |
download | serenity-cc9192a1e729bd9adf2c3daf93f4b709a582e3a0.zip |
LibAudio: Expose blocking realtime enqueue to audio clients
This is just a delegate of the same function found in the shared queue
itself.
-rw-r--r-- | Userland/Libraries/LibAudio/ConnectionToServer.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibAudio/ConnectionToServer.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibAudio/ConnectionToServer.cpp b/Userland/Libraries/LibAudio/ConnectionToServer.cpp index 31649c41b7..6146a2c5e1 100644 --- a/Userland/Libraries/LibAudio/ConnectionToServer.cpp +++ b/Userland/Libraries/LibAudio/ConnectionToServer.cpp @@ -11,6 +11,7 @@ #include <AK/Time.h> #include <AK/Types.h> #include <LibAudio/ConnectionToServer.h> +#include <LibAudio/Queue.h> #include <LibAudio/UserSampleQueue.h> #include <LibCore/Event.h> #include <LibThreading/Mutex.h> @@ -116,6 +117,11 @@ ErrorOr<void, AudioQueue::QueueStatus> ConnectionToServer::realtime_enqueue(Arra return m_buffer->try_enqueue(samples); } +ErrorOr<void> ConnectionToServer::blocking_realtime_enqueue(Array<Sample, AUDIO_BUFFER_SIZE> samples, Function<void()> wait_function) +{ + return m_buffer->try_blocking_enqueue(samples, move(wait_function)); +} + unsigned ConnectionToServer::total_played_samples() const { return m_buffer->weak_tail() * AUDIO_BUFFER_SIZE; diff --git a/Userland/Libraries/LibAudio/ConnectionToServer.h b/Userland/Libraries/LibAudio/ConnectionToServer.h index ca840d90a2..bd63e226a1 100644 --- a/Userland/Libraries/LibAudio/ConnectionToServer.h +++ b/Userland/Libraries/LibAudio/ConnectionToServer.h @@ -45,6 +45,7 @@ public: // Returns immediately with the appropriate status if the buffer is full; use in conjunction with remaining_buffers to get low latency. ErrorOr<void, AudioQueue::QueueStatus> realtime_enqueue(Array<Sample, AUDIO_BUFFER_SIZE> samples); + ErrorOr<void> blocking_realtime_enqueue(Array<Sample, AUDIO_BUFFER_SIZE> samples, Function<void()> wait_function); // This information can be deducted from the shared audio buffer. unsigned total_played_samples() const; |