mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
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.
27 lines
745 B
C++
27 lines
745 B
C++
#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> {
|
|
C_OBJECT(ASClientConnection)
|
|
public:
|
|
explicit ASClientConnection(CLocalSocket&, int client_id, ASMixer& mixer);
|
|
~ASClientConnection() override;
|
|
void send_greeting() override;
|
|
bool handle_message(const ASAPI_ClientMessage&, const ByteBuffer&& = {}) override;
|
|
|
|
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 };
|
|
};
|