1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:37:45 +00:00

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.
This commit is contained in:
Andreas Kling 2019-07-28 21:27:18 +02:00
parent 66db6f4f92
commit be31e2232c
7 changed files with 78 additions and 112 deletions

View file

@ -1,10 +1,10 @@
#pragma once
#include <AK/Queue.h>
#include <LibAudio/ASAPI.h>
#include <LibCore/CoreIPCServer.h>
class ABuffer;
class ASBufferQueue;
class ASMixer;
class ASClientConnection final : public IPC::Server::Connection<ASAPI_ServerMessage, ASAPI_ClientMessage> {
@ -18,9 +18,6 @@ public:
void did_finish_playing_buffer(Badge<ASMixer>, int buffer_id);
private:
void play_next_in_queue();
ASMixer& m_mixer;
Queue<NonnullRefPtr<ABuffer>> m_buffer_queue;
int m_playing_queued_buffer_id { -1 };
RefPtr<ASBufferQueue> m_queue;
};