mirror of https://github.com/odrling/Aegisub
Move the logic to play the audio on stepping through video into video_context so that the VideoSlider's Next/PrevFrame can behave consistently regardless of where they're called from.
Originally committed to SVN as r4121.
This commit is contained in:
parent
3082838aa1
commit
3a58a48e1a
|
@ -468,6 +468,34 @@ void VideoContext::GetScriptSize(int &sw,int &sh) {
|
|||
grid->ass->GetResolution(sw,sh);
|
||||
}
|
||||
|
||||
/// @brief Play the next frame, possibly with audio
|
||||
/// @return
|
||||
///
|
||||
void VideoContext::PlayNextFrame() {
|
||||
if (isPlaying)
|
||||
return;
|
||||
|
||||
int thisFrame = frame_n;
|
||||
JumpToFrame(frame_n + 1);
|
||||
// Start playing audio
|
||||
if (Options.AsBool(_T("Audio Plays When Stepping Video")))
|
||||
audio->Play(VFR_Output.GetTimeAtFrame(thisFrame),VFR_Output.GetTimeAtFrame(thisFrame + 1));
|
||||
}
|
||||
|
||||
/// @brief Play the previous frame, possibly with audio
|
||||
/// @return
|
||||
///
|
||||
void VideoContext::PlayPrevFrame() {
|
||||
if (isPlaying)
|
||||
return;
|
||||
|
||||
int thisFrame = frame_n;
|
||||
JumpToFrame(frame_n -1);
|
||||
// Start playing audio
|
||||
if (Options.AsBool(_T("Audio Plays When Stepping Video")))
|
||||
audio->Play(VFR_Output.GetTimeAtFrame(thisFrame - 1),VFR_Output.GetTimeAtFrame(thisFrame));
|
||||
}
|
||||
|
||||
/// @brief Play
|
||||
/// @return
|
||||
///
|
||||
|
@ -494,6 +522,9 @@ void VideoContext::Play() {
|
|||
playback.Start(10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @brief Play line
|
||||
/// @return
|
||||
///
|
||||
|
|
|
@ -271,6 +271,8 @@ public:
|
|||
wxString GetTempWorkFile ();
|
||||
|
||||
void Play();
|
||||
void PlayNextFrame();
|
||||
void PlayPrevFrame();
|
||||
void PlayLine();
|
||||
void Stop();
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ void VideoSlider::NextFrame() {
|
|||
if (VideoContext::Get()->IsPlaying()) return;
|
||||
|
||||
//don't request out of range frames
|
||||
if (GetValue() < max) VideoContext::Get()->JumpToFrame(GetValue()+1);
|
||||
if (GetValue() < max) VideoContext::Get()->PlayNextFrame();
|
||||
Refresh(false);
|
||||
Update();
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void VideoSlider::PrevFrame() {
|
|||
if (VideoContext::Get()->IsPlaying()) return;
|
||||
|
||||
//don't request out of range frames
|
||||
if (GetValue() > min) VideoContext::Get()->JumpToFrame(GetValue()-1);
|
||||
if (GetValue() > min) VideoContext::Get()->PlayPrevFrame();
|
||||
Refresh(false);
|
||||
Update();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue