mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 11:15:08 +00:00

Fork the IPC Connection classes into Server:: and Client::ConnectionNG. The new IPC messages are serialized very snugly instead of using the same generic data structure for all messages. Remove ASAPI.h since we now generate all of it from AudioServer.ipc :^)
36 lines
917 B
C++
36 lines
917 B
C++
#include <LibAudio/ABuffer.h>
|
|
#include <LibAudio/AClientConnection.h>
|
|
#include <SharedBuffer.h>
|
|
|
|
AClientConnection::AClientConnection()
|
|
: ConnectionNG("/tmp/asportal")
|
|
{
|
|
}
|
|
|
|
void AClientConnection::handshake()
|
|
{
|
|
auto response = send_sync<AudioServer::Greet>(getpid());
|
|
set_server_pid(response->server_pid());
|
|
set_my_client_id(response->client_id());
|
|
}
|
|
|
|
void AClientConnection::enqueue(const ABuffer& buffer)
|
|
{
|
|
for (;;) {
|
|
const_cast<ABuffer&>(buffer).shared_buffer().share_with(server_pid());
|
|
auto response = send_sync<AudioServer::EnqueueBuffer>(buffer.shared_buffer_id());
|
|
if (response->success())
|
|
break;
|
|
sleep(1);
|
|
}
|
|
}
|
|
|
|
int AClientConnection::get_main_mix_volume()
|
|
{
|
|
return send_sync<AudioServer::GetMainMixVolume>()->volume();
|
|
}
|
|
|
|
void AClientConnection::set_main_mix_volume(int volume)
|
|
{
|
|
send_sync<AudioServer::SetMainMixVolume>(volume);
|
|
}
|