mirror of https://github.com/odrling/Aegisub
Styles can be renamed when copied
Always call Stop in AudioDisplay on Play Originally committed to SVN as r949.
This commit is contained in:
parent
d566e629f9
commit
26cba4b46f
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;i<n;i++) {
|
||||
AssDialogue *curDiag = grid->GetDialogue(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;i<n;i++) {
|
||||
AssDialogue *curDiag = grid->GetDialogue(i);
|
||||
if (curDiag->Style == work->name) curDiag->Style = newStyleName;
|
||||
curDiag->ParseASSTags();
|
||||
curDiag->ProcessParameters(ReplaceStyle,&strings);
|
||||
curDiag->UpdateText();
|
||||
curDiag->UpdateData();
|
||||
curDiag->ClearBlocks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue