mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +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
Notes:
sideshowbarker
2024-07-19 12:18:20 +09:00
Author: https://github.com/awesomekling
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