From 9ccd06b6102a5209c32f0b167657fb5ef33388c3 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sat, 1 Oct 2011 18:35:37 +0000 Subject: [PATCH] Uninvert playing the first/last 500ms of the selection Originally committed to SVN as r5709. --- aegisub/src/command/audio.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/aegisub/src/command/audio.cpp b/aegisub/src/command/audio.cpp index 6e0fd5bd7..6f4827b0c 100644 --- a/aegisub/src/command/audio.cpp +++ b/aegisub/src/command/audio.cpp @@ -274,7 +274,7 @@ struct audio_play_after : public validate_audio_open { } }; -/// Play from the beginning of the audio range to the end of the file +/// Play the last 500 ms of the audio range struct audio_play_end : public validate_audio_open { CMD_NAME("audio/play/selection/end") STR_MENU("Play last 500 ms of selection") @@ -284,10 +284,10 @@ struct audio_play_end : public validate_audio_open { void operator()(agi::Context *c) { SampleRange times(c->audioController->GetPrimaryPlaybackRange()); c->audioController->PlayRange(SampleRange( - times.begin(), - times.begin() + std::min( + times.end() - std::min( c->audioController->SamplesFromMilliseconds(500), - times.length()))); + times.length()), + times.end())); } }; @@ -301,14 +301,14 @@ struct audio_play_begin : public validate_audio_open { void operator()(agi::Context *c) { SampleRange times(c->audioController->GetPrimaryPlaybackRange()); c->audioController->PlayRange(SampleRange( - times.end() - std::min( + times.begin(), + times.begin() + std::min( c->audioController->SamplesFromMilliseconds(500), - times.length()), - times.end())); + times.length()))); } }; -/// Play the last 500 ms of the audio range +/// Play from the beginning of the audio range to the end of the file struct audio_play_to_end : public validate_audio_open { CMD_NAME("audio/play/to_end") STR_MENU("Play from selection start to end of file")