From 3b6ab78ba5a67d59e6f40a1ad23736c1a6507f42 Mon Sep 17 00:00:00 2001 From: casey langen Date: Wed, 17 Jan 2018 20:57:53 -0800 Subject: [PATCH] Renamed ProxyTransport -> MasterTransport and update_gain_settings to set_gain_settings. --- src/core/CMakeLists.txt | 2 +- ...ProxyTransport.cpp => MasterTransport.cpp} | 54 +++++++++---------- .../{ProxyTransport.h => MasterTransport.h} | 6 +-- src/core/audio/PlaybackService.cpp | 2 +- src/core/audio/PlaybackService.h | 6 +-- src/core/core.vcxproj | 4 +- src/core/core.vcxproj.filters | 12 ++--- src/musikcube/Main.cpp | 4 +- src/musikcube/app/layout/MainLayout.cpp | 2 +- src/musikcube/app/layout/MainLayout.h | 4 +- src/musikcube/app/layout/SettingsLayout.cpp | 8 +-- src/musikcube/app/layout/SettingsLayout.h | 6 +-- .../app/overlay/PlaybackOverlays.cpp | 16 +++--- src/musikcube/app/overlay/PlaybackOverlays.h | 8 +-- src/plugins/server/Constants.h | 2 +- src/plugins/server/WebSocketServer.cpp | 6 +-- src/plugins/server/WebSocketServer.h | 2 +- 17 files changed, 72 insertions(+), 72 deletions(-) rename src/core/audio/{ProxyTransport.cpp => MasterTransport.cpp} (77%) rename src/core/audio/{ProxyTransport.h => MasterTransport.h} (97%) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 500d2303e..0508f9485 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -4,7 +4,7 @@ set(CORE_SOURCES ./audio/Crossfader.cpp ./audio/CrossfadeTransport.cpp ./audio/GaplessTransport.cpp - ./audio/ProxyTransport.cpp + ./audio/MasterTransport.cpp ./audio/Outputs.cpp ./audio/PlaybackService.cpp ./audio/Player.cpp diff --git a/src/core/audio/ProxyTransport.cpp b/src/core/audio/MasterTransport.cpp similarity index 77% rename from src/core/audio/ProxyTransport.cpp rename to src/core/audio/MasterTransport.cpp index 7beb27b36..e6264ec23 100644 --- a/src/core/audio/ProxyTransport.cpp +++ b/src/core/audio/MasterTransport.cpp @@ -34,7 +34,7 @@ #include -#include "ProxyTransport.h" +#include "MasterTransport.h" #include #include @@ -46,17 +46,17 @@ using namespace musik::core; using namespace musik::core::prefs; using namespace musik::core::sdk; -ProxyTransport::ProxyTransport() +MasterTransport::MasterTransport() : prefs(Preferences::ForComponent(components::Playback)) { this->type = (Type) this->prefs->GetInt(keys::Transport, (int) Type::Gapless); this->SwitchTo(this->type); } -ProxyTransport::~ProxyTransport() { +MasterTransport::~MasterTransport() { } -void ProxyTransport::SwitchTo(Type type) { +void MasterTransport::SwitchTo(Type type) { if (!this->transport || this->type != type) { this->type = type; this->prefs->SetInt(keys::Transport, (int) this->type); @@ -86,91 +86,91 @@ void ProxyTransport::SwitchTo(Type type) { } this->transport->PlaybackEvent.connect( - this, &ProxyTransport::OnPlaybackEvent); + this, &MasterTransport::OnPlaybackEvent); this->transport->StreamEvent.connect( - this, &ProxyTransport::OnStreamEvent); + this, &MasterTransport::OnStreamEvent); this->transport->TimeChanged.connect( - this, &ProxyTransport::OnTimeChanged); + this, &MasterTransport::OnTimeChanged); this->transport->VolumeChanged.connect( - this, &ProxyTransport::OnVolumeChanged); + this, &MasterTransport::OnVolumeChanged); } } -ProxyTransport::Type ProxyTransport::GetType() { +MasterTransport::Type MasterTransport::GetType() { return this->type; } -void ProxyTransport::PrepareNextTrack(const std::string& trackUrl, Gain gain) { +void MasterTransport::PrepareNextTrack(const std::string& trackUrl, Gain gain) { this->transport->PrepareNextTrack(trackUrl, gain); } -void ProxyTransport::Start(const std::string& trackUrl, Gain gain) { +void MasterTransport::Start(const std::string& trackUrl, Gain gain) { this->transport->Start(trackUrl, gain); } -void ProxyTransport::Stop() { +void MasterTransport::Stop() { this->transport->Stop(); } -bool ProxyTransport::Pause() { +bool MasterTransport::Pause() { return this->transport->Pause(); } -bool ProxyTransport::Resume() { +bool MasterTransport::Resume() { return this->transport->Resume(); } -double ProxyTransport::Position() { +double MasterTransport::Position() { return this->transport->Position(); } -void ProxyTransport::SetPosition(double seconds) { +void MasterTransport::SetPosition(double seconds) { this->transport->SetPosition(seconds); } -double ProxyTransport::Volume() { +double MasterTransport::Volume() { return this->transport->Volume(); } -void ProxyTransport::SetVolume(double volume) { +void MasterTransport::SetVolume(double volume) { this->transport->SetVolume(volume); } -double ProxyTransport::GetDuration() { +double MasterTransport::GetDuration() { return this->transport->GetDuration(); } -bool ProxyTransport::IsMuted() { +bool MasterTransport::IsMuted() { return this->transport->IsMuted(); } -void ProxyTransport::SetMuted(bool muted) { +void MasterTransport::SetMuted(bool muted) { this->transport->SetMuted(muted); } -void ProxyTransport::ReloadOutput() { +void MasterTransport::ReloadOutput() { this->transport->ReloadOutput(); } -PlaybackState ProxyTransport::GetPlaybackState() { +PlaybackState MasterTransport::GetPlaybackState() { return this->transport->GetPlaybackState(); } -void ProxyTransport::OnStreamEvent(int type, std::string url) { +void MasterTransport::OnStreamEvent(int type, std::string url) { this->StreamEvent(type, url); } -void ProxyTransport::OnPlaybackEvent(int type) { +void MasterTransport::OnPlaybackEvent(int type) { this->PlaybackEvent(type); } -void ProxyTransport::OnVolumeChanged() { +void MasterTransport::OnVolumeChanged() { this->VolumeChanged(); } -void ProxyTransport::OnTimeChanged(double time) { +void MasterTransport::OnTimeChanged(double time) { this->TimeChanged(time); } \ No newline at end of file diff --git a/src/core/audio/ProxyTransport.h b/src/core/audio/MasterTransport.h similarity index 97% rename from src/core/audio/ProxyTransport.h rename to src/core/audio/MasterTransport.h index 91c873e1a..d6b314131 100644 --- a/src/core/audio/ProxyTransport.h +++ b/src/core/audio/MasterTransport.h @@ -39,15 +39,15 @@ #include namespace musik { namespace core { namespace audio { - class ProxyTransport : + class MasterTransport : public sigslot::has_slots<>, public musik::core::audio::ITransport { public: using Type = musik::core::sdk::TransportType; - ProxyTransport(); - virtual ~ProxyTransport(); + MasterTransport(); + virtual ~MasterTransport(); virtual void Start(const std::string& trackUrl, Gain gain); virtual void PrepareNextTrack(const std::string& trackUrl, Gain gain); diff --git a/src/core/audio/PlaybackService.cpp b/src/core/audio/PlaybackService.cpp index 5726829ac..8e898ecaa 100755 --- a/src/core/audio/PlaybackService.cpp +++ b/src/core/audio/PlaybackService.cpp @@ -133,7 +133,7 @@ static inline void savePreferences( PlaybackService::PlaybackService( IMessageQueue& messageQueue, ILibraryPtr library, - ProxyTransport& transport) + MasterTransport& transport) : library(library) , transport(transport) , playlist(library) diff --git a/src/core/audio/PlaybackService.h b/src/core/audio/PlaybackService.h index 464c3095c..b483e3dc6 100755 --- a/src/core/audio/PlaybackService.h +++ b/src/core/audio/PlaybackService.h @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include @@ -70,7 +70,7 @@ namespace musik { namespace core { namespace audio { PlaybackService( musik::core::runtime::IMessageQueue& messageQueue, musik::core::ILibraryPtr library, - musik::core::audio::ProxyTransport& transport); + musik::core::audio::MasterTransport& transport); ~PlaybackService(); @@ -192,7 +192,7 @@ namespace musik { namespace core { namespace audio { musik::core::TrackPtr playingTrack; musik::core::ILibraryPtr library; - musik::core::audio::ProxyTransport& transport; + musik::core::audio::MasterTransport& transport; size_t index, nextIndex; musik::core::sdk::RepeatMode repeatMode; diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj index 04f87f9bb..b8d6e084a 100755 --- a/src/core/core.vcxproj +++ b/src/core/core.vcxproj @@ -94,7 +94,7 @@ - + @@ -152,7 +152,7 @@ - + diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters index 9334c8b24..4f4f16304 100755 --- a/src/core/core.vcxproj.filters +++ b/src/core/core.vcxproj.filters @@ -208,15 +208,15 @@ src\library\query\local - - src\audio - src\support src\support + + src\audio + @@ -513,14 +513,14 @@ src\library\query\local - - src\audio - src\support src\support + + src\audio + \ No newline at end of file diff --git a/src/musikcube/Main.cpp b/src/musikcube/Main.cpp index 33d9a6934..b75904adc 100644 --- a/src/musikcube/Main.cpp +++ b/src/musikcube/Main.cpp @@ -50,7 +50,7 @@ #include #include -#include +#include #include #include @@ -129,7 +129,7 @@ int main(int argc, char* argv[]) { auto prefs = Preferences::ForComponent( musik::core::prefs::components::Settings); - ProxyTransport transport; + MasterTransport transport; PlaybackService playback(Window::MessageQueue(), library, transport); GlobalHotkeys globalHotkeys(playback, library); diff --git a/src/musikcube/app/layout/MainLayout.cpp b/src/musikcube/app/layout/MainLayout.cpp index cad283eb9..c2f3b6c9a 100755 --- a/src/musikcube/app/layout/MainLayout.cpp +++ b/src/musikcube/app/layout/MainLayout.cpp @@ -97,7 +97,7 @@ static void updateSyncingText(TextLabel* label, int updates) { MainLayout::MainLayout( cursespp::App& app, musik::core::audio::PlaybackService& playback, - musik::core::audio::ProxyTransport& transport, + musik::core::audio::MasterTransport& transport, ILibraryPtr library) : shortcutsFocused(false) , topLevelLayout(nullptr) diff --git a/src/musikcube/app/layout/MainLayout.h b/src/musikcube/app/layout/MainLayout.h index 2404eef43..08fea693b 100755 --- a/src/musikcube/app/layout/MainLayout.h +++ b/src/musikcube/app/layout/MainLayout.h @@ -46,7 +46,7 @@ #include #include -#include +#include #include "ITopLevelLayout.h" @@ -66,7 +66,7 @@ namespace musik { MainLayout( cursespp::App& app, musik::core::audio::PlaybackService& playback, - musik::core::audio::ProxyTransport& transport, + musik::core::audio::MasterTransport& transport, musik::core::ILibraryPtr library); virtual ~MainLayout(); diff --git a/src/musikcube/app/layout/SettingsLayout.cpp b/src/musikcube/app/layout/SettingsLayout.cpp index 2098eecec..a8ba3623d 100755 --- a/src/musikcube/app/layout/SettingsLayout.cpp +++ b/src/musikcube/app/layout/SettingsLayout.cpp @@ -140,7 +140,7 @@ SettingsLayout::SettingsLayout( cursespp::App& app, musik::core::ILibraryPtr library, musik::core::sdk::IPlaybackService& playback, - musik::core::audio::ProxyTransport& transport) + musik::core::audio::MasterTransport& transport) : LayoutBase() , app(app) , library(library) @@ -240,11 +240,11 @@ void SettingsLayout::OnReplayGainDropdownActivated(cursespp::TextLabel* label) { } void SettingsLayout::OnTransportDropdownActivate(cursespp::TextLabel* label) { - const ProxyTransport::Type current = getTransportType(); + const MasterTransport::Type current = getTransportType(); PlaybackOverlays::ShowTransportOverlay( current, - [this, current](ProxyTransport::Type selected) { + [this, current](MasterTransport::Type selected) { if (selected != current) { setTransportType(selected); this->playback.ReloadOutput(); @@ -638,7 +638,7 @@ void SettingsLayout::LoadPreferences() { /* transport type */ std::string transportName = - getTransportType() == ProxyTransport::Type::Gapless + getTransportType() == MasterTransport::Type::Gapless ? _TSTR("settings_transport_type_gapless") : _TSTR("settings_transport_type_crossfade"); diff --git a/src/musikcube/app/layout/SettingsLayout.h b/src/musikcube/app/layout/SettingsLayout.h index 831812f7c..c2d1f785c 100755 --- a/src/musikcube/app/layout/SettingsLayout.h +++ b/src/musikcube/app/layout/SettingsLayout.h @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include @@ -72,7 +72,7 @@ namespace musik { cursespp::App& app, musik::core::ILibraryPtr library, musik::core::sdk::IPlaybackService& playback, - musik::core::audio::ProxyTransport& transport); + musik::core::audio::MasterTransport& transport); virtual ~SettingsLayout(); @@ -121,7 +121,7 @@ namespace musik { musik::core::ILibraryPtr library; musik::core::IIndexer* indexer; musik::core::sdk::IPlaybackService& playback; - musik::core::audio::ProxyTransport& transport; + musik::core::audio::MasterTransport& transport; std::shared_ptr prefs; diff --git a/src/musikcube/app/overlay/PlaybackOverlays.cpp b/src/musikcube/app/overlay/PlaybackOverlays.cpp index ef49e5837..9eb51a0ba 100644 --- a/src/musikcube/app/overlay/PlaybackOverlays.cpp +++ b/src/musikcube/app/overlay/PlaybackOverlays.cpp @@ -102,7 +102,7 @@ PlaybackOverlays::PlaybackOverlays() { } void PlaybackOverlays::ShowOutputDriverOverlay( - ProxyTransport::Type transportType, + MasterTransport::Type transportType, std::function callback) { plugins = outputs::GetAllOutputs(); @@ -138,7 +138,7 @@ void PlaybackOverlays::ShowOutputDriverOverlay( .SetItemSelectedCallback( [callback, transportType](ListOverlay* overlay, IScrollAdapterPtr adapter, size_t index) { - if (transportType == ProxyTransport::Type::Crossfade) { + if (transportType == MasterTransport::Type::Crossfade) { std::string output = outputs::GetAllOutputs().at(index)->Name(); if (invalidCrossfadeOutputs.find(output) != invalidCrossfadeOutputs.end()) { showOutputCannotCrossfadeMessage(output); @@ -223,8 +223,8 @@ void PlaybackOverlays::ShowOutputDeviceOverlay(std::function callback) { } void PlaybackOverlays::ShowTransportOverlay( - ProxyTransport::Type transportType, - std::function callback) + MasterTransport::Type transportType, + std::function callback) { using Adapter = cursespp::SimpleScrollAdapter; using ListOverlay = cursespp::ListOverlay; @@ -234,7 +234,7 @@ void PlaybackOverlays::ShowTransportOverlay( adapter->AddEntry(_TSTR("settings_transport_type_crossfade")); adapter->SetSelectable(true); - size_t selectedIndex = (transportType == ProxyTransport::Type::Gapless) ? 0 : 1; + size_t selectedIndex = (transportType == MasterTransport::Type::Gapless) ? 0 : 1; std::shared_ptr dialog(new ListOverlay()); @@ -244,12 +244,12 @@ void PlaybackOverlays::ShowTransportOverlay( .SetItemSelectedCallback( [callback](ListOverlay* overlay, IScrollAdapterPtr adapter, size_t index) { auto result = (index == 0) - ? ProxyTransport::Type::Gapless - : ProxyTransport::Type::Crossfade; + ? MasterTransport::Type::Gapless + : MasterTransport::Type::Crossfade; std::string output = outputs::SelectedOutput()->Name(); - if (result == ProxyTransport::Type::Crossfade && + if (result == MasterTransport::Type::Crossfade && invalidCrossfadeOutputs.find(output) != invalidCrossfadeOutputs.end()) { showOutputCannotCrossfadeMessage(output); diff --git a/src/musikcube/app/overlay/PlaybackOverlays.h b/src/musikcube/app/overlay/PlaybackOverlays.h index 5f70b9935..18c158c1f 100644 --- a/src/musikcube/app/overlay/PlaybackOverlays.h +++ b/src/musikcube/app/overlay/PlaybackOverlays.h @@ -35,7 +35,7 @@ #pragma once #include -#include +#include #include namespace musik { @@ -43,14 +43,14 @@ namespace musik { class PlaybackOverlays { public: static void ShowOutputDriverOverlay( - musik::core::audio::ProxyTransport::Type transportType, + musik::core::audio::MasterTransport::Type transportType, std::function callback); static void ShowOutputDeviceOverlay(std::function callback); static void ShowTransportOverlay( - musik::core::audio::ProxyTransport::Type transportType, - std::function callback); + musik::core::audio::MasterTransport::Type transportType, + std::function callback); static void ShowReplayGainOverlay(std::function callback); diff --git a/src/plugins/server/Constants.h b/src/plugins/server/Constants.h index defb84624..f89eea508 100644 --- a/src/plugins/server/Constants.h +++ b/src/plugins/server/Constants.h @@ -189,7 +189,7 @@ namespace request { static const std::string list_output_drivers = "list_output_drivers"; static const std::string set_default_output_driver = "set_default_output_driver"; static const std::string get_gain_settings = "get_gain_settings"; - static const std::string update_gain_settings = "update_gain_settings"; + static const std::string set_gain_settings = "set_gain_settings"; static const std::string get_transport_type = "get_transport_type"; static const std::string set_transport_type = "set_transport_type"; } diff --git a/src/plugins/server/WebSocketServer.cpp b/src/plugins/server/WebSocketServer.cpp index 54c59a852..5b3760c5e 100644 --- a/src/plugins/server/WebSocketServer.cpp +++ b/src/plugins/server/WebSocketServer.cpp @@ -455,8 +455,8 @@ void WebSocketServer::HandleRequest(connection_hdl connection, json& request) { this->RespondWithGetGainSettings(connection, request); return; } - else if (name == request::update_gain_settings) { - this->RespondWithUpdateGainSettings(connection, request); + else if (name == request::set_gain_settings) { + this->RespondWithSetGainSettings(connection, request); return; } else if (name == request::get_transport_type) { @@ -1245,7 +1245,7 @@ void WebSocketServer::RespondWithGetGainSettings(connection_hdl connection, json }); } -void WebSocketServer::RespondWithUpdateGainSettings(connection_hdl connection, json& request) { +void WebSocketServer::RespondWithSetGainSettings(connection_hdl connection, json& request) { bool reload = false; auto& options = request[message::options]; diff --git a/src/plugins/server/WebSocketServer.h b/src/plugins/server/WebSocketServer.h index c170aa539..5bfeebc1b 100644 --- a/src/plugins/server/WebSocketServer.h +++ b/src/plugins/server/WebSocketServer.h @@ -157,7 +157,7 @@ class WebSocketServer { void RespondWithListOutputDrivers(connection_hdl connection, json& request); void RespondWithSetDefaultOutputDriver(connection_hdl connection, json& request); void RespondWithGetGainSettings(connection_hdl connection, json& request); - void RespondWithUpdateGainSettings(connection_hdl connection, json& request); + void RespondWithSetGainSettings(connection_hdl connection, json& request); void RespondWithGetTransportType(connection_hdl connection, json& request); void RespondWithSetTransportType(connection_hdl connection, json& request);