mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03: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: https://github.com/SerenityOS/serenity/commit/a98de0b6eea
@ -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();
|
||||
|
@ -12,6 +12,7 @@ public:
|
||||
|
||||
virtual void handshake() override;
|
||||
void enqueue(const ABuffer&);
|
||||
bool try_enqueue(const ABuffer&);
|
||||
|
||||
int get_main_mix_volume();
|
||||
void set_main_mix_volume(int);
|
||||
|
Loading…
Reference in New Issue
Block a user