diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-05-03 13:55:29 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-03 21:14:40 +0200 |
commit | eb21aa65d131f6fb382ad80d672e5a7ffb1a21e1 (patch) | |
tree | 674d52f397d8318941e97426b5100c18c8ac885f /Userland/Libraries/LibAudio | |
parent | 5bb79ea0a79322d944368825ec617ccfb8912b81 (diff) | |
download | serenity-eb21aa65d131f6fb382ad80d672e5a7ffb1a21e1.zip |
Userland: Make IPC results with one return value available directly
This changes client methods so that they return the IPC response's
return value directly - instead of the response struct - for IPC
methods which only have a single return value.
Diffstat (limited to 'Userland/Libraries/LibAudio')
-rw-r--r-- | Userland/Libraries/LibAudio/ClientConnection.cpp | 52 | ||||
-rw-r--r-- | Userland/Libraries/LibAudio/ClientConnection.h | 13 |
2 files changed, 3 insertions, 62 deletions
diff --git a/Userland/Libraries/LibAudio/ClientConnection.cpp b/Userland/Libraries/LibAudio/ClientConnection.cpp index f095b2a968..4f47bd41d5 100644 --- a/Userland/Libraries/LibAudio/ClientConnection.cpp +++ b/Userland/Libraries/LibAudio/ClientConnection.cpp @@ -22,8 +22,8 @@ void ClientConnection::handshake() void ClientConnection::enqueue(const Buffer& buffer) { for (;;) { - auto response = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); - if (response.success()) + auto success = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); + if (success) break; sleep(1); } @@ -31,53 +31,7 @@ void ClientConnection::enqueue(const Buffer& buffer) bool ClientConnection::try_enqueue(const Buffer& buffer) { - auto response = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); - return response.success(); -} - -bool ClientConnection::get_muted() -{ - return IPCProxy::get_muted().muted(); -} - -void ClientConnection::set_muted(bool muted) -{ - IPCProxy::set_muted(muted); -} - -int ClientConnection::get_main_mix_volume() -{ - return IPCProxy::get_main_mix_volume().volume(); -} - -void ClientConnection::set_main_mix_volume(int volume) -{ - IPCProxy::set_main_mix_volume(volume); -} - -int ClientConnection::get_remaining_samples() -{ - return IPCProxy::get_remaining_samples().remaining_samples(); -} - -int ClientConnection::get_played_samples() -{ - return IPCProxy::get_played_samples().played_samples(); -} - -void ClientConnection::set_paused(bool paused) -{ - IPCProxy::set_paused(paused); -} - -void ClientConnection::clear_buffer(bool paused) -{ - IPCProxy::clear_buffer(paused); -} - -int ClientConnection::get_playing_buffer() -{ - return IPCProxy::get_playing_buffer().buffer_id(); + return enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); } void ClientConnection::finished_playing_buffer(i32 buffer_id) diff --git a/Userland/Libraries/LibAudio/ClientConnection.h b/Userland/Libraries/LibAudio/ClientConnection.h index 3ef2cc3dcd..2d5b326d8a 100644 --- a/Userland/Libraries/LibAudio/ClientConnection.h +++ b/Userland/Libraries/LibAudio/ClientConnection.h @@ -24,19 +24,6 @@ public: void enqueue(const Buffer&); bool try_enqueue(const Buffer&); - bool get_muted(); - void set_muted(bool); - - int get_main_mix_volume(); - void set_main_mix_volume(int); - - int get_remaining_samples(); - int get_played_samples(); - int get_playing_buffer(); - - void set_paused(bool paused); - void clear_buffer(bool paused = false); - Function<void(i32 buffer_id)> on_finish_playing_buffer; Function<void(bool muted)> on_muted_state_change; Function<void(int volume)> on_main_mix_volume_change; |