From 161f07f6beac4013ac32a3a3f61917044f5770c7 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 10 Apr 2007 02:55:23 +0000 Subject: [PATCH] Made the relevant audio options reload audio. Originally committed to SVN as r1055. --- aegisub/audio_display.cpp | 9 ++++++++- aegisub/audio_display.h | 25 ++++++++++++++----------- aegisub/dialog_options.cpp | 14 ++++++++++---- aegisub/options.cpp | 7 +++---- aegisub/options.h | 3 ++- aegisub/video_context.cpp | 1 + 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/aegisub/audio_display.cpp b/aegisub/audio_display.cpp index a29bae8cc..000e8e889 100644 --- a/aegisub/audio_display.cpp +++ b/aegisub/audio_display.cpp @@ -769,7 +769,7 @@ void AudioDisplay::SetScale(float _scale) { ////////////////// // Load from file -void AudioDisplay::SetFile(wxString file, VideoProvider *vprovider) { +void AudioDisplay::SetFile(wxString file, VideoProvider *vproviderLOL) { // Unload if (file.IsEmpty()) { if (player) player->CloseStream(); @@ -830,6 +830,13 @@ void AudioDisplay::SetFromVideo() { } +//////////////// +// Reload audio +void AudioDisplay::Reload() { + if (provider) SetFile(provider->GetFilename()); +} + + //////////////////// // Update scrollbar void AudioDisplay::UpdateScrollbar() { diff --git a/aegisub/audio_display.h b/aegisub/audio_display.h index 17e9aee56..30a66831b 100644 --- a/aegisub/audio_display.h +++ b/aegisub/audio_display.h @@ -144,17 +144,28 @@ public: AudioDisplay(wxWindow *parent); ~AudioDisplay(); - void AddLead(bool in,bool out); void UpdateImage(bool weak=false); void Update(); void RecreateImage(); void SetPosition(int pos); void SetSamplesPercent(int percent,bool update=true,float pivot=0.5); void SetScale(float scale); - void SetFile(wxString file,VideoProvider *vprovider=NULL); - void SetFromVideo(); void UpdateScrollbar(); void SetDialogue(SubtitlesGrid *_grid=NULL,AssDialogue *diag=NULL,int n=-1); + void MakeDialogueVisible(bool force=false); + void ChangeLine(int delta); + void Next(); + void Prev(); + + void CommitChanges(bool nextLine=false); + void AddLead(bool in,bool out); + + void SetFile(wxString file,VideoProvider *vprovider=NULL); + void SetFromVideo(); + void Reload(); + + void Play(int start,int end); + void Stop(); __int64 GetSampleAtX(int x); int GetXAtSample(__int64 n); @@ -164,14 +175,6 @@ public: __int64 GetSampleAtMS(__int64 ms); int GetSyllableAtX(int x); - void MakeDialogueVisible(bool force=false); - void CommitChanges(bool nextLine=false); - void ChangeLine(int delta); - void Next(); - void Prev(); - - void Play(int start,int end); - void Stop(); void GetTimesDialogue(int &start,int &end); void GetTimesSelection(int &start,int &end); void SetSelection(int start, int end); diff --git a/aegisub/dialog_options.cpp b/aegisub/dialog_options.cpp index 69c5791ad..ebfc5f1bb 100644 --- a/aegisub/dialog_options.cpp +++ b/aegisub/dialog_options.cpp @@ -701,9 +701,10 @@ void DialogOptions::WriteToOptions(bool justApply) { bool mustRestart = false; bool editBox = false; bool grid = false; - bool videoRestart = false; bool video = false; bool audio = false; + bool videoReload = false; + bool audioReload = false; // For each bound item for (unsigned int i=0;iReload(); } else if (video) { @@ -820,7 +822,11 @@ void DialogOptions::WriteToOptions(bool justApply) { } // Audio - if (audio) { + if (audioReload) { + FrameMain *frame = (FrameMain*) GetParent(); + frame->audioBox->audioDisplay->Reload(); + } + else if (audio) { FrameMain *frame = (FrameMain*) GetParent(); frame->audioBox->audioDisplay->RecreateImage(); frame->audioBox->audioDisplay->Refresh(); diff --git a/aegisub/options.cpp b/aegisub/options.cpp index ba20cf0dc..9abc1d935 100644 --- a/aegisub/options.cpp +++ b/aegisub/options.cpp @@ -149,10 +149,9 @@ void OptionsManager::LoadDefaults() { SetBool(_T("Video Dummy Pattern"), false); // Video Provider (Advanced) - SetModificationType(MOD_RESTART); - SetBool(_T("Threaded Video"),false); - SetInt(_T("Avisynth MemoryMax"),64); SetModificationType(MOD_VIDEO_RELOAD); + SetInt(_T("Avisynth MemoryMax"),64); + SetBool(_T("Threaded Video"),false); SetText(_T("Video Provider"),_T("Avisynth")); SetBool(_T("Allow Ancient Avisynth"),false); SetText(_T("Avisynth subs renderer"),_T("vsfilter")); @@ -180,7 +179,7 @@ void OptionsManager::LoadDefaults() { SetInt(_T("Audio Inactive Lines Display Mode"),1); // Audio Advanced - SetModificationType(MOD_AUTOMATIC); + SetModificationType(MOD_AUDIO_RELOAD); SetInt(_T("Audio Cache"),1); SetText(_T("Audio Provider"),_T("avisynth")); SetText(_T("Audio Downmixer"),_T("ConvertToMono")); diff --git a/aegisub/options.h b/aegisub/options.h index dfd421869..975559ce1 100644 --- a/aegisub/options.h +++ b/aegisub/options.h @@ -54,7 +54,8 @@ enum ModType { MOD_GRID, MOD_VIDEO, MOD_VIDEO_RELOAD, - MOD_AUDIO + MOD_AUDIO, + MOD_AUDIO_RELOAD }; diff --git a/aegisub/video_context.cpp b/aegisub/video_context.cpp index 832e04911..f1251b388 100644 --- a/aegisub/video_context.cpp +++ b/aegisub/video_context.cpp @@ -228,6 +228,7 @@ void VideoContext::UnloadTexture() { void VideoContext::SetVideo(const wxString &filename) { // Unload video Reset(); + threaded = Options.AsBool(_T("Threaded Video")); // Load video if (!filename.IsEmpty()) {