mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Controls for playback state
This commit is contained in:
parent
356af928ac
commit
e006a23b70
@ -470,6 +470,25 @@ class Synthesizer {
|
|||||||
synth.Options().AudioPitch(val);
|
synth.Options().AudioPitch(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pause() const {
|
||||||
|
player.Pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
void play() const {
|
||||||
|
player.Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool toggle() const {
|
||||||
|
switch (player.PlaybackSession().PlaybackState()) {
|
||||||
|
case MediaPlaybackState::Playing: pause(); return true;
|
||||||
|
case MediaPlaybackState::Paused: play(); return true;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MediaPlaybackState playback_state() const {
|
||||||
|
return player.PlaybackSession().PlaybackState();
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -795,6 +814,18 @@ handle_stdin_message(winrt::hstring const &&msg) {
|
|||||||
} catch(...) { }
|
} catch(...) { }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else if (command == L"play") {
|
||||||
|
sx.play();
|
||||||
|
output(cmd_id, "play", {{"playback_state", sx.playback_state()}});
|
||||||
|
}
|
||||||
|
else if (command == L"pause") {
|
||||||
|
sx.play();
|
||||||
|
output(cmd_id, "pause", {{"playback_state", sx.playback_state()}});
|
||||||
|
}
|
||||||
|
else if (command == L"state") {
|
||||||
|
sx.play();
|
||||||
|
output(cmd_id, "state", {{"playback_state", sx.playback_state()}});
|
||||||
|
}
|
||||||
else if (command == L"echo") {
|
else if (command == L"echo") {
|
||||||
output(cmd_id, "echo", {{"msg", join(parts)}});
|
output(cmd_id, "echo", {{"msg", join(parts)}});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user