summaryrefslogtreecommitdiff
path: root/Servers/AudioServer/ASClientConnection.h
blob: d3946a834f381521272f81e843dc896245b1c31f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include <AudioServer/AudioServerEndpoint.h>
#include <LibCore/CoreIPCServer.h>

class ABuffer;
class ASBufferQueue;
class ASMixer;

class ASClientConnection final : public IPC::Server::ConnectionNG<AudioServerEndpoint>
    , public AudioServerEndpoint {
    C_OBJECT(ASClientConnection)
public:
    explicit ASClientConnection(CLocalSocket&, int client_id, ASMixer& mixer);
    ~ASClientConnection() override;
    void did_finish_playing_buffer(Badge<ASMixer>, int buffer_id);

    virtual void die() override;

private:
    virtual OwnPtr<AudioServer::GreetResponse> handle(const AudioServer::Greet&) override;
    virtual OwnPtr<AudioServer::GetMainMixVolumeResponse> handle(const AudioServer::GetMainMixVolume&) override;
    virtual OwnPtr<AudioServer::SetMainMixVolumeResponse> handle(const AudioServer::SetMainMixVolume&) override;
    virtual OwnPtr<AudioServer::EnqueueBufferResponse> handle(const AudioServer::EnqueueBuffer&) override;
    virtual OwnPtr<AudioServer::GetRemainingSamplesResponse> handle(const AudioServer::GetRemainingSamples&) override;
    virtual OwnPtr<AudioServer::GetPlayedSamplesResponse> handle(const AudioServer::GetPlayedSamples&) override;
    virtual OwnPtr<AudioServer::SetPausedResponse> handle(const AudioServer::SetPaused&) override;
    virtual OwnPtr<AudioServer::ClearBufferResponse> handle(const AudioServer::ClearBuffer&) override;
    virtual OwnPtr<AudioServer::GetPlayingBufferResponse> handle(const AudioServer::GetPlayingBuffer&) override;

    ASMixer& m_mixer;
    RefPtr<ASBufferQueue> m_queue;
};