Made the relevant audio options reload audio.

Originally committed to SVN as r1055.
This commit is contained in:
Rodrigo Braz Monteiro 2007-04-10 02:55:23 +00:00
parent 6f6f53f1b2
commit 161f07f6be
6 changed files with 38 additions and 21 deletions

View File

@ -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() {

View File

@ -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);

View File

@ -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;i<binds.size();i++) {
@ -775,8 +776,9 @@ void DialogOptions::WriteToOptions(bool justApply) {
if (type == MOD_EDIT_BOX) editBox = true;
if (type == MOD_GRID) grid = true;
if (type == MOD_VIDEO) video = true;
if (type == MOD_VIDEO_RELOAD) videoRestart = true;
if (type == MOD_VIDEO_RELOAD) videoReload = true;
if (type == MOD_AUDIO) audio = true;
if (type == MOD_AUDIO_RELOAD) audioReload = true;
}
}
@ -811,7 +813,7 @@ void DialogOptions::WriteToOptions(bool justApply) {
}
// Video
if (videoRestart) {
if (videoReload) {
VideoContext::Get()->Reload();
}
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();

View File

@ -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"));

View File

@ -54,7 +54,8 @@ enum ModType {
MOD_GRID,
MOD_VIDEO,
MOD_VIDEO_RELOAD,
MOD_AUDIO
MOD_AUDIO,
MOD_AUDIO_RELOAD
};

View File

@ -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()) {