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

AudioServer: Port to the new generated IPC mechanism

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 :^)
This commit is contained in:
Andreas Kling 2019-08-03 19:41:02 +02:00
parent 3519b6c201
commit 8e684f0959
14 changed files with 327 additions and 329 deletions

View file

@ -3,23 +3,23 @@
#include <SharedBuffer.h>
AClientConnection::AClientConnection()
: Connection("/tmp/asportal")
: ConnectionNG("/tmp/asportal")
{
}
void AClientConnection::handshake()
{
auto response = send_sync<ASAPI_Client::Greeting>(getpid());
set_server_pid(response.server_pid());
set_my_client_id(response.your_client_id());
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<ASAPI_Client::EnqueueBuffer>(buffer.shared_buffer_id());
if (response.success())
auto response = send_sync<AudioServer::EnqueueBuffer>(buffer.shared_buffer_id());
if (response->success())
break;
sleep(1);
}
@ -27,10 +27,10 @@ void AClientConnection::enqueue(const ABuffer& buffer)
int AClientConnection::get_main_mix_volume()
{
return send_sync<ASAPI_Client::GetMainMixVolume>().volume();
return send_sync<AudioServer::GetMainMixVolume>()->volume();
}
void AClientConnection::set_main_mix_volume(int volume)
{
send_sync<ASAPI_Client::SetMainMixVolume>(volume);
send_sync<AudioServer::SetMainMixVolume>(volume);
}