summaryrefslogtreecommitdiff
path: root/Libraries/LibAudio/AClientConnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibAudio/AClientConnection.cpp')
-rw-r--r--Libraries/LibAudio/AClientConnection.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Libraries/LibAudio/AClientConnection.cpp b/Libraries/LibAudio/AClientConnection.cpp
index 0cb64578b2..abe9a307c4 100644
--- a/Libraries/LibAudio/AClientConnection.cpp
+++ b/Libraries/LibAudio/AClientConnection.cpp
@@ -25,3 +25,18 @@ void AClientConnection::play(const ABuffer& buffer, bool block)
request.play_buffer.buffer_id = buffer.shared_buffer_id();
sync_request(request, block ? ASAPI_ServerMessage::Type::FinishedPlayingBuffer : ASAPI_ServerMessage::Type::PlayingBuffer);
}
+
+void AClientConnection::enqueue(const ABuffer& buffer)
+{
+ for (;;) {
+ const_cast<ABuffer&>(buffer).shared_buffer().share_with(server_pid());
+ ASAPI_ClientMessage request;
+ request.type = ASAPI_ClientMessage::Type::EnqueueBuffer;
+ request.play_buffer.buffer_id = buffer.shared_buffer_id();
+ auto response = sync_request(request, ASAPI_ServerMessage::Type::EnqueueBufferResponse);
+ if (response.success)
+ break;
+ dbg() << "EnqueueBuffer failed, retrying...";
+ sleep(1);
+ }
+}