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:
parent
2441c1fde2
commit
a98de0b6ee
2 changed files with 8 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue