mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-29 03:32:42 +00:00
Renamed ProxyTransport -> MasterTransport and update_gain_settings to
set_gain_settings.
This commit is contained in:
parent
95a7fa3010
commit
3b6ab78ba5
@ -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
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include <pch.hpp>
|
||||
|
||||
#include "ProxyTransport.h"
|
||||
#include "MasterTransport.h"
|
||||
|
||||
#include <core/audio/GaplessTransport.h>
|
||||
#include <core/audio/CrossfadeTransport.h>
|
||||
@ -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);
|
||||
}
|
@ -39,15 +39,15 @@
|
||||
#include <core/support/Preferences.h>
|
||||
|
||||
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);
|
@ -133,7 +133,7 @@ static inline void savePreferences(
|
||||
PlaybackService::PlaybackService(
|
||||
IMessageQueue& messageQueue,
|
||||
ILibraryPtr library,
|
||||
ProxyTransport& transport)
|
||||
MasterTransport& transport)
|
||||
: library(library)
|
||||
, transport(transport)
|
||||
, playlist(library)
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <core/library/track/Track.h>
|
||||
#include <core/library/track/TrackList.h>
|
||||
#include <core/library/ILibrary.h>
|
||||
#include <core/audio/ProxyTransport.h>
|
||||
#include <core/audio/MasterTransport.h>
|
||||
#include <core/support/Preferences.h>
|
||||
#include <core/runtime/IMessageQueue.h>
|
||||
|
||||
@ -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;
|
||||
|
@ -94,7 +94,7 @@
|
||||
<ClCompile Include="audio\GaplessTransport.cpp" />
|
||||
<ClCompile Include="audio\Outputs.cpp" />
|
||||
<ClCompile Include="audio\PlaybackService.cpp" />
|
||||
<ClCompile Include="audio\ProxyTransport.cpp" />
|
||||
<ClCompile Include="audio\MasterTransport.cpp" />
|
||||
<ClCompile Include="audio\Streams.cpp" />
|
||||
<ClCompile Include="audio\Visualizer.cpp" />
|
||||
<ClCompile Include="debug.cpp" />
|
||||
@ -152,7 +152,7 @@
|
||||
<ClInclude Include="audio\ITransport.h" />
|
||||
<ClInclude Include="audio\Outputs.h" />
|
||||
<ClInclude Include="audio\PlaybackService.h" />
|
||||
<ClInclude Include="audio\ProxyTransport.h" />
|
||||
<ClInclude Include="audio\MasterTransport.h" />
|
||||
<ClInclude Include="audio\Streams.h" />
|
||||
<ClInclude Include="audio\Visualizer.h" />
|
||||
<ClInclude Include="debug.h" />
|
||||
|
@ -208,15 +208,15 @@
|
||||
<ClCompile Include="library\query\local\AllCategoriesQuery.cpp">
|
||||
<Filter>src\library\query\local</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="audio\ProxyTransport.cpp">
|
||||
<Filter>src\audio</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="support\Playback.cpp">
|
||||
<Filter>src\support</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="support\Duration.cpp">
|
||||
<Filter>src\support</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="audio\MasterTransport.cpp">
|
||||
<Filter>src\audio</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.hpp">
|
||||
@ -513,14 +513,14 @@
|
||||
<ClInclude Include="library\query\local\AllCategoriesQuery.h">
|
||||
<Filter>src\library\query\local</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="audio\ProxyTransport.h">
|
||||
<Filter>src\audio</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="support\Duration.h">
|
||||
<Filter>src\support</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="support\Playback.h">
|
||||
<Filter>src\support</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="audio\MasterTransport.h">
|
||||
<Filter>src\audio</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -50,7 +50,7 @@
|
||||
#include <core/i18n/Locale.h>
|
||||
#include <core/audio/PlaybackService.h>
|
||||
|
||||
#include <core/audio/ProxyTransport.h>
|
||||
#include <core/audio/MasterTransport.h>
|
||||
|
||||
#include <core/debug.h>
|
||||
#include <core/library/LibraryFactory.h>
|
||||
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include <core/library/ILibrary.h>
|
||||
#include <core/runtime/IMessageTarget.h>
|
||||
|
||||
#include <core/audio/ProxyTransport.h>
|
||||
#include <core/audio/MasterTransport.h>
|
||||
|
||||
#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();
|
||||
|
@ -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");
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <cursespp/DialogOverlay.h>
|
||||
|
||||
#include <core/audio/PlaybackService.h>
|
||||
#include <core/audio/ProxyTransport.h>
|
||||
#include <core/audio/MasterTransport.h>
|
||||
|
||||
#include <app/window/TrackListView.h>
|
||||
#include <app/model/DirectoryAdapter.h>
|
||||
@ -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<musik::core::Preferences> prefs;
|
||||
|
||||
|
@ -102,7 +102,7 @@ PlaybackOverlays::PlaybackOverlays() {
|
||||
}
|
||||
|
||||
void PlaybackOverlays::ShowOutputDriverOverlay(
|
||||
ProxyTransport::Type transportType,
|
||||
MasterTransport::Type transportType,
|
||||
std::function<void()> 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<void()> callback) {
|
||||
}
|
||||
|
||||
void PlaybackOverlays::ShowTransportOverlay(
|
||||
ProxyTransport::Type transportType,
|
||||
std::function<void(ProxyTransport::Type)> callback)
|
||||
MasterTransport::Type transportType,
|
||||
std::function<void(MasterTransport::Type)> 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<ListOverlay> 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);
|
||||
|
@ -35,7 +35,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <core/audio/ProxyTransport.h>
|
||||
#include <core/audio/MasterTransport.h>
|
||||
#include <core/sdk/IPlaybackService.h>
|
||||
|
||||
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<void()> callback);
|
||||
|
||||
static void ShowOutputDeviceOverlay(std::function<void()> callback);
|
||||
|
||||
static void ShowTransportOverlay(
|
||||
musik::core::audio::ProxyTransport::Type transportType,
|
||||
std::function<void(musik::core::audio::ProxyTransport::Type)> callback);
|
||||
musik::core::audio::MasterTransport::Type transportType,
|
||||
std::function<void(musik::core::audio::MasterTransport::Type)> callback);
|
||||
|
||||
static void ShowReplayGainOverlay(std::function<void()> callback);
|
||||
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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];
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user