diff --git a/aegisub/audio_box.cpp b/aegisub/audio_box.cpp index dd7b96fe2..b5f29273a 100644 --- a/aegisub/audio_box.cpp +++ b/aegisub/audio_box.cpp @@ -389,7 +389,6 @@ void AudioBox::OnPlaySelection(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); audioDisplay->GetTimesSelection(start,end); - audioDisplay->Stop(); audioDisplay->Play(start,end); } @@ -401,7 +400,6 @@ void AudioBox::OnPlayDialogue(wxCommandEvent &event) { audioDisplay->SetFocus(); audioDisplay->GetTimesDialogue(start,end); audioDisplay->SetSelection(start, end); - audioDisplay->Stop(); audioDisplay->Play(start,end); } @@ -438,7 +436,6 @@ void AudioBox::OnPlay500Before(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); audioDisplay->GetTimesSelection(start,end); - audioDisplay->Stop(); audioDisplay->Play(start-500,start); } @@ -449,7 +446,6 @@ void AudioBox::OnPlay500After(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); audioDisplay->GetTimesSelection(start,end); - audioDisplay->Stop(); audioDisplay->Play(end,end+500); } @@ -462,7 +458,6 @@ void AudioBox::OnPlay500First(wxCommandEvent &event) { audioDisplay->GetTimesSelection(start,end); int endp = start+500; if (endp > end) endp = end; - audioDisplay->Stop(); audioDisplay->Play(start,endp); } @@ -475,7 +470,6 @@ void AudioBox::OnPlay500Last(wxCommandEvent &event) { audioDisplay->GetTimesSelection(start,end); int startp = end-500; if (startp < start) startp = start; - audioDisplay->Stop(); audioDisplay->Play(startp,end); } @@ -486,7 +480,6 @@ void AudioBox::OnPlayToEnd(wxCommandEvent &event) { int start=0,end=0; audioDisplay->SetFocus(); audioDisplay->GetTimesSelection(start,end); - audioDisplay->Stop(); audioDisplay->Play(start,-1); } diff --git a/aegisub/audio_display.cpp b/aegisub/audio_display.cpp index e4b7844ed..bc3723568 100644 --- a/aegisub/audio_display.cpp +++ b/aegisub/audio_display.cpp @@ -855,6 +855,8 @@ __int64 AudioDisplay::GetSampleAtMS(__int64 ms) { //////// // Play void AudioDisplay::Play(int start,int end) { + Stop(); + // Check provider if (!provider) { // Load temporary provider from video @@ -898,10 +900,8 @@ void AudioDisplay::Play(int start,int end) { //////// // Stop void AudioDisplay::Stop() { - if (!player) return; - - player->Stop(); if (VideoContext::Get()->IsPlaying()) VideoContext::Get()->Stop(); + if (player) player->Stop(); } diff --git a/aegisub/dialog_style_editor.cpp b/aegisub/dialog_style_editor.cpp index dc4ed1f28..aaf0740a2 100644 --- a/aegisub/dialog_style_editor.cpp +++ b/aegisub/dialog_style_editor.cpp @@ -367,28 +367,30 @@ void DialogStyleEditor::Apply (bool apply,bool close) { } // Style name change - if (work->name != newStyleName && !work->name.StartsWith(_("Copy of "))) { - // See if user wants to update style name through script - int answer = wxNO; - if (work->name != _T("Default")) answer = wxMessageBox(_T("Do you want to change all instances of this style in the script to this new name?"),_T("Update script?"),wxYES_NO | wxCANCEL); + if (work->name != newStyleName) { + if (!work->name.StartsWith(_("Copy of "))) { + // See if user wants to update style name through script + int answer = wxNO; + if (work->name != _T("Default")) answer = wxMessageBox(_T("Do you want to change all instances of this style in the script to this new name?"),_T("Update script?"),wxYES_NO | wxCANCEL); - // Cancel - if (answer == wxCANCEL) return; + // Cancel + if (answer == wxCANCEL) return; - // Update - if (answer == wxYES) { - int n = grid->GetRows(); - wxArrayString strings; - strings.Add(work->name); - strings.Add(newStyleName); - for (int i=0;iGetDialogue(i); - if (curDiag->Style == work->name) curDiag->Style = newStyleName; - curDiag->ParseASSTags(); - curDiag->ProcessParameters(ReplaceStyle,&strings); - curDiag->UpdateText(); - curDiag->UpdateData(); - curDiag->ClearBlocks(); + // Update + if (answer == wxYES) { + int n = grid->GetRows(); + wxArrayString strings; + strings.Add(work->name); + strings.Add(newStyleName); + for (int i=0;iGetDialogue(i); + if (curDiag->Style == work->name) curDiag->Style = newStyleName; + curDiag->ParseASSTags(); + curDiag->ProcessParameters(ReplaceStyle,&strings); + curDiag->UpdateText(); + curDiag->UpdateData(); + curDiag->ClearBlocks(); + } } } diff --git a/aegisub/video_context.cpp b/aegisub/video_context.cpp index 8bce8de3d..a014cef0d 100644 --- a/aegisub/video_context.cpp +++ b/aegisub/video_context.cpp @@ -562,13 +562,15 @@ void VideoContext::Play() { } // Set variables - isPlaying = true; startFrame = frame_n; endFrame = -1; // Start playing audio audio->Play(VFR_Output.GetTimeAtFrame(startFrame),-1); + //audio->Play will override this if we put it before, so put it after. + isPlaying = true; + // Start timer startTime = clock(); playTime = startTime;