mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-23 18:40:02 +00:00
add command to move cursor proportionally to the track duration
This commit is contained in:
parent
0e9bfbaccc
commit
002762ace2
@ -78,6 +78,16 @@ namespace musik {
|
||||
playback.SetPosition(playback.GetPosition() - 10.0f);
|
||||
}
|
||||
|
||||
void SeekForwardProportional(IPlaybackService& playback) {
|
||||
double moveBy = 0.05f * playback.GetDuration();
|
||||
playback.SetPosition(playback.GetPosition() + moveBy);
|
||||
}
|
||||
|
||||
void SeekBackProportional(IPlaybackService& playback) {
|
||||
double moveBy = 0.05f * playback.GetDuration();
|
||||
playback.SetPosition(playback.GetPosition() - moveBy);
|
||||
}
|
||||
|
||||
void LoadPlaybackContext(Prefs prefs, ILibraryPtr library, PlaybackService& playback) {
|
||||
if (prefs->GetBool(keys::SaveSessionOnExit, true)) {
|
||||
auto query = std::shared_ptr<PersistedPlayQueueQuery>(
|
||||
|
@ -44,6 +44,8 @@ namespace musik {
|
||||
void VolumeDown(musik::core::audio::ITransport& transport);
|
||||
void SeekForward(musik::core::sdk::IPlaybackService& playback);
|
||||
void SeekBack(musik::core::sdk::IPlaybackService& playback);
|
||||
void SeekForwardProportional(musik::core::sdk::IPlaybackService& playback);
|
||||
void SeekBackProportional(musik::core::sdk::IPlaybackService& playback);
|
||||
void PauseOrResume(musik::core::audio::ITransport& transport);
|
||||
|
||||
void LoadPlaybackContext(
|
||||
|
@ -92,6 +92,14 @@ bool GlobalHotkeys::Handle(const std::string& kn) {
|
||||
core::playback::SeekForward(this->playback);
|
||||
return true;
|
||||
}
|
||||
else if (Hotkeys::Is(Hotkeys::SeekForwardProportional, kn)) {
|
||||
core::playback::SeekForwardProportional(this->playback);
|
||||
return true;
|
||||
}
|
||||
else if (Hotkeys::Is(Hotkeys::SeekBackProportional, kn)) {
|
||||
core::playback::SeekBackProportional(this->playback);
|
||||
return true;
|
||||
}
|
||||
else if (Hotkeys::Is(Hotkeys::ToggleRepeat, kn)) {
|
||||
this->playback.ToggleRepeatMode();
|
||||
return true;
|
||||
|
@ -100,6 +100,8 @@ static std::unordered_map<std::string, Id> NAME_TO_ID = {
|
||||
{ "playback_volume_up", Id::VolumeUp },
|
||||
{ "playback_volume_down", Id::VolumeDown },
|
||||
{ "playback_seek_forward", Id::SeekForward },
|
||||
{ "playback_seek_forward_proportional", Id::SeekForwardProportional },
|
||||
{ "playback_seek_back_proportional", Id::SeekBackProportional },
|
||||
{ "playback_seek_back", Id::SeekBack },
|
||||
{ "playback_toggle_repeat", Id::ToggleRepeat },
|
||||
{ "playback_toggle_shuffle", Id::ToggleShuffle },
|
||||
@ -176,6 +178,8 @@ static std::unordered_map<Id, std::string, EnumHasher> ID_TO_DEFAULT = {
|
||||
{ Id::VolumeDown, "k" },
|
||||
{ Id::SeekForward, "o" },
|
||||
{ Id::SeekBack, "u" },
|
||||
{ Id::SeekForwardProportional, "p" },
|
||||
{ Id::SeekBackProportional, "y" },
|
||||
{ Id::ToggleRepeat, "." },
|
||||
{ Id::ToggleShuffle, "," },
|
||||
{ Id::Stop, "^X" },
|
||||
|
@ -82,6 +82,8 @@ namespace musik {
|
||||
VolumeUp,
|
||||
VolumeDown,
|
||||
SeekForward,
|
||||
SeekForwardProportional,
|
||||
SeekBackProportional,
|
||||
SeekBack,
|
||||
ToggleRepeat,
|
||||
ToggleShuffle,
|
||||
|
Loading…
x
Reference in New Issue
Block a user