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
commit a98de0b6ee
Notes: sideshowbarker 2024-07-19 12:18:20 +09:00
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();