1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

LibAudio: Add AClientConnetion::try_enqueue() API

This is a variant of the enqueue() API that returns immediately and
may fail. It's useful when you don't want to block until the audio
server can receive your sample buffer.
This commit is contained in:
Andreas Kling 2019-09-04 20:12:24 +02:00
parent 2441c1fde2
commit a98de0b6ee
2 changed files with 8 additions and 0 deletions

View file

@ -25,6 +25,13 @@ void AClientConnection::enqueue(const ABuffer& buffer)
}
}
bool AClientConnection::try_enqueue(const ABuffer& buffer)
{
const_cast<ABuffer&>(buffer).shared_buffer().share_with(server_pid());
auto response = send_sync<AudioServer::EnqueueBuffer>(buffer.shared_buffer_id());
return response->success();
}
int AClientConnection::get_main_mix_volume()
{
return send_sync<AudioServer::GetMainMixVolume>()->volume();