1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-23 15:41:09 +02:00

Apparently, wxConfigBase::Write() does not update values for next access on all platforms unless Flush() method is called. Added many calls to wxConfigBase::Flush() to make sure the Rad() calls get the right values.

This commit is contained in:
v.audacity 2012-08-02 06:03:19 +00:00
parent e92d30b6e8
commit ebb4f530bb
57 changed files with 139 additions and 46 deletions

View File

@ -390,6 +390,7 @@ void SaveWindowSize()
gPrefs->Write(wxT("/Window/Iconized"), FALSE); gPrefs->Write(wxT("/Window/Iconized"), FALSE);
} }
} }
gPrefs->Flush();
wxGetApp().SetWindowRectAlreadySaved(TRUE); wxGetApp().SetWindowRectAlreadySaved(TRUE);
} }
@ -754,7 +755,9 @@ bool AudacityApp::MRUOpen(wxString fullPathStr) {
// verify that the file exists // verify that the file exists
if (wxFile::Exists(fullPathStr)) if (wxFile::Exists(fullPathStr))
{ {
gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fullPathStr)); if (!gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fullPathStr)) ||
!gPrefs->Flush())
return false;
// Make sure it isn't already open. // Make sure it isn't already open.
// Test here even though AudacityProject::OpenFile() also now checks, because // Test here even though AudacityProject::OpenFile() also now checks, because
@ -1486,8 +1489,7 @@ bool AudacityApp::InitCleanSpeech()
chmod(OSFILENAME(presets), 0755); chmod(OSFILENAME(presets), 0755);
#endif #endif
gPrefs->Write(wxT("/Directories/PresetsDir"), presets); return (gPrefs->Write(wxT("/Directories/PresetsDir"), presets) && gPrefs->Flush());
return true;
} }
#endif // CLEANSPEECH #endif // CLEANSPEECH
@ -1558,14 +1560,14 @@ bool AudacityApp::InitTempDir()
chmod(OSFILENAME(temp), 0755); chmod(OSFILENAME(temp), 0755);
#endif #endif
gPrefs->Write(wxT("/Directories/TempDir"), temp); bool bSuccess = gPrefs->Write(wxT("/Directories/TempDir"), temp) && gPrefs->Flush();
DirManager::SetTempDir(temp); DirManager::SetTempDir(temp);
// Make sure the temp dir isn't locked by another process. // Make sure the temp dir isn't locked by another process.
if (!CreateSingleInstanceChecker(temp)) if (!CreateSingleInstanceChecker(temp))
return false; return false;
return true; return bSuccess;
} }
// Return true if there are no other instances of Audacity running, // Return true if there are no other instances of Audacity running,
@ -1826,6 +1828,7 @@ int AudacityApp::OnExit()
{ {
gPrefs->DeleteEntry(wxT("/QDeleteCmdCfgLocation")); gPrefs->DeleteEntry(wxT("/QDeleteCmdCfgLocation"));
gPrefs->Write(wxT("/DeleteCmdCfgLocation"), true); gPrefs->Write(wxT("/DeleteCmdCfgLocation"), true);
gPrefs->Flush();
} }
} }
@ -1980,6 +1983,7 @@ void AudacityApp::AssociateFileTypes()
wxYES_NO | wxICON_QUESTION); wxYES_NO | wxICON_QUESTION);
if (wantAssoc == wxYES) { if (wantAssoc == wxYES) {
gPrefs->Write(wxT("/WantAssociateFiles"), true); gPrefs->Write(wxT("/WantAssociateFiles"), true);
gPrefs->Flush();
wxString root_key; wxString root_key;
@ -2053,6 +2057,7 @@ void AudacityApp::AssociateFileTypes()
} else { } else {
// User said no. Set a pref so we don't keep asking. // User said no. Set a pref so we don't keep asking.
gPrefs->Write(wxT("/WantAssociateFiles"), false); gPrefs->Write(wxT("/WantAssociateFiles"), false);
gPrefs->Flush();
} }
} }
} }

View File

@ -470,6 +470,8 @@ void InitAudioIO()
gPrefs->Write(wxT("/AudioIO/Host"), HostName(info)); gPrefs->Write(wxT("/AudioIO/Host"), HostName(info));
} }
} }
gPrefs->Flush();
} }
void DeinitAudioIO() void DeinitAudioIO()
@ -1146,6 +1148,7 @@ int AudioIO::StartStream(WaveTrackArray playbackTracks,
{ {
silenceLevelDB = -dBRange + 3; // meter range was made smaller than SilenceLevel silenceLevelDB = -dBRange + 3; // meter range was made smaller than SilenceLevel
gPrefs->Write(wxT("/GUI/EnvdBRange"), dBRange); // so set SilenceLevel reasonable gPrefs->Write(wxT("/GUI/EnvdBRange"), dBRange); // so set SilenceLevel reasonable
gPrefs->Flush();
} }
mSilenceLevel = (silenceLevelDB + dBRange)/(double)dBRange; // meter goes -dBRange dB -> 0dB mSilenceLevel = (silenceLevelDB + dBRange)/(double)dBRange; // meter goes -dBRange dB -> 0dB

View File

@ -408,6 +408,7 @@ bool BatchCommands::WriteMp3File( const wxString Name, int bitrate )
// Use Mp3Stereo to control if export is to a stereo or mono file // Use Mp3Stereo to control if export is to a stereo or mono file
rc = mExporter.Process(project, numChannels, wxT("MP3"), Name, false, 0.0, endTime); rc = mExporter.Process(project, numChannels, wxT("MP3"), Name, false, 0.0, endTime);
gPrefs->Write(wxT("/FileFormats/MP3Bitrate"), prevBitRate); gPrefs->Write(wxT("/FileFormats/MP3Bitrate"), prevBitRate);
gPrefs->Flush();
return rc; return rc;
} }

View File

@ -188,6 +188,7 @@ void BatchProcessDialog::OnApplyToProject(wxCommandEvent &event)
wxWindowDisabler wd; wxWindowDisabler wd;
gPrefs->Write(wxT("/Batch/ActiveChain"), name); gPrefs->Write(wxT("/Batch/ActiveChain"), name);
gPrefs->Flush();
mBatchCommands.ReadChain(name); mBatchCommands.ReadChain(name);
if (!mBatchCommands.ApplyChain()) { if (!mBatchCommands.ApplyChain()) {
@ -207,6 +208,7 @@ void BatchProcessDialog::OnApplyToFiles(wxCommandEvent &event)
wxString name = mChains->GetItemText(item); wxString name = mChains->GetItemText(item);
gPrefs->Write(wxT("/Batch/ActiveChain"), name); gPrefs->Write(wxT("/Batch/ActiveChain"), name);
gPrefs->Flush();
AudacityProject *project = GetActiveProject(); AudacityProject *project = GetActiveProject();
if (!project->GetIsEmpty()) { if (!project->GetIsEmpty()) {
@ -901,6 +903,7 @@ void EditChainsDialog::OnDefaults(wxCommandEvent &event)
void EditChainsDialog::OnOK(wxCommandEvent &event) void EditChainsDialog::OnOK(wxCommandEvent &event)
{ {
gPrefs->Write(wxT("/Batch/ActiveChain"), mActiveChain); gPrefs->Write(wxT("/Batch/ActiveChain"), mActiveChain);
gPrefs->Flush();
if (mChanged) { if (mChanged) {
if (!mBatchCommands.WriteChain(mActiveChain)) { if (!mBatchCommands.WriteChain(mActiveChain)) {

View File

@ -324,6 +324,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent &event )
bool editClipCanMove = true; bool editClipCanMove = true;
gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove); gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove);
gPrefs->Write(wxT("/GUI/EditClipCanMove"), false); gPrefs->Write(wxT("/GUI/EditClipCanMove"), false);
gPrefs->Flush();
// Rememebr the old blocksize, so that we can restore it later. // Rememebr the old blocksize, so that we can restore it later.
int oldBlockSize = Sequence::GetMaxDiskBlockSize(); int oldBlockSize = Sequence::GetMaxDiskBlockSize();
@ -538,6 +539,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent &event )
HoldPrint(false); HoldPrint(false);
gPrefs->Write(wxT("/GUI/EditClipCanMove"), editClipCanMove); gPrefs->Write(wxT("/GUI/EditClipCanMove"), editClipCanMove);
gPrefs->Flush();
} }

View File

@ -532,6 +532,7 @@ void DependencyDialog::SaveFutureActionChoice()
} }
gPrefs->Write(wxT("/FileFormats/SaveProjectWithDependencies"), gPrefs->Write(wxT("/FileFormats/SaveProjectWithDependencies"),
savePref); savePref);
gPrefs->Flush();
} }
} }

View File

@ -88,11 +88,13 @@ bool LoadFFmpeg(bool showerror)
{ {
DropFFmpegLibs(); DropFFmpegLibs();
gPrefs->Write(wxT("/FFmpeg/Enabled"), false); gPrefs->Write(wxT("/FFmpeg/Enabled"), false);
gPrefs->Flush();
return false; return false;
} }
else else
{ {
gPrefs->Write(wxT("/FFmpeg/Enabled"), true); gPrefs->Write(wxT("/FFmpeg/Enabled"), true);
gPrefs->Flush();
return true; return true;
} }
} }
@ -745,6 +747,7 @@ bool FFmpegLibs::FindLibs(wxWindow *parent)
wxLogMessage(wxT("User-specified FFmpeg file exists. Success.")); wxLogMessage(wxT("User-specified FFmpeg file exists. Success."));
mLibAVFormatPath = path; mLibAVFormatPath = path;
gPrefs->Write(wxT("/FFmpeg/FFmpegLibPath"), mLibAVFormatPath); gPrefs->Write(wxT("/FFmpeg/FFmpegLibPath"), mLibAVFormatPath);
gPrefs->Flush();
return true; return true;
} }

View File

@ -155,6 +155,7 @@ to download or locate the FFmpeg libraries."
if (mDontShow->GetValue()) if (mDontShow->GetValue())
{ {
gPrefs->Write(wxT("/FFmpeg/NotFoundDontShow"),1); gPrefs->Write(wxT("/FFmpeg/NotFoundDontShow"),1);
gPrefs->Flush();
} }
this->EndModal(0); this->EndModal(0);
} }

View File

@ -908,6 +908,7 @@ void FreqWindow::OnCloseButton(wxCommandEvent & WXUNUSED(event))
gPrefs->Write(wxT("/FreqWindow/AlgChoice"), mAlgChoice->GetSelection()); gPrefs->Write(wxT("/FreqWindow/AlgChoice"), mAlgChoice->GetSelection());
gPrefs->Write(wxT("/FreqWindow/FuncChoice"), mFuncChoice->GetSelection()); gPrefs->Write(wxT("/FreqWindow/FuncChoice"), mFuncChoice->GetSelection());
gPrefs->Write(wxT("/FreqWindow/AxisChoice"), mAxisChoice->GetSelection()); gPrefs->Write(wxT("/FreqWindow/AxisChoice"), mAxisChoice->GetSelection());
gPrefs->Flush();
this->Show(FALSE); this->Show(FALSE);
} }

View File

@ -528,6 +528,7 @@ void LabelDialog::OnImport(wxCommandEvent &event)
if (fileName != wxT("")) { if (fileName != wxT("")) {
path =::wxPathOnly(fileName); path =::wxPathOnly(fileName);
gPrefs->Write(wxT("/DefaultOpenPath"), path); gPrefs->Write(wxT("/DefaultOpenPath"), path);
gPrefs->Flush();
wxTextFile f; wxTextFile f;

View File

@ -2359,6 +2359,7 @@ void AudacityProject::OnToggleSoundActivated()
bool pause; bool pause;
gPrefs->Read(wxT("/AudioIO/SoundActivatedRecord"), &pause, false); gPrefs->Read(wxT("/AudioIO/SoundActivatedRecord"), &pause, false);
gPrefs->Write(wxT("/AudioIO/SoundActivatedRecord"), !pause); gPrefs->Write(wxT("/AudioIO/SoundActivatedRecord"), !pause);
gPrefs->Flush();
ModifyAllProjectToolbarMenus(); ModifyAllProjectToolbarMenus();
} }
@ -2367,6 +2368,7 @@ void AudacityProject::OnTogglePlayRecording()
bool Duplex; bool Duplex;
gPrefs->Read(wxT("/AudioIO/Duplex"), &Duplex, false); gPrefs->Read(wxT("/AudioIO/Duplex"), &Duplex, false);
gPrefs->Write(wxT("/AudioIO/Duplex"), !Duplex); gPrefs->Write(wxT("/AudioIO/Duplex"), !Duplex);
gPrefs->Flush();
ModifyAllProjectToolbarMenus(); ModifyAllProjectToolbarMenus();
} }
@ -2375,6 +2377,7 @@ void AudacityProject::OnToggleSWPlaythrough()
bool SWPlaythrough; bool SWPlaythrough;
gPrefs->Read(wxT("/AudioIO/SWPlaythrough"), &SWPlaythrough, false); gPrefs->Read(wxT("/AudioIO/SWPlaythrough"), &SWPlaythrough, false);
gPrefs->Write(wxT("/AudioIO/SWPlaythrough"), !SWPlaythrough); gPrefs->Write(wxT("/AudioIO/SWPlaythrough"), !SWPlaythrough);
gPrefs->Flush();
ModifyAllProjectToolbarMenus(); ModifyAllProjectToolbarMenus();
} }
@ -2384,6 +2387,7 @@ void AudacityProject::OnToogleAutomatedInputLevelAdjustment()
bool AVEnabled; bool AVEnabled;
gPrefs->Read(wxT("/AudioIO/AutomatedInputLevelAdjustment"), &AVEnabled, false); gPrefs->Read(wxT("/AudioIO/AutomatedInputLevelAdjustment"), &AVEnabled, false);
gPrefs->Write(wxT("/AudioIO/AutomatedInputLevelAdjustment"), !AVEnabled); gPrefs->Write(wxT("/AudioIO/AutomatedInputLevelAdjustment"), !AVEnabled);
gPrefs->Flush();
ModifyAllProjectToolbarMenus(); ModifyAllProjectToolbarMenus();
} }
#endif #endif
@ -4950,6 +4954,7 @@ void AudacityProject::OnShowClipping()
{ {
bool checked = !gPrefs->Read(wxT("/GUI/ShowClipping"), 0L); bool checked = !gPrefs->Read(wxT("/GUI/ShowClipping"), 0L);
gPrefs->Write(wxT("/GUI/ShowClipping"), checked); gPrefs->Write(wxT("/GUI/ShowClipping"), checked);
gPrefs->Flush();
mCommandManager.Check(wxT("ShowClipping"), checked); mCommandManager.Check(wxT("ShowClipping"), checked);
mTrackPanel->UpdatePrefs(); mTrackPanel->UpdatePrefs();
mTrackPanel->Refresh(false); mTrackPanel->Refresh(false);
@ -5084,10 +5089,12 @@ void AudacityProject::OnImport()
wxArrayString selectedFiles = ShowOpenDialog(wxT("")); wxArrayString selectedFiles = ShowOpenDialog(wxT(""));
if (selectedFiles.GetCount() == 0) { if (selectedFiles.GetCount() == 0) {
gPrefs->Write(wxT("/LastOpenType"),wxT("")); gPrefs->Write(wxT("/LastOpenType"),wxT(""));
gPrefs->Flush();
return; return;
} }
gPrefs->Write(wxT("/NewImportingSession"), true); gPrefs->Write(wxT("/NewImportingSession"), true);
//sort selected files by OD status. Load non OD first so user can edit asap. //sort selected files by OD status. Load non OD first so user can edit asap.
//first sort selectedFiles. //first sort selectedFiles.
selectedFiles.Sort(CompareNoCaseFileName); selectedFiles.Sort(CompareNoCaseFileName);
@ -5103,6 +5110,9 @@ void AudacityProject::OnImport()
} }
gPrefs->Write(wxT("/LastOpenType"),wxT("")); gPrefs->Write(wxT("/LastOpenType"),wxT(""));
gPrefs->Flush();
HandleResize(); // Adjust scrollers for new track sizes. HandleResize(); // Adjust scrollers for new track sizes.
ODManager::Resume(); ODManager::Resume();
} }
@ -5123,6 +5133,7 @@ void AudacityProject::OnImportLabels()
if (fileName != wxT("")) { if (fileName != wxT("")) {
path =::wxPathOnly(fileName); path =::wxPathOnly(fileName);
gPrefs->Write(wxT("/DefaultOpenPath"), path); gPrefs->Write(wxT("/DefaultOpenPath"), path);
gPrefs->Flush();
wxTextFile f; wxTextFile f;
@ -5167,6 +5178,7 @@ void AudacityProject::OnImportMIDI()
if (fileName != wxT("")) { if (fileName != wxT("")) {
path =::wxPathOnly(fileName); path =::wxPathOnly(fileName);
gPrefs->Write(wxT("/DefaultOpenPath"), path); gPrefs->Write(wxT("/DefaultOpenPath"), path);
gPrefs->Flush();
NoteTrack *newTrack = new NoteTrack(mDirManager); NoteTrack *newTrack = new NoteTrack(mDirManager);
@ -5204,7 +5216,8 @@ void AudacityProject::OnImportRaw()
path =::wxPathOnly(fileName); path =::wxPathOnly(fileName);
gPrefs->Write(wxT("/DefaultOpenPath"), path); gPrefs->Write(wxT("/DefaultOpenPath"), path);
gPrefs->Flush();
Track **newTracks; Track **newTracks;
int numTracks; int numTracks;
@ -5939,6 +5952,7 @@ void AudacityProject::OnSyncLock()
bool bSyncLockTracks; bool bSyncLockTracks;
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &bSyncLockTracks, false); gPrefs->Read(wxT("/GUI/SyncLockTracks"), &bSyncLockTracks, false);
gPrefs->Write(wxT("/GUI/SyncLockTracks"), !bSyncLockTracks); gPrefs->Write(wxT("/GUI/SyncLockTracks"), !bSyncLockTracks);
gPrefs->Flush();
// Toolbar, project sync-lock handled within // Toolbar, project sync-lock handled within
ModifyAllProjectToolbarMenus(); ModifyAllProjectToolbarMenus();
@ -6046,6 +6060,7 @@ void AudacityProject::OnExportCleanSpeechPresets()
int noiseCheckSum = abs((int)noiseGateSum); int noiseCheckSum = abs((int)noiseGateSum);
preset[13] = noiseCheckSum; preset[13] = noiseCheckSum;
gPrefs->Write(wxT("/Validate/NoiseGateSum"), noiseCheckSum); gPrefs->Write(wxT("/Validate/NoiseGateSum"), noiseCheckSum);
gPrefs->Flush();
int lenPreset = sizeof(preset); int lenPreset = sizeof(preset);
int count = presetsFile.Write(preset, lenPreset); int count = presetsFile.Write(preset, lenPreset);
@ -6123,6 +6138,7 @@ void AudacityProject::OnImportCleanSpeechPresets()
gPrefs->Write(wxT("/Effects/TruncateSilence/LongestAllowedSilentMs"), preset[12]); gPrefs->Write(wxT("/Effects/TruncateSilence/LongestAllowedSilentMs"), preset[12]);
// gPrefs->Write(wxT("/GUI/Save128HqMasterAfter"), preset[14]); // gPrefs->Write(wxT("/GUI/Save128HqMasterAfter"), preset[14]);
// gPrefs->Write(wxT("/GUI/Save128HqMasterBefore"), preset[15]); // gPrefs->Write(wxT("/GUI/Save128HqMasterBefore"), preset[15]);
gPrefs->Flush();
double noiseGateSum = 0.0; double noiseGateSum = 0.0;
int lenNoiseGate = expectedCount / sizeof(float); int lenNoiseGate = expectedCount / sizeof(float);

View File

@ -162,7 +162,6 @@ void InitPreferences()
{ {
gPrefs->DeleteAll(); gPrefs->DeleteAll();
gPrefs->Write(wxT("/NewPrefsInitialized"), true); gPrefs->Write(wxT("/NewPrefsInitialized"), true);
gPrefs->Flush();
} }
bool gone = wxRemoveFile(fn.GetFullPath()); // remove resetPrefs.txt bool gone = wxRemoveFile(fn.GetFullPath()); // remove resetPrefs.txt
if(!gone) if(!gone)
@ -233,7 +232,9 @@ void InitPreferences()
gPrefs->Write(wxT("/Version/Major"), AUDACITY_VERSION); gPrefs->Write(wxT("/Version/Major"), AUDACITY_VERSION);
gPrefs->Write(wxT("/Version/Minor"), AUDACITY_RELEASE); gPrefs->Write(wxT("/Version/Minor"), AUDACITY_RELEASE);
gPrefs->Write(wxT("/Version/Micro"), AUDACITY_REVISION); gPrefs->Write(wxT("/Version/Micro"), AUDACITY_REVISION);
gPrefs->Flush();
} }
void FinishPreferences() void FinishPreferences()

View File

@ -2191,6 +2191,7 @@ wxArrayString AudacityProject::ShowOpenDialog(wxString extraformat, wxString ext
} }
gPrefs->Write(wxT("/DefaultOpenType"), mask.BeforeFirst(wxT('|'))); gPrefs->Write(wxT("/DefaultOpenType"), mask.BeforeFirst(wxT('|')));
gPrefs->Write(wxT("/LastOpenType"), mask.BeforeFirst(wxT('|'))); gPrefs->Write(wxT("/LastOpenType"), mask.BeforeFirst(wxT('|')));
gPrefs->Flush();
if (dialogResult == wxID_OK) { if (dialogResult == wxID_OK) {
// Return the selected files // Return the selected files
@ -2229,10 +2230,10 @@ void AudacityProject::OpenFiles(AudacityProject *proj)
wxArrayString selectedFiles = ShowOpenDialog(_("Audacity projects"), wxT("*.aup")); wxArrayString selectedFiles = ShowOpenDialog(_("Audacity projects"), wxT("*.aup"));
if (selectedFiles.GetCount() == 0) { if (selectedFiles.GetCount() == 0) {
gPrefs->Write(wxT("/LastOpenType"),wxT("")); gPrefs->Write(wxT("/LastOpenType"),wxT(""));
gPrefs->Flush();
return; return;
} }
//sort selected files by OD status. //sort selected files by OD status.
//For the open menu we load OD first so user can edit asap. //For the open menu we load OD first so user can edit asap.
//first sort selectedFiles. //first sort selectedFiles.
@ -2247,6 +2248,7 @@ void AudacityProject::OpenFiles(AudacityProject *proj)
continue; // Skip ones that are already open. continue; // Skip ones that are already open.
gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fileName)); gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fileName));
gPrefs->Flush();
// DMM: If the project is dirty, that means it's been touched at // DMM: If the project is dirty, that means it's been touched at
// all, and it's not safe to open a new project directly in its // all, and it's not safe to open a new project directly in its
@ -2269,7 +2271,8 @@ void AudacityProject::OpenFiles(AudacityProject *proj)
} }
gPrefs->Write(wxT("/LastOpenType"),wxT("")); gPrefs->Write(wxT("/LastOpenType"),wxT(""));
gPrefs->Flush();
ODManager::Resume(); ODManager::Resume();
} }
@ -4587,6 +4590,7 @@ void AudacityProject::SetSnapTo(bool state)
mSnapTo = state; mSnapTo = state;
mCommandManager.Check(wxT("Snap"), mSnapTo); mCommandManager.Check(wxT("Snap"), mSnapTo);
gPrefs->Write(wxT("/SnapTo"), mSnapTo); gPrefs->Write(wxT("/SnapTo"), mSnapTo);
gPrefs->Flush();
if (GetSelectionBar()) { if (GetSelectionBar()) {
GetSelectionBar()->SetSnapTo(state); GetSelectionBar()->SetSnapTo(state);

View File

@ -41,11 +41,13 @@ int Resample::GetBestMethod()
void Resample::SetFastMethod(int index) void Resample::SetFastMethod(int index)
{ {
gPrefs->Write(GetFastMethodKey(), (long)index); gPrefs->Write(GetFastMethodKey(), (long)index);
gPrefs->Flush();
} }
void Resample::SetBestMethod(int index) void Resample::SetBestMethod(int index)
{ {
gPrefs->Write(GetBestMethodKey(), (long)index); gPrefs->Write(GetBestMethodKey(), (long)index);
gPrefs->Flush();
} }
#if USE_LIBRESAMPLE #if USE_LIBRESAMPLE

View File

@ -519,6 +519,7 @@ void ScreenFrame::OnDirChoose(wxCommandEvent & e)
wxString path = tmpDirPath.GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR); wxString path = tmpDirPath.GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR);
mDirectoryTextBox->SetValue(path); mDirectoryTextBox->SetValue(path);
gPrefs->Write(wxT("/ScreenshotPath"), path); gPrefs->Write(wxT("/ScreenshotPath"), path);
gPrefs->Flush();
} }
} }

View File

@ -43,7 +43,7 @@ bool ShuttlePrefs::TransferBool( const wxString & Name, bool & bValue, const boo
} }
else else
{ {
return gPrefs->Write( Name, bValue ); return (gPrefs->Write( Name, bValue ) && gPrefs->Flush());
} }
return true; return true;
} }
@ -57,7 +57,7 @@ bool ShuttlePrefs::TransferDouble( const wxString & Name, double & dValue, const
} }
else else
{ {
return gPrefs->Write( Name, dValue ); return (gPrefs->Write( Name, dValue ) && gPrefs->Flush());
} }
return true; return true;
} }
@ -71,7 +71,7 @@ bool ShuttlePrefs::TransferInt( const wxString & Name, int & iValue, const int &
} }
else else
{ {
return gPrefs->Write( Name, iValue ); return (gPrefs->Write( Name, iValue ) && gPrefs->Flush());
} }
return true; return true;
} }
@ -85,7 +85,7 @@ bool ShuttlePrefs::TransferString( const wxString & Name, wxString & strValue, c
} }
else else
{ {
return gPrefs->Write( Name, strValue ); return (gPrefs->Write( Name, strValue ) && gPrefs->Flush());
} }
return true; return true;
} }

View File

@ -131,6 +131,7 @@ void SplashDialog::OnDontShow( wxCommandEvent & Evt )
{ {
bool bShow = !Evt.IsChecked(); bool bShow = !Evt.IsChecked();
gPrefs->Write(wxT("/GUI/ShowSplashScreen"), bShow ); gPrefs->Write(wxT("/GUI/ShowSplashScreen"), bShow );
gPrefs->Flush();
} }
void SplashDialog::OnOK(wxCommandEvent & WXUNUSED(event)) void SplashDialog::OnOK(wxCommandEvent & WXUNUSED(event))

View File

@ -1203,6 +1203,7 @@ void TagsEditor::OnSaveDefaults(wxCommandEvent & event)
for (bool cont = mLocal.GetFirst(n, v); cont; cont = mLocal.GetNext(n, v)) { for (bool cont = mLocal.GetFirst(n, v); cont; cont = mLocal.GetNext(n, v)) {
gPrefs->Write(wxT("/Tags/") + n, v); gPrefs->Write(wxT("/Tags/") + n, v);
} }
gPrefs->Flush();
// Restore title // Restore title
if (!mEditTitle) { if (!mEditTitle) {
@ -1257,6 +1258,7 @@ void TagsEditor::OnOk(wxCommandEvent & event)
gPrefs->Write(wxT("/TagsEditor/y"), r.y); gPrefs->Write(wxT("/TagsEditor/y"), r.y);
gPrefs->Write(wxT("/TagsEditor/width"), r.width); gPrefs->Write(wxT("/TagsEditor/width"), r.width);
gPrefs->Write(wxT("/TagsEditor/height"), r.height); gPrefs->Write(wxT("/TagsEditor/height"), r.height);
gPrefs->Flush();
EndModal(wxID_OK); EndModal(wxID_OK);
} }

View File

@ -216,6 +216,7 @@ void TimerRecordDialog::OnOK(wxCommandEvent& event)
wxLongLong duration = m_TimeSpan_Duration.GetSeconds(); wxLongLong duration = m_TimeSpan_Duration.GetSeconds();
// this will assert if the duration won't fit in a long // this will assert if the duration won't fit in a long
gPrefs->Write(wxT("/TimerRecord/LastDuration"), duration.ToLong()); gPrefs->Write(wxT("/TimerRecord/LastDuration"), duration.ToLong());
gPrefs->Flush();
} }
///Runs the wait for start dialog. Returns false if the user clicks stop while we are recording ///Runs the wait for start dialog. Returns false if the user clicks stop while we are recording

View File

@ -2843,6 +2843,8 @@ void TrackArtist::UpdatePrefs()
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS #ifdef EXPERIMENTAL_FFT_SKIP_POINTS
mFftSkipPoints = gPrefs->Read(wxT("/Spectrum/FFTSkipPoints"), 0L); mFftSkipPoints = gPrefs->Read(wxT("/Spectrum/FFTSkipPoints"), 0L);
#endif //EXPERIMENTAL_FFT_SKIP_POINTS #endif //EXPERIMENTAL_FFT_SKIP_POINTS
gPrefs->Flush();
} }
// Get various preference values // Get various preference values

View File

@ -7553,6 +7553,7 @@ void TrackPanel::OnSetFont(wxCommandEvent &event)
gPrefs->Write(wxT("/GUI/LabelFontFacename"), lb->GetStringSelection()); gPrefs->Write(wxT("/GUI/LabelFontFacename"), lb->GetStringSelection());
gPrefs->Write(wxT("/GUI/LabelFontSize"), sc->GetValue()); gPrefs->Write(wxT("/GUI/LabelFontSize"), sc->GetValue());
gPrefs->Flush();
LabelTrack::ResetFont(); LabelTrack::ResetFont();

View File

@ -74,7 +74,7 @@ bool SetPreferenceCommand::Apply(CommandExecutionContext context)
{ {
wxString prefName = GetString(wxT("PrefName")); wxString prefName = GetString(wxT("PrefName"));
wxString prefValue = GetString(wxT("PrefValue")); wxString prefValue = GetString(wxT("PrefValue"));
return gPrefs->Write(prefName, prefValue); return (gPrefs->Write(prefName, prefValue) && gPrefs->Flush());
} }
SetPreferenceCommand::~SetPreferenceCommand() SetPreferenceCommand::~SetPreferenceCommand()

View File

@ -207,6 +207,7 @@ bool EffectAutoDuck::PromptUser()
gPrefs->Write(wxT("/Effects/AutoDuck/InnerFadeUpLen"), mInnerFadeUpLen); gPrefs->Write(wxT("/Effects/AutoDuck/InnerFadeUpLen"), mInnerFadeUpLen);
gPrefs->Write(wxT("/Effects/AutoDuck/ThresholdDb"), mThresholdDb); gPrefs->Write(wxT("/Effects/AutoDuck/ThresholdDb"), mThresholdDb);
gPrefs->Write(wxT("/Effects/AutoDuck/MaximumPause"), mMaximumPause); gPrefs->Write(wxT("/Effects/AutoDuck/MaximumPause"), mMaximumPause);
gPrefs->Flush();
return true; return true;
} }

View File

@ -98,7 +98,7 @@ bool EffectClickRemoval::Init()
gPrefs->Write(wxT("/Effects/ClickRemoval/ClickWidth"), mClickWidth); gPrefs->Write(wxT("/Effects/ClickRemoval/ClickWidth"), mClickWidth);
} }
#endif // CLEANSPEECH #endif // CLEANSPEECH
return true; return gPrefs->Flush();
} }
bool EffectClickRemoval::CheckWhetherSkipEffect() bool EffectClickRemoval::CheckWhetherSkipEffect()
@ -131,7 +131,7 @@ bool EffectClickRemoval::PromptUser()
gPrefs->Write(wxT("/Effects/ClickRemoval/ClickWidth"), mClickWidth); gPrefs->Write(wxT("/Effects/ClickRemoval/ClickWidth"), mClickWidth);
#endif // CLEANSPEECH #endif // CLEANSPEECH
return true; return gPrefs->Flush();
} }
bool EffectClickRemoval::TransferParameters( Shuttle & shuttle ) bool EffectClickRemoval::TransferParameters( Shuttle & shuttle )
{ {

View File

@ -143,7 +143,7 @@ bool EffectCompressor::PromptUser()
gPrefs->Write(wxT("/Effects/Compressor/Normalize"), mNormalize); gPrefs->Write(wxT("/Effects/Compressor/Normalize"), mNormalize);
gPrefs->Write(wxT("/Effects/Compressor/UsePeak"), mUsePeak); gPrefs->Write(wxT("/Effects/Compressor/UsePeak"), mUsePeak);
return true; return gPrefs->Flush();
} }
bool EffectCompressor::NewTrackPass1() bool EffectCompressor::NewTrackPass1()

View File

@ -380,6 +380,7 @@ void EffectDtmf::Success()
gPrefs->Write(wxT("/Effects/DtmfGen/String"), dtmfString); gPrefs->Write(wxT("/Effects/DtmfGen/String"), dtmfString);
gPrefs->Write(wxT("/Effects/DtmfGen/DutyCycle"), dtmfDutyCycle); gPrefs->Write(wxT("/Effects/DtmfGen/DutyCycle"), dtmfDutyCycle);
gPrefs->Write(wxT("/Effects/DtmfGen/Amplitude"), dtmfAmplitude); gPrefs->Write(wxT("/Effects/DtmfGen/Amplitude"), dtmfAmplitude);
gPrefs->Flush();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -215,6 +215,8 @@ void EffectEqualization::ReadPrefs()
gPrefs->Read(wxT("/Effects/Equalization/DrawMode"), &mDrawMode, true); gPrefs->Read(wxT("/Effects/Equalization/DrawMode"), &mDrawMode, true);
gPrefs->Read(wxT("/Effects/Equalization/Interp"), &mInterp, 0); gPrefs->Read(wxT("/Effects/Equalization/Interp"), &mInterp, 0);
gPrefs->Read(wxT("/Effects/Equalization/DrawGrid"), &mDrawGrid, true); gPrefs->Read(wxT("/Effects/Equalization/DrawGrid"), &mDrawGrid, true);
gPrefs->Flush();
} }
EffectEqualization::EffectEqualization() EffectEqualization::EffectEqualization()
@ -312,6 +314,7 @@ bool EffectEqualization::PromptUser()
gPrefs->Write(wxT("/Effects/Equalization/DrawMode"),mDrawMode); gPrefs->Write(wxT("/Effects/Equalization/DrawMode"),mDrawMode);
gPrefs->Write(wxT("/Effects/Equalization/Interp"), mInterp); gPrefs->Write(wxT("/Effects/Equalization/Interp"), mInterp);
gPrefs->Write(wxT("/Effects/Equalization/DrawGrid"), mDrawGrid); gPrefs->Write(wxT("/Effects/Equalization/DrawGrid"), mDrawGrid);
gPrefs->Flush();
} }
return true; return true;

View File

@ -70,6 +70,8 @@ bool EffectLeveller::Init()
gPrefs->Write(wxT("/Effects/Leveller/LevellerDbChoiceIndex"), mLevellerDbChoiceIndex); gPrefs->Write(wxT("/Effects/Leveller/LevellerDbChoiceIndex"), mLevellerDbChoiceIndex);
} }
#endif // CLEANSPEECH #endif // CLEANSPEECH
gPrefs->Flush();
mLevellerDbSilenceThreshold = Enums::Db2Signal[mLevellerDbChoiceIndex]; mLevellerDbSilenceThreshold = Enums::Db2Signal[mLevellerDbChoiceIndex];
CalcLevellerFactors(); CalcLevellerFactors();
@ -86,6 +88,7 @@ void EffectLeveller::End()
{ {
int frameSum = (int)mFrameSum; int frameSum = (int)mFrameSum;
gPrefs->Write(wxT("/Validate/LevellerFrameSum"), frameSum); gPrefs->Write(wxT("/Validate/LevellerFrameSum"), frameSum);
gPrefs->Flush();
} }
#define LEVELER_FACTORS 6 #define LEVELER_FACTORS 6
@ -149,6 +152,7 @@ bool EffectLeveller::PromptUser()
gPrefs->Write(wxT("/Effects/Leveller/LevellerDbChoiceIndex"), mLevellerDbChoiceIndex); gPrefs->Write(wxT("/Effects/Leveller/LevellerDbChoiceIndex"), mLevellerDbChoiceIndex);
gPrefs->Write(wxT("/Effects/Leveller/LevellerNumPasses"), mLevellerNumPasses); gPrefs->Write(wxT("/Effects/Leveller/LevellerNumPasses"), mLevellerNumPasses);
#endif // CLEANSPEECH #endif // CLEANSPEECH
gPrefs->Flush();
CalcLevellerFactors(); CalcLevellerFactors();

View File

@ -161,6 +161,7 @@ void EffectNoise::Success()
gPrefs->Write(wxT("/Effects/Noise/Type"), noiseType); gPrefs->Write(wxT("/Effects/Noise/Type"), noiseType);
gPrefs->Write(wxT("/Effects/Noise/Amplitude"), noiseAmplitude); gPrefs->Write(wxT("/Effects/Noise/Amplitude"), noiseAmplitude);
gPrefs->Flush();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -238,7 +238,7 @@ bool EffectNoiseRemoval::Init()
gPrefs->Write(wxT("/Effects/NoiseRemoval/Noise_Level"), mLevel); gPrefs->Write(wxT("/Effects/NoiseRemoval/Noise_Level"), mLevel);
} }
#endif // CLEANSPEECH #endif // CLEANSPEECH
return true; return gPrefs->Flush();
} }
bool EffectNoiseRemoval::CheckWhetherSkipEffect() bool EffectNoiseRemoval::CheckWhetherSkipEffect()
@ -309,7 +309,7 @@ bool EffectNoiseRemoval::PromptUser()
#endif // CLEANSPEECH #endif // CLEANSPEECH
mDoProfile = (dlog.GetReturnCode() == 1); mDoProfile = (dlog.GetReturnCode() == 1);
return true; return gPrefs->Flush();
} }
bool EffectNoiseRemoval::TransferParameters( Shuttle & shuttle ) bool EffectNoiseRemoval::TransferParameters( Shuttle & shuttle )

View File

@ -111,6 +111,7 @@ void EffectNormalize::End()
gPrefs->Write(wxT("/Validate/Norm_Multiplier"), checkMultiplier); gPrefs->Write(wxT("/Validate/Norm_Multiplier"), checkMultiplier);
int checkFrameSum = (int)gFrameSum; int checkFrameSum = (int)gFrameSum;
gPrefs->Write(wxT("/Validate/Norm_FrameSum"), checkFrameSum); gPrefs->Write(wxT("/Validate/Norm_FrameSum"), checkFrameSum);
gPrefs->Flush();
} }
} }
@ -138,7 +139,7 @@ bool EffectNormalize::PromptUser()
gPrefs->Write(wxT("/Effects/Normalize/Level"), mLevel); gPrefs->Write(wxT("/Effects/Normalize/Level"), mLevel);
gPrefs->Write(wxT("/Effects/Normalize/StereoIndependent"), mStereoInd); gPrefs->Write(wxT("/Effects/Normalize/StereoIndependent"), mStereoInd);
return true; return gPrefs->Flush();
} }
bool EffectNormalize::Process() bool EffectNormalize::Process()

View File

@ -205,6 +205,8 @@ ScoreAlignDialog::ScoreAlignDialog(wxWindow *parent, ScoreAlignParams &params)
p.mPresmoothTime); p.mPresmoothTime);
gPrefs->Write(wxT("/Tracks/Synchronize/LineTime"), p.mLineTime); gPrefs->Write(wxT("/Tracks/Synchronize/LineTime"), p.mLineTime);
gPrefs->Write(wxT("/Tracks/Synchronize/SmoothTime"), p.mSmoothTime); gPrefs->Write(wxT("/Tracks/Synchronize/SmoothTime"), p.mSmoothTime);
gPrefs->Flush();
params = p; // return all parameters through params params = p; // return all parameters through params
} }
} }

View File

@ -53,7 +53,10 @@ bool EffectSilence::PromptUser()
Save duration unless value was got from selection, so we save only Save duration unless value was got from selection, so we save only
when user explicitly set up a value */ when user explicitly set up a value */
if (mT1 == mT0) if (mT1 == mT0)
{
gPrefs->Write(wxT("/Effects/SilenceGen/Duration"), mDuration); gPrefs->Write(wxT("/Effects/SilenceGen/Duration"), mDuration);
gPrefs->Flush();
}
return true; return true;
} }

View File

@ -122,8 +122,11 @@ bool EffectToneGen::PromptUser()
/* Save last used values. /* Save last used values.
Save duration unless value was got from selection, so we save only Save duration unless value was got from selection, so we save only
when user explicitly set up a value */ when user explicitly set up a value */
if (mT1 == mT0) if (mT1 == mT0) // ANSWER ME: Only if end time equals start time?
gPrefs->Write(wxT("/Effects/ToneGen/Duration"), mDuration); {
return (gPrefs->Write(wxT("/Effects/ToneGen/Duration"), mDuration) &&
gPrefs->Flush());
}
return true; return true;
} }

View File

@ -78,7 +78,7 @@ bool EffectTruncSilence::Init()
mSilenceCompressRatio = 4.0; mSilenceCompressRatio = 4.0;
gPrefs->Write(wxT("/Effects/TruncateSilence/CompressRatio"), 40L); gPrefs->Write(wxT("/Effects/TruncateSilence/CompressRatio"), 40L);
} }
return true; return gPrefs->Flush();
} }
bool EffectTruncSilence::CheckWhetherSkipEffect() bool EffectTruncSilence::CheckWhetherSkipEffect()
@ -105,6 +105,7 @@ bool EffectTruncSilence::PromptUser()
gPrefs->Write(wxT("/Effects/TruncateSilence/LongestAllowedSilentMs"), mTruncLongestAllowedSilentMs); gPrefs->Write(wxT("/Effects/TruncateSilence/LongestAllowedSilentMs"), mTruncLongestAllowedSilentMs);
gPrefs->Write(wxT("/Effects/TruncateSilence/DbChoiceIndex"), mTruncDbChoiceIndex); gPrefs->Write(wxT("/Effects/TruncateSilence/DbChoiceIndex"), mTruncDbChoiceIndex);
gPrefs->Write(wxT("/Effects/TruncateSilence/CompressRatio"), (int)floor(10.0*mSilenceCompressRatio+0.5)); gPrefs->Write(wxT("/Effects/TruncateSilence/CompressRatio"), (int)floor(10.0*mSilenceCompressRatio+0.5));
gPrefs->Flush();
return true; return true;
} }

View File

@ -76,6 +76,7 @@ void RegisterVSTEffects()
if (gPrefs->Read(wxT("/VST/Rescan"), (long) false) != false) { if (gPrefs->Read(wxT("/VST/Rescan"), (long) false) != false) {
pm.PurgeType(VSTPLUGINTYPE); pm.PurgeType(VSTPLUGINTYPE);
gPrefs->Write(wxT("/VST/Rescan"), false); gPrefs->Write(wxT("/VST/Rescan"), false);
gPrefs->Flush();
} }
if (!pm.HasType(VSTPLUGINTYPE)) { if (!pm.HasType(VSTPLUGINTYPE)) {

View File

@ -701,6 +701,7 @@ bool Exporter::CheckFilename()
gPrefs->Write(wxT("/Export/Format"), mPlugins[mFormat]->GetFormat(mSubFormat)); gPrefs->Write(wxT("/Export/Format"), mPlugins[mFormat]->GetFormat(mSubFormat));
gPrefs->Write(wxT("/Export/Path"), mFilename.GetPath()); gPrefs->Write(wxT("/Export/Path"), mFilename.GetPath());
gPrefs->Flush();
// //
// To be even safer, return a temporary file name based // To be even safer, return a temporary file name based

View File

@ -136,6 +136,7 @@ void ExportCLOptions::OnOK(wxCommandEvent& event)
wxString cmd = mCmd->GetValue(); wxString cmd = mCmd->GetValue();
gPrefs->Write(wxT("/FileFormats/ExternalProgramExportCommand"), cmd); gPrefs->Write(wxT("/FileFormats/ExternalProgramExportCommand"), cmd);
gPrefs->Flush();
PopulateOrExchange(S); PopulateOrExchange(S);

View File

@ -1900,6 +1900,7 @@ void ExportFFmpegOptions::OnOK(wxCommandEvent& event)
int selfmt = mFormatList->GetSelection(); int selfmt = mFormatList->GetSelection();
if (selcdc > -1) gPrefs->Write(wxT("/FileFormats/FFmpegCodec"),(long)avcodec_find_encoder_by_name(mCodecList->GetString(selcdc).ToUTF8())->id); if (selcdc > -1) gPrefs->Write(wxT("/FileFormats/FFmpegCodec"),(long)avcodec_find_encoder_by_name(mCodecList->GetString(selcdc).ToUTF8())->id);
if (selfmt > -1) gPrefs->Write(wxT("/FileFormats/FFmpegFormat"),mFormatList->GetString(selfmt)); if (selfmt > -1) gPrefs->Write(wxT("/FileFormats/FFmpegFormat"),mFormatList->GetString(selfmt));
gPrefs->Flush();
ShuttleGui S(this, eIsSavingToPrefs); ShuttleGui S(this, eIsSavingToPrefs);
PopulateOrExchange(S); PopulateOrExchange(S);

View File

@ -444,6 +444,7 @@ void ExportMP3Options::OnOK(wxCommandEvent& event)
gPrefs->Write(wxT("/FileFormats/MP3VbrRate"), mVbrRate); gPrefs->Write(wxT("/FileFormats/MP3VbrRate"), mVbrRate);
gPrefs->Write(wxT("/FileFormats/MP3AbrRate"), mAbrRate); gPrefs->Write(wxT("/FileFormats/MP3AbrRate"), mAbrRate);
gPrefs->Write(wxT("/FileFormats/MP3CbrRate"), mCbrRate); gPrefs->Write(wxT("/FileFormats/MP3CbrRate"), mCbrRate);
gPrefs->Flush();
EndModal(wxID_OK); EndModal(wxID_OK);
@ -959,9 +960,8 @@ bool MP3Exporter::FindLibrary(wxWindow *parent)
} }
mLibPath = path; mLibPath = path;
gPrefs->Write(wxT("/MP3/MP3LibPath"), mLibPath);
return true; return (gPrefs->Write(wxT("/MP3/MP3LibPath"), mLibPath) && gPrefs->Flush());
} }
bool MP3Exporter::LoadLibrary(wxWindow *parent, AskUser askuser) bool MP3Exporter::LoadLibrary(wxWindow *parent, AskUser askuser)
@ -1626,6 +1626,7 @@ int ExportMP3::Export(AudacityProject *project,
if (!exporter.InitLibrary(wxT(""))) { if (!exporter.InitLibrary(wxT(""))) {
wxMessageBox(_("Could not initialize MP3 encoding library!")); wxMessageBox(_("Could not initialize MP3 encoding library!"));
gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT(""))); gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT("")));
gPrefs->Flush();
return false; return false;
} }
@ -1633,6 +1634,7 @@ int ExportMP3::Export(AudacityProject *project,
if (!exporter.LoadLibrary(parent, MP3Exporter::Maybe)) { if (!exporter.LoadLibrary(parent, MP3Exporter::Maybe)) {
wxMessageBox(_("Could not open MP3 encoding library!")); wxMessageBox(_("Could not open MP3 encoding library!"));
gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT(""))); gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT("")));
gPrefs->Flush();
return false; return false;
} }
@ -1640,6 +1642,7 @@ int ExportMP3::Export(AudacityProject *project,
if (!exporter.ValidLibraryLoaded()) { if (!exporter.ValidLibraryLoaded()) {
wxMessageBox(_("Not a valid or supported MP3 encoding library!")); wxMessageBox(_("Not a valid or supported MP3 encoding library!"));
gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT(""))); gPrefs->Write(wxT("/MP3/MP3LibPath"), wxString(wxT("")));
gPrefs->Flush();
return false; return false;
} }

View File

@ -107,6 +107,7 @@ void ExportOGGOptions::OnOK(wxCommandEvent& event)
PopulateOrExchange(S); PopulateOrExchange(S);
gPrefs->Write(wxT("/FileFormats/OggExportQuality"),mOggQualityUnscaled * 10); gPrefs->Write(wxT("/FileFormats/OggExportQuality"),mOggQualityUnscaled * 10);
gPrefs->Flush();
EndModal(wxID_OK); EndModal(wxID_OK);

View File

@ -67,6 +67,7 @@ static int ReadExportFormatPref()
static void WriteExportFormatPref(int format) static void WriteExportFormatPref(int format)
{ {
gPrefs->Write(wxT("/FileFormats/ExportFormat_SF1"), (long int)format); gPrefs->Write(wxT("/FileFormats/ExportFormat_SF1"), (long int)format);
gPrefs->Flush();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -280,6 +280,7 @@ void Importer::WriteImportItems()
} }
name.Printf (wxT("/ExtImportItems/Item%d"), i); name.Printf (wxT("/ExtImportItems/Item%d"), i);
gPrefs->Write (name, val); gPrefs->Write (name, val);
gPrefs->Flush();
} }
/* If we used to have more items than we have now, delete the excess items. /* If we used to have more items than we have now, delete the excess items.
We just keep deleting items and incrementing until we find there aren't any We just keep deleting items and incrementing until we find there aren't any

View File

@ -313,6 +313,7 @@ ImportFileHandle *FFmpegImportPlugin::Open(wxString filename)
if (dontShowDlg == 0 && newsession) if (dontShowDlg == 0 && newsession)
{ {
gPrefs->Write(wxT("/NewImportingSession"), false); gPrefs->Write(wxT("/NewImportingSession"), false);
gPrefs->Flush();
dlg = new FFmpegNotFoundDialog(NULL); dlg = new FFmpegNotFoundDialog(NULL);
dlg->ShowModal(); dlg->ShowModal();
delete dlg; delete dlg;

View File

@ -229,6 +229,7 @@ static wxString AskCopyOrEdit()
oldCopyPref = wxT("copy"); oldCopyPref = wxT("copy");
} }
gPrefs->Write(wxT("/Warnings/CopyOrEditUncompressedDataFirstAsk"), (long) false); gPrefs->Write(wxT("/Warnings/CopyOrEditUncompressedDataFirstAsk"), (long) false);
gPrefs->Flush();
} }
// check the current preferences for whether or not we should ask the user about this. // check the current preferences for whether or not we should ask the user about this.
@ -284,6 +285,7 @@ How do you want to import the current file(s)?"), oldCopyPref == wxT("copy") ? _
} }
if (dontAskNextTimeBox->IsChecked()) { if (dontAskNextTimeBox->IsChecked()) {
gPrefs->Write(wxT("/Warnings/CopyOrEditUncompressedDataAsk"), (long) false); gPrefs->Write(wxT("/Warnings/CopyOrEditUncompressedDataAsk"), (long) false);
gPrefs->Flush();
} }
} else { } else {
return wxT("cancel"); return wxT("cancel");
@ -292,6 +294,7 @@ How do you want to import the current file(s)?"), oldCopyPref == wxT("copy") ? _
// if the preference changed, save it. // if the preference changed, save it.
if (newCopyPref != oldCopyPref) { if (newCopyPref != oldCopyPref) {
gPrefs->Write(wxT("/FileFormats/CopyOrEditUncompressedData"), newCopyPref); gPrefs->Write(wxT("/FileFormats/CopyOrEditUncompressedData"), newCopyPref);
gPrefs->Flush();
} }
oldCopyPref = newCopyPref; oldCopyPref = newCopyPref;
} }

View File

@ -347,6 +347,7 @@ bool DevicePrefs::Apply()
} }
if (map) { if (map) {
gPrefs->Write(wxT("/AudioIO/PlaybackDevice"), map->deviceString); gPrefs->Write(wxT("/AudioIO/PlaybackDevice"), map->deviceString);
gPrefs->Flush();
} }
map = NULL; map = NULL;
@ -365,9 +366,9 @@ bool DevicePrefs::Apply()
gPrefs->Write(wxT("/AudioIO/RecordingSource"), gPrefs->Write(wxT("/AudioIO/RecordingSource"),
wxT("")); wxT(""));
} }
gPrefs->Write(wxT("/AudioIO/RecordChannels"), gPrefs->Write(wxT("/AudioIO/RecordChannels"),
mChannels->GetSelection() + 1); mChannels->GetSelection() + 1);
return gPrefs->Flush();
} }
return true; return true;

View File

@ -293,6 +293,7 @@ void KeyConfigPrefs::OnImport(wxCommandEvent & e)
path = wxPathOnly(file); path = wxPathOnly(file);
gPrefs->Write(wxT("/DefaultOpenPath"), path); gPrefs->Write(wxT("/DefaultOpenPath"), path);
gPrefs->Flush();
XMLFileReader reader; XMLFileReader reader;
if (!reader.Parse(mManager, file)) { if (!reader.Parse(mManager, file)) {
@ -324,6 +325,7 @@ void KeyConfigPrefs::OnExport(wxCommandEvent & e)
path = wxPathOnly(file); path = wxPathOnly(file);
gPrefs->Write(wxT("/DefaultExportPath"), path); gPrefs->Write(wxT("/DefaultExportPath"), path);
gPrefs->Flush();
XMLFileWriter prefFile; XMLFileWriter prefFile;
@ -558,9 +560,10 @@ bool KeyConfigPrefs::Apply()
gPrefs->Write(name, key); gPrefs->Write(name, key);
} }
} }
gPrefs->Flush();
} }
return true; return gPrefs->Flush();
} }
void KeyConfigPrefs::Cancel() void KeyConfigPrefs::Cancel()

View File

@ -271,7 +271,7 @@ bool MidiIOPrefs::Apply()
wxString(info->name, wxConvLocal).c_str())); wxString(info->name, wxConvLocal).c_str()));
} }
#endif #endif
return true; return gPrefs->Flush();
} }
bool MidiIOPrefs::Validate() bool MidiIOPrefs::Validate()

View File

@ -245,6 +245,7 @@ void PrefsDialog::OnOK(wxCommandEvent & event)
} }
gPrefs->Write(wxT("/Prefs/PrefsCategory"), (long)mCategories->GetSelection()); gPrefs->Write(wxT("/Prefs/PrefsCategory"), (long)mCategories->GetSelection());
gPrefs->Flush();
#if USE_PORTMIXER #if USE_PORTMIXER
if (gAudioIO) { if (gAudioIO) {

View File

@ -226,6 +226,7 @@ bool QualityPrefs::Apply()
// value in prefs comes from the second field. // value in prefs comes from the second field.
if (mOtherSampleRate->IsEnabled()) { if (mOtherSampleRate->IsEnabled()) {
gPrefs->Write(wxT("/SamplingRate/DefaultProjectSampleRate"), mOtherSampleRateValue); gPrefs->Write(wxT("/SamplingRate/DefaultProjectSampleRate"), mOtherSampleRateValue);
gPrefs->Flush();
} }
// Tell CopySamples() to use these ditherers now // Tell CopySamples() to use these ditherers now

View File

@ -185,8 +185,11 @@ bool RecordingPrefs::Apply()
double targetpeak, deltapeak; double targetpeak, deltapeak;
gPrefs->Read(wxT("/AudioIO/TargetPeak"), &targetpeak); gPrefs->Read(wxT("/AudioIO/TargetPeak"), &targetpeak);
gPrefs->Read(wxT("/AudioIO/DeltaPeakVolume"), &deltapeak); gPrefs->Read(wxT("/AudioIO/DeltaPeakVolume"), &deltapeak);
if (targetpeak + deltapeak > 100.0 || targetpeak - deltapeak < 0.0) if (targetpeak + deltapeak > 100.0 || targetpeak - deltapeak < 0.0)
{
gPrefs->Write(wxT("/AudioIO/DeltaPeakVolume"), min(100.0 - targetpeak, targetpeak)); gPrefs->Write(wxT("/AudioIO/DeltaPeakVolume"), min(100.0 - targetpeak, targetpeak));
gPrefs->Flush();
}
int value; int value;
gPrefs->Read(wxT("/AudioIO/AnalysisTime"), &value); gPrefs->Read(wxT("/AudioIO/AnalysisTime"), &value);
@ -197,7 +200,7 @@ bool RecordingPrefs::Apply()
if (value < 0) if (value < 0)
gPrefs->Write(wxT("/AudioIO/NumberAnalysis"), AILA_DEF_NUMBER_ANALYSIS); gPrefs->Write(wxT("/AudioIO/NumberAnalysis"), AILA_DEF_NUMBER_ANALYSIS);
#endif #endif
return true; return gPrefs->Flush();
} }

View File

@ -560,6 +560,7 @@ void DeviceToolBar::FillHostDevices()
if (host == wxT("")) { if (host == wxT("")) {
host = outMaps[i].hostString; host = outMaps[i].hostString;
gPrefs->Write(wxT("/AudioIO/Host"), host); gPrefs->Write(wxT("/AudioIO/Host"), host);
gPrefs->Flush();
mHost->SetStringSelection(host); mHost->SetStringSelection(host);
} }
} }
@ -584,6 +585,8 @@ int DeviceToolBar::ChangeHost()
//change the host and switch to correct devices. //change the host and switch to correct devices.
gPrefs->Write(wxT("/AudioIO/Host"), newHost); gPrefs->Write(wxT("/AudioIO/Host"), newHost);
gPrefs->Flush();
// populate the devices // populate the devices
FillHostDevices(); FillHostDevices();
@ -646,6 +649,8 @@ void DeviceToolBar::SetDevices(const DeviceSourceMap *in, const DeviceSourceMap
} else { } else {
gPrefs->Write(wxT("/AudioIO/RecordingSource"), wxT("")); gPrefs->Write(wxT("/AudioIO/RecordingSource"), wxT(""));
} }
gPrefs->Flush();
FillInputChannels(); FillInputChannels();
} }
@ -656,6 +661,7 @@ void DeviceToolBar::SetDevices(const DeviceSourceMap *in, const DeviceSourceMap
} else { } else {
gPrefs->Write(wxT("/AudioIO/PlaybackSource"), wxT("")); gPrefs->Write(wxT("/AudioIO/PlaybackSource"), wxT(""));
} }
gPrefs->Flush();
} }
} }

View File

@ -337,6 +337,7 @@ void SelectionBar::OnRightTime(wxCommandEvent &evt)
void SelectionBar::OnLengthRadio(wxCommandEvent &evt) void SelectionBar::OnLengthRadio(wxCommandEvent &evt)
{ {
gPrefs->Write(wxT("/ShowSelectionLength"), true); gPrefs->Write(wxT("/ShowSelectionLength"), true);
gPrefs->Flush();
mRightTime->SetName(wxString(_("Selection Length"))); mRightTime->SetName(wxString(_("Selection Length")));
ValuesToControls(); ValuesToControls();
@ -366,6 +367,7 @@ void SelectionBar::OnUpdate(wxCommandEvent &evt)
TimeTextCtrl *ttc = new TimeTextCtrl(this, wxID_ANY, wxT(""), 0.0, mRate); TimeTextCtrl *ttc = new TimeTextCtrl(this, wxID_ANY, wxT(""), 0.0, mRate);
wxString formatName(ttc->GetBuiltinName(index)); wxString formatName(ttc->GetBuiltinName(index));
gPrefs->Write(wxT("/SelectionFormat"), formatName); gPrefs->Write(wxT("/SelectionFormat"), formatName);
gPrefs->Flush();
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), formatName.c_str())); mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), formatName.c_str()));
#endif #endif

View File

@ -769,6 +769,7 @@ void ToolManager::WriteConfig()
// Restore original config path // Restore original config path
gPrefs->SetPath( oldpath ); gPrefs->SetPath( oldpath );
gPrefs->Flush();
} }
// //

View File

@ -389,6 +389,7 @@ void ShowHelpDialog(wxWindow *parent,
HelpMode = wxT("Local"); HelpMode = wxT("Local");
pProj->mHelpPref = HelpMode; pProj->mHelpPref = HelpMode;
gPrefs->Write(wxT("/GUI/Help"), HelpMode); gPrefs->Write(wxT("/GUI/Help"), HelpMode);
gPrefs->Flush();
} }
} }

View File

@ -1215,7 +1215,7 @@ void Meter::OnDisableMeter(wxCommandEvent &evt)
{ {
gPrefs->Write(wxT("/Meter/MeterOutputDisabled"), mMeterDisabled); gPrefs->Write(wxT("/Meter/MeterOutputDisabled"), mMeterDisabled);
} }
gPrefs->Flush();
} }
void Meter::OnHorizontal(wxCommandEvent &evt) void Meter::OnHorizontal(wxCommandEvent &evt)
@ -1309,21 +1309,8 @@ void Meter::OnPreferences(wxCommandEvent &evt)
if (d.ShowModal() == wxID_OK) { if (d.ShowModal() == wxID_OK) {
mMeterRefreshRate = d.GetValue(); mMeterRefreshRate = d.GetValue();
gPrefs->Write(wxT("/Meter/MeterRefreshRate"), mMeterRefreshRate); gPrefs->Write(wxT("/Meter/MeterRefreshRate"), mMeterRefreshRate);
gPrefs->Flush();
} }
mTimer.Start(1000 / mMeterRefreshRate); mTimer.Start(1000 / mMeterRefreshRate);
} }
// Indentation settings for Vim and Emacs.
// Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
//

View File

@ -87,6 +87,7 @@ void ShowWarningDialog(wxWindow *parent,
WarningDialog dlog(parent, message); WarningDialog dlog(parent, message);
gPrefs->Write(key, dlog.ShowModal()); gPrefs->Write(key, dlog.ShowModal());
gPrefs->Flush();
} }
// Indentation settings for Vim and Emacs and unique identifier for Arch, a // Indentation settings for Vim and Emacs and unique identifier for Arch, a