1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +00:00

AudioServer: Add a buffer queue so we can buffer some sound.

The idea here is to keep a small number of sample buffers queued in the
AudioServer so we don't get caught without something to play.
This commit is contained in:
Andreas Kling 2019-07-28 18:27:32 +02:00
parent 7f82e86fb8
commit 7cabe6433e
6 changed files with 61 additions and 1 deletions

View file

@ -1,8 +1,10 @@
#pragma once
#include <AK/Queue.h>
#include <LibAudio/ASAPI.h>
#include <LibCore/CoreIPCServer.h>
class ABuffer;
class ASMixer;
class ASClientConnection final : public IPC::Server::Connection<ASAPI_ServerMessage, ASAPI_ClientMessage> {
@ -16,5 +18,9 @@ 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 };
};