1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-23 16:08:07 +02:00

Bug 1879 - Audacity resets project rate without warning.

These were the steps to reproduce:

Remember that the Realtek card in my new HP laptop *only* runs at 48000

1) Clear out the entire Audacity config/settings folder for virgin running
2) Launch Audacity  audacity-2.3.0-alpha-20-a22be24ae3a224c90688504f8ff323c41f8c9c35
3) set recording for WASAPI/loopback (or WASAPI/mic)
4) press Record
5) Track records properly
6) rate shown in TCP is 44100
7) Project rate at bottom left shows 44100
8) Exit Audacity

9) Relaunch Audacity
10) Project rate at bottom left now shows 48000
11) Press Record
12) Track records OK - but at 48000 obviously

The problem: the default sample rate is read in like this:
gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), &mRate, AudioIO::GetOptimalSupportedSampleRate());

- the default is not fixed, it can vary with host/device.

Fix: Ensure that there is always an entry for the default sample rate in audacity.cfg
This commit is contained in:
David Bailes 2018-06-07 14:42:39 +01:00
parent 122607f180
commit b54f56fba0

View File

@ -924,7 +924,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
: wxFrame(parent, id, _TS("Audacity"), pos, size), : wxFrame(parent, id, _TS("Audacity"), pos, size),
mViewInfo(0.0, 1.0, ZoomInfo::GetDefaultZoom()), mViewInfo(0.0, 1.0, ZoomInfo::GetDefaultZoom()),
mbLoadedFromAup( false ), mbLoadedFromAup( false ),
mRate((double) gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), AudioIO::GetOptimalSupportedSampleRate())),
mDefaultFormat(QualityPrefs::SampleFormatChoice()), mDefaultFormat(QualityPrefs::SampleFormatChoice()),
mSnapTo(gPrefs->Read(wxT("/SnapTo"), SNAP_OFF)), mSnapTo(gPrefs->Read(wxT("/SnapTo"), SNAP_OFF)),
mSelectionFormat( NumericTextCtrl::LookupFormat( mSelectionFormat( NumericTextCtrl::LookupFormat(
@ -938,6 +937,14 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) ) ), gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) ) ),
mUndoManager(std::make_unique<UndoManager>()) mUndoManager(std::make_unique<UndoManager>())
{ {
if (!gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), &mRate, AudioIO::GetOptimalSupportedSampleRate())) {
// The default given above can vary with host/devices. So unless there is an entry for
// the default sample rate in audacity.cfg, Audacity can open with a rate which is different
// from the rate with which it closed. See bug 1879.
gPrefs->Write(wxT("/SamplingRate/DefaultProjectSampleRate"), mRate);
gPrefs->Flush();
}
mTracks = TrackList::Create(); mTracks = TrackList::Create();
#ifdef EXPERIMENTAL_DA2 #ifdef EXPERIMENTAL_DA2