diff options
author | kleines Filmröllchen <filmroellchen@serenityos.org> | 2022-07-17 11:31:01 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-07-19 11:17:45 +0100 |
commit | 3f59356c79a044e7f2c49a7e456f8309d47508fd (patch) | |
tree | 86a7b701f55a40c97be5d7b02a545aa91c67d076 /Userland/Libraries/LibAudio | |
parent | 70846d701cc117176eca150c54649639ec5e8337 (diff) | |
download | serenity-3f59356c79a044e7f2c49a7e456f8309d47508fd.zip |
LibAudio: Rename ConnectionFromClient to ConnectionToServer
The automatic nomenclature change for IPC sockets got this one wrong.
Diffstat (limited to 'Userland/Libraries/LibAudio')
-rw-r--r-- | Userland/Libraries/LibAudio/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibAudio/ConnectionToServer.cpp (renamed from Userland/Libraries/LibAudio/ConnectionFromClient.cpp) | 30 | ||||
-rw-r--r-- | Userland/Libraries/LibAudio/ConnectionToServer.h (renamed from Userland/Libraries/LibAudio/ConnectionFromClient.h) | 8 |
3 files changed, 20 insertions, 20 deletions
diff --git a/Userland/Libraries/LibAudio/CMakeLists.txt b/Userland/Libraries/LibAudio/CMakeLists.txt index 06c3dad5ac..ea3534d8af 100644 --- a/Userland/Libraries/LibAudio/CMakeLists.txt +++ b/Userland/Libraries/LibAudio/CMakeLists.txt @@ -1,6 +1,6 @@ set(SOURCES SampleFormats.cpp - ConnectionFromClient.cpp + ConnectionToServer.cpp Loader.cpp WavLoader.cpp FlacLoader.cpp diff --git a/Userland/Libraries/LibAudio/ConnectionFromClient.cpp b/Userland/Libraries/LibAudio/ConnectionToServer.cpp index fe3e4e9ae2..44d2ab2766 100644 --- a/Userland/Libraries/LibAudio/ConnectionFromClient.cpp +++ b/Userland/Libraries/LibAudio/ConnectionToServer.cpp @@ -10,7 +10,7 @@ #include <AK/OwnPtr.h> #include <AK/Time.h> #include <AK/Types.h> -#include <LibAudio/ConnectionFromClient.h> +#include <LibAudio/ConnectionToServer.h> #include <LibAudio/UserSampleQueue.h> #include <LibCore/Event.h> #include <LibThreading/Mutex.h> @@ -18,7 +18,7 @@ namespace Audio { -ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) +ConnectionToServer::ConnectionToServer(NonnullOwnPtr<Core::Stream::LocalSocket> socket) : IPC::ConnectionToServer<AudioClientEndpoint, AudioServerEndpoint>(*this, move(socket)) , m_buffer(make<AudioQueue>(MUST(AudioQueue::try_create()))) , m_user_queue(make<UserSampleQueue>()) @@ -37,12 +37,12 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock set_buffer(*m_buffer); } -ConnectionFromClient::~ConnectionFromClient() +ConnectionToServer::~ConnectionToServer() { die(); } -void ConnectionFromClient::die() +void ConnectionToServer::die() { // We're sometimes getting here after the other thread has already exited and its event loop does no longer exist. m_enqueuer_loop_destruction.lock(); @@ -54,7 +54,7 @@ void ConnectionFromClient::die() (void)m_background_audio_enqueuer->join(); } -ErrorOr<void> ConnectionFromClient::async_enqueue(FixedArray<Sample>&& samples) +ErrorOr<void> ConnectionToServer::async_enqueue(FixedArray<Sample>&& samples) { update_good_sleep_time(); m_user_queue->append(move(samples)); @@ -66,12 +66,12 @@ ErrorOr<void> ConnectionFromClient::async_enqueue(FixedArray<Sample>&& samples) return {}; } -void ConnectionFromClient::clear_client_buffer() +void ConnectionToServer::clear_client_buffer() { m_user_queue->clear(); } -void ConnectionFromClient::update_good_sleep_time() +void ConnectionToServer::update_good_sleep_time() { auto sample_rate = static_cast<double>(get_sample_rate()); auto buffer_play_time_ns = 1'000'000'000.0 / (sample_rate / static_cast<double>(AUDIO_BUFFER_SIZE)); @@ -80,7 +80,7 @@ void ConnectionFromClient::update_good_sleep_time() } // Non-realtime audio writing loop -void ConnectionFromClient::custom_event(Core::CustomEvent&) +void ConnectionToServer::custom_event(Core::CustomEvent&) { Array<Sample, AUDIO_BUFFER_SIZE> next_chunk; while (true) { @@ -107,39 +107,39 @@ void ConnectionFromClient::custom_event(Core::CustomEvent&) m_audio_enqueuer_active.store(false); } -ErrorOr<void, AudioQueue::QueueStatus> ConnectionFromClient::realtime_enqueue(Array<Sample, AUDIO_BUFFER_SIZE> samples) +ErrorOr<void, AudioQueue::QueueStatus> ConnectionToServer::realtime_enqueue(Array<Sample, AUDIO_BUFFER_SIZE> samples) { return m_buffer->try_enqueue(samples); } -unsigned ConnectionFromClient::total_played_samples() const +unsigned ConnectionToServer::total_played_samples() const { return m_buffer->weak_tail() * AUDIO_BUFFER_SIZE; } -unsigned ConnectionFromClient::remaining_samples() +unsigned ConnectionToServer::remaining_samples() { return static_cast<unsigned>(m_user_queue->remaining_samples()); } -size_t ConnectionFromClient::remaining_buffers() const +size_t ConnectionToServer::remaining_buffers() const { return m_buffer->size() - m_buffer->weak_remaining_capacity(); } -void ConnectionFromClient::main_mix_muted_state_changed(bool muted) +void ConnectionToServer::main_mix_muted_state_changed(bool muted) { if (on_main_mix_muted_state_change) on_main_mix_muted_state_change(muted); } -void ConnectionFromClient::main_mix_volume_changed(double volume) +void ConnectionToServer::main_mix_volume_changed(double volume) { if (on_main_mix_volume_change) on_main_mix_volume_change(volume); } -void ConnectionFromClient::client_volume_changed(double volume) +void ConnectionToServer::client_volume_changed(double volume) { if (on_client_volume_change) on_client_volume_change(volume); diff --git a/Userland/Libraries/LibAudio/ConnectionFromClient.h b/Userland/Libraries/LibAudio/ConnectionToServer.h index b74e553bc8..154d7bb5b5 100644 --- a/Userland/Libraries/LibAudio/ConnectionFromClient.h +++ b/Userland/Libraries/LibAudio/ConnectionToServer.h @@ -23,12 +23,12 @@ namespace Audio { -class ConnectionFromClient final +class ConnectionToServer final : public IPC::ConnectionToServer<AudioClientEndpoint, AudioServerEndpoint> , public AudioClientEndpoint { - IPC_CLIENT_CONNECTION(ConnectionFromClient, "/tmp/portal/audio") + IPC_CLIENT_CONNECTION(ConnectionToServer, "/tmp/portal/audio") public: - virtual ~ConnectionFromClient() override; + virtual ~ConnectionToServer() override; // Both of these APIs are for convenience and when you don't care about real-time behavior. // They will not work properly in conjunction with realtime_enqueue. @@ -61,7 +61,7 @@ public: Function<void(double volume)> on_client_volume_change; private: - ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); + ConnectionToServer(NonnullOwnPtr<Core::Stream::LocalSocket>); virtual void main_mix_muted_state_changed(bool) override; virtual void main_mix_volume_changed(double) override; |