1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2026-01-19 20:21:00 +00:00
serenity/Servers/AudioServer/ASClientConnection.h
Andreas Kling be31e2232c 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.
2019-07-28 21:34:47 +02:00

23 lines
654 B
C++

#pragma once
#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> {
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:
ASMixer& m_mixer;
RefPtr<ASBufferQueue> m_queue;
};