From be31e2232cb2a62126ccef4be428eab7703eb617 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 28 Jul 2019 21:27:18 +0200 Subject: AudioServer+LibAudio: Make mixing queue-based instead of buffer-based. Each client connection now sets up an ASBufferQueue, which is basically a queue of ABuffers. This allows us to immediately start streaming the next pending buffer whenever our current buffer runs out of samples. This makes the majority of the skippiness go away for me. :^) Also get rid of the old PlayBuffer API, since we don't need it anymore. --- Libraries/LibAudio/AClientConnection.cpp | 10 ---------- Libraries/LibAudio/AClientConnection.h | 1 - Libraries/LibAudio/ASAPI.h | 1 - 3 files changed, 12 deletions(-) (limited to 'Libraries/LibAudio') diff --git a/Libraries/LibAudio/AClientConnection.cpp b/Libraries/LibAudio/AClientConnection.cpp index abe9a307c4..d77a455c51 100644 --- a/Libraries/LibAudio/AClientConnection.cpp +++ b/Libraries/LibAudio/AClientConnection.cpp @@ -17,15 +17,6 @@ void AClientConnection::handshake() set_my_client_id(response.greeting.your_client_id); } -void AClientConnection::play(const ABuffer& buffer, bool block) -{ - const_cast(buffer).shared_buffer().share_with(server_pid()); - ASAPI_ClientMessage request; - request.type = ASAPI_ClientMessage::Type::PlayBuffer; - 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 (;;) { @@ -36,7 +27,6 @@ void AClientConnection::enqueue(const ABuffer& buffer) auto response = sync_request(request, ASAPI_ServerMessage::Type::EnqueueBufferResponse); if (response.success) break; - dbg() << "EnqueueBuffer failed, retrying..."; sleep(1); } } diff --git a/Libraries/LibAudio/AClientConnection.h b/Libraries/LibAudio/AClientConnection.h index 2cc224353d..1a6c00abac 100644 --- a/Libraries/LibAudio/AClientConnection.h +++ b/Libraries/LibAudio/AClientConnection.h @@ -11,6 +11,5 @@ public: AClientConnection(); virtual void handshake() override; - void play(const ABuffer&, bool block); void enqueue(const ABuffer&); }; diff --git a/Libraries/LibAudio/ASAPI.h b/Libraries/LibAudio/ASAPI.h index 0dabd28c86..47da165de6 100644 --- a/Libraries/LibAudio/ASAPI.h +++ b/Libraries/LibAudio/ASAPI.h @@ -28,7 +28,6 @@ struct ASAPI_ClientMessage { enum class Type { Invalid, Greeting, - PlayBuffer, EnqueueBuffer, }; -- cgit v1.2.3