Make the "Play last 500ms of selection" command always play to the end of the selection as it did in 2.1
Originally committed to SVN as r6171.
This commit is contained in:
parent
935e5544d5
commit
eda90a15fb
3 changed files with 19 additions and 3 deletions
|
@ -429,6 +429,16 @@ void AudioController::PlayPrimaryRange()
|
||||||
playback_mode = PM_PrimaryRange;
|
playback_mode = PM_PrimaryRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudioController::PlayToEndOfPrimary(int64_t start_sample)
|
||||||
|
{
|
||||||
|
if (!IsAudioOpen()) return;
|
||||||
|
|
||||||
|
player->Play(start_sample, GetPrimaryPlaybackRange().end() - start_sample);
|
||||||
|
playback_mode = PM_PrimaryRange;
|
||||||
|
playback_timer.Start(20);
|
||||||
|
|
||||||
|
AnnouncePlaybackPosition(start_sample);
|
||||||
|
}
|
||||||
|
|
||||||
void AudioController::PlayToEnd(int64_t start_sample)
|
void AudioController::PlayToEnd(int64_t start_sample)
|
||||||
{
|
{
|
||||||
|
|
|
@ -306,6 +306,13 @@ public:
|
||||||
/// The playback end can not be changed in any other way.
|
/// The playback end can not be changed in any other way.
|
||||||
void PlayPrimaryRange();
|
void PlayPrimaryRange();
|
||||||
|
|
||||||
|
/// @brief Start or restart audio playback, playing from a point to the end of of the primary playback range
|
||||||
|
/// @param start_sample Index of the sample to start playback at
|
||||||
|
///
|
||||||
|
/// This behaves like PlayPrimaryRange, but the start point can differ from
|
||||||
|
/// the beginning of the primary range.
|
||||||
|
void PlayToEndOfPrimary(int64_t start_sample);
|
||||||
|
|
||||||
/// @brief Start or restart audio playback, playing from a point to the end of stream
|
/// @brief Start or restart audio playback, playing from a point to the end of stream
|
||||||
/// @param start_sample Index of the sample to start playback at
|
/// @param start_sample Index of the sample to start playback at
|
||||||
///
|
///
|
||||||
|
|
|
@ -290,11 +290,10 @@ struct audio_play_end : public validate_audio_open {
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
c->videoController->Stop();
|
c->videoController->Stop();
|
||||||
SampleRange times(c->audioController->GetPrimaryPlaybackRange());
|
SampleRange times(c->audioController->GetPrimaryPlaybackRange());
|
||||||
c->audioController->PlayRange(SampleRange(
|
c->audioController->PlayToEndOfPrimary(
|
||||||
times.end() - std::min(
|
times.end() - std::min(
|
||||||
c->audioController->SamplesFromMilliseconds(500),
|
c->audioController->SamplesFromMilliseconds(500),
|
||||||
times.length()),
|
times.length()));
|
||||||
times.end()));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue