reset Preferences CFG file

This read-only archive contains discussions from the Adding Feature forum.
New feature request may be posted to the Adding Feature forum.
Technical support is available via the Help forum.
Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: reset Preferences CFG file

Post by Edgar » Thu Nov 13, 2014 12:20 am

bump

It really is easy to reset preferences programmatically from within Audacity. Not too far back one of the Developers went through and made sure that most, if not all, of the preference Writes were immediately flushed. Most, and I'm almost certain all, of the preferences Reads have built-in defaults.

My current code has been exposed to commercial use by a very large number of users for a couple of years now and I have had no complaints about problems. If anyone on the Team is willing to commit to trying it out I would create a patch against SVN HEAD.
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: reset Preferences CFG file

Post by steve » Thu Nov 13, 2014 12:31 am

Moved back to "Adding Features" since Edgar has resurrected it.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

kozikowski
Forum Staff
Posts: 69357
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: reset Preferences CFG file

Post by kozikowski » Thu Nov 13, 2014 2:06 am

It makes resetting easier, it doesn't eliminate all the problems.

"I reinstalled Audacity but the problem continued."

People already know how to reset Audacity.

Koz

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: reset Preferences CFG file

Post by Edgar » Thu Nov 13, 2014 6:00 am

I bumped this because the issue (which started on –Manual and was then moved to -quality) and is now on –devel. Vaughan said "I've always said that. There ought to just be a 'Reset All' or 'Defaults' button in the Prefs dialog." In reply to Peter's "+1 for:
http://wiki.audacityteam.org/w/index.ph ... on=history
the Proposal that Bill kicked off over three years ago."

I suspect that if Paul could be talked into reviewing my [anonymous] code Gale & Steve might be able to talk Vaughan into reviewing it. It's only a few lines of code. Admittedly, my solution is probably extreme:
reset.png
reset.png (30.33 KiB) Viewed 1677 times
and the wording might want some polish. The Load/Save stuff could easily be removed leaving just the Reset.
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: reset Preferences CFG file

Post by steve » Thu Nov 13, 2014 12:06 pm

Edgar wrote:Admittedly, my solution is probably extreme:
Thanks Ed, but we don't want "extreme" :D The chance of getting "extreme" committed are poor. The chances of getting "simple" committed are good, provided that it works.

The main problem as I see it is that just deleting the cfg file while Audacity is open is not enough - that would be simple, but does not work. :(

Many settings are saved on-close and many settings are read on-launch.
To get a clean reset, the cfg file can be reset (deleted) between the last "on close write" and the first "on launch read", which is the manual way of doing it.

We have lost one complication in that Audacity no longer reads the 1.2.x setting (hooray :))
but we have gained a new complication - the "pluginregistry.cfg".
There are also Chains, presets, EQ curves, Autosave data and a few other bits and pieces to consider.

What I think we are looking for is a "one click reset -> confirmation -> done" solution. Can your code do that?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: reset Preferences CFG file

Post by Edgar » Thu Nov 13, 2014 6:46 pm

steve wrote: The main problem as I see it is that just deleting the cfg file while Audacity is open is not enough - that would be simple, but does not work. :(

Many settings are saved on-close and many settings are read on-launch.
To get a clean reset, the cfg file can be reset (deleted) between the last "on close write" and the first "on launch read", which is the manual way of doing it.

What I think we are looking for is a "one click reset -> confirmation -> done" solution. Can your code do that?
You're absolutely right that deleting the CFG file while Audacity is open is neither enough nor proper.

To the best of my knowledge no settings are now "saved on close"; all settings are saved dynamically when changed. I would be happy to go through the code and verify this, correcting as needed (I think it was Leyland who did this a few months ago). While there may be a couple of instances of "read-on-launch and cache/preserve that value" a search of "gPrefs->Read", and an inspection of the results would easily find them all; they could turn into "read dynamically with defaults". I would be happy to comb through the code to ensure that these were all updated. The existing wxWidgets configuration file code allows for the configurations to be easily reset dynamically so there is no impediment to implementing this kind of a solution. Doing so requires only a couple lines of code; it can also be easily done in a partial manner keeping what you want and disposing of the rest.

My code (if you click the Reset button) does exactly:
a "one-click-to-reset -> confirmation -> done" solution.
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: reset Preferences CFG file

Post by steve » Thu Nov 13, 2014 7:09 pm

Edgar wrote:To the best of my knowledge no settings are now "saved on close";
While Audacity is open, open audacity.cfg in a text editor, delete its contents, save it and close the editor. Then close Audacity. Then open audacity.cfg - lots of settings in there.

Code: Select all

PrefsVersion=1.1.1r1
SelectionFormat=seconds
FrequencySelectionFormatName=hertz
SnapTo=0
DefaultOpenType=Audacity projects
LastOpenType=
NewImportingSession=1
DefaultOpenPath=/home/steve/Music/MIDI
Version=2.0.7-alpha-Oct  1 2014
LogFrequencySelectionFormatName=octaves
ShowSelectionLength=1
[Version]
Major=2
Minor=0
Micro=7
[Directories]
TempDir=/var/tmp/audacity-steve
[Plugins]
Rescan=0
CheckForUpdates=1
[Module]
mod-nyq-bench=1
[AudioIO]
RecordingDevice=default
Host=ALSA
PlaybackDevice=default
RecordChannels=2
RecordingSourceIndex=0
RecordingSource=
EffectsPreviewLen=6
CutPreviewBeforeLen=2
CutPreviewAfterLen=1
SeekShortPeriod=1
SeekLongPeriod=15
Duplex=1
SWPlaythrough=0
LatencyDuration=100
LatencyCorrection=-130
SoundActivatedRecord=0
SilenceLevel=-50
[FFmpeg]
Enabled=1
[GUI]
ShowSplashScreen=0
ErgonomicTransportButtons=1
EnvdBRange=60
Help=Local
BeepOnCompletion=0
ShowTrackNameInWaveform=0
RetainLabels=1
AutoScroll=1
TracksFitVerticallyZoomed=0
DefaultViewMode=0
SelectAllOnNone=0
EnableCutLines=0
AdjustSelectionEdges=1
CircularTrackNavigation=0
EditClipCanMove=1
Solo=Standard
EmptyCanBeDirty=1
ShowClipping=0
SyncLockTracks=0
[GUI/ToolBars]
[GUI/ToolBars/Control]
Dock=1
Order=1
Show=1
X=-1
Y=-1
W=327
H=55
[GUI/ToolBars/Tools]
Dock=1
Order=2
Show=1
X=-1
Y=-1
W=94
H=55
MultiToolActive=0
[GUI/ToolBars/CombinedMeter]
Dock=0
Order=0
Show=0
X=-1
Y=-1
W=100
H=27
[GUI/ToolBars/RecordMeter]
Dock=1
Order=3
Show=1
X=-1
Y=-1
W=460
H=27
[GUI/ToolBars/PlayMeter]
Dock=1
Order=4
Show=1
X=-1
Y=-1
W=460
H=27
[GUI/ToolBars/Mixer]
Dock=1
Order=8
Show=1
X=-1
Y=-1
W=323
H=27
[GUI/ToolBars/Edit]
Dock=1
Order=5
Show=1
X=-1
Y=-1
W=418
H=27
[GUI/ToolBars/Transcription]
Dock=1
Order=7
Show=1
X=-1
Y=-1
W=140
H=27
[GUI/ToolBars/Device]
Dock=1
Order=6
Show=1
X=-1
Y=-1
W=620
H=27
[GUI/ToolBars/Selection]
Dock=2
Order=1
Show=1
X=-1
Y=-1
W=636
H=55
[GUI/ToolBars/SpectralSelection]
Dock=0
Order=0
Show=0
X=-1
Y=-1
W=259
H=55
[GUI/ToolBars/Meter]
Dock=1
Order=3
Show=1
X=-1
Y=-1
W=338
H=55
[Effects]
GroupBy=name
MaxPerGroup=30
GUI=1
[Effects/ToneGen]
Duration=14.837
[Effects/ChangeSpeed]
PercentChange=0
TimeFormat=4
VinylChoice=1

[Effects/NoiseRemoval]
NoiseSensitivity=0
NoiseGain=-24
NoiseFreqSmoothing=150
NoiseAttackDecayTime=0.15
NoiseLeaveNoise=0
[Effects/Noise]
Duration=30
Type=0
Amplitude=0.8
[Effects/Reverb]
RoomSize=10
Delay=2
Reverberance=100
HfDamping=50
ToneLow=100
ToneHigh=100
WetGain=-1
DryGain=-7
StereoWidth=100
WetOnly=0
[Effects/Equalization]
FilterLength=4001
CurveName=unnamed
Lin=0
dBMin=-30
dBMax=30
DrawMode=1
Interp=0
DrawGrid=1
[SamplingRate]
DefaultProjectSampleRate=44100
DefaultProjectSampleFormat=262159
[Quality]
LibsoxrSampleRateConverter=1
DitherAlgorithm=0
LibsoxrHQSampleRateConverter=3
HQDitherAlgorithm=3
[Locale]
Language=
[FileFormats]
CopyOrEditUncompressedData=edit
ExportDownMix=1
AllegroStyle=1
SaveProjectWithDependencies=ask
[AudioFiles]
NormalizeOnLoad=0
ShowId3Dialog=1
[ExtendedImport]
OverrideExtendedImportByOpenFileDialogChoice=1
[Spectrum]
FFTSize=256
WindowType=3
MinFreq=0
MaxFreq=8000
Gain=20
Range=80
FrequencyGain=0
Grayscale=0
[Warnings]
FirstProjectSave=1
DiskSpaceWarning=1
MixStereo=1
MixMono=1
CopyOrEditUncompressedDataAsk=0
CopyOrEditUncompressedDataFirstAsk=0
[Ladspa]
Enable=0
[LV2]
Enable=0
[Nyquist]
Enable=1
[VAMP]
Enable=0
[VST]
Enable=0
[Prefs]
PrefsCategory=5
[Prefs/KeyConfig]
ViewBy=tree
[Window]
X=646
Y=24
Width=699
Height=691
Maximized=0
Normal_X=646
Normal_Y=24
Normal_Width=699
Normal_Height=691
Iconized=0
[Meter]
MeterRefreshRate=30
MeterStyle=HorizontalStereo
MeterBars=RMS
MeterType=dB
[FreqWindow]
DrawGrid=1
SizeChoice=5
AlgChoice=0
FuncChoice=3
AxisChoice=1
[NyqBench]
AutoLoad=0
AutoWrap=1
ScriptFont=Arial 10
OutputFont=Arial 10
LargeIcons=0
SplitX=200
SplitMode=1
ShowCode=1
ShowOutput=1
Path=/home/steve/.audacity-files/plug-ins/crossfade.ny
[NyqBench/Window]
Maximized=0
X=130
Y=99
Width=610
Height=464
[Batch]
ActiveChain=test
[RecentFiles]
file01=/home/steve/Desktop/Computer Level 0 - Mic Way Up.wav
file02=/home/steve/Desktop/Two Words.wav
file03=/home/steve/Desktop/test2.aup
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: reset Preferences CFG file

Post by Edgar » Thu Nov 13, 2014 7:33 pm

steve wrote:
Edgar wrote:To the best of my knowledge no settings are now "saved on close";
While Audacity is open, open audacity.cfg in a text editor, delete its contents, save it and close the editor. Then close Audacity. Then open audacity.cfg - lots of settings in there.
Absolutely right. That is because the wxWidgets configuration file code does not deal with the file on disk except for at launch and exit. So, if you delete the file while Audacity is running, then do something which causes a preferences read, Audacity will not use the default but will use the current preference.

The wxWidgets code does allow you to reset all or part of your configuration in real-time so, if you reset while Audacity is running, any subsequent preference read would get the default and when you exited Audacity any preference changes you caused would be written to the otherwise empty (and again you don't have to completely empty the preferences) configuration file. My code includes a global variable which remembers that preferences have been reset and upon Audacity exit ensures that the configuration file has nothing in it other than the "uninitialized" line (this behavior can be modified to allow it to also write some of the other configuration values).
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: reset Preferences CFG file

Post by steve » Thu Nov 13, 2014 7:39 pm

Edgar wrote: ensures that the configuration file has nothing in it other than the "uninitialized" line
I don't think that it needs that "uninitialized" line any more (because Audacity no longer reads the 1.2.x preferences), so it could delete the file entirely.

What about the new "pluginregistry.cfg", Chains, presets, "EQ curves" and "Autosave data"?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: reset Preferences CFG file

Post by Edgar » Thu Nov 13, 2014 11:41 pm

steve wrote:
Edgar wrote: ensures that the configuration file has nothing in it other than the "uninitialized" line
I don't think that it needs that "uninitialized" line any more (because Audacity no longer reads the 1.2.x preferences), so it could delete the file entirely.
Here is an abbreviated look at a configuration file:

Code: Select all

Version=2.0.1
PrefsVersion=1.1.1r1
[Version]
Major=2
Minor=0
[GUI]
ShowSplashScreen=0
ErgonomicTransportButtons=1
[GUI/ToolBars]
[GUI/ToolBars/Control]
Dock=1
Order=1
The very first entry (Version=2.0.1) is not under a section heading, next comes a named section [Version] with some entries, then another named section [GUI] with some entries followed by a named subsection of the GUI section [GUI/ToolBars] which has no entries, just subsections of a subsection [GUI/ToolBars/Control]. The wxWidgets configuration class is very powerful, you can tell it to delete everything, delete some or all of a section, subsection or sub-subsection ad infinitum. It is possible to only delete certain keys within a section/subsection. All this is really easy.
steve wrote: What about the new "pluginregistry.cfg", Chains, presets, "EQ curves" and "Autosave data"?
If the pluginregistry.cfg file is a real wxWidgets configuration file (it sure looks like one) it may be handled with the wxWidgets configuration class code just as we could do with the current configuration file; if not, it should be.

The chains files are just text files and probably should not be deleted willy-nilly. If a specific chain command causes Audacity to crash Audacity may be restarted and the Chains editor can be used to delete the offending chain; there's no way that a chain file can cause Audacity to not launch.

I do not have any "presets" and have no idea what they're all about. Is there any way that a preset file is accessed upon Audacity launch or is the user's intervention required to cause one of these to be accessed? Is there a method for the user to create or delete these?

The same goes for EQ curves – I have none and can't imagine that they would be accessed simply by launching Audacity. Ditto, how does the user create or delete them?
-Edgar
running Audacity personally customized 2.0.6 daily in a professional audio studio
occasionally using current Audacity alpha for testing and support situations
64-bit Windows Pro 10

Locked