1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-09 06:06:24 +01:00

Settings objects used in AudioIOBase...

... Giving many examples of use of Settings objects.  Many other rewrites like
this should be made to eliminate as many direct uses of gPrefs as we can.

Don't rely on long distance coincidences of literals for paths or defaults.

For each of several paths like /AudioIO/Host, all uses of that path are replaced
with use of a global Settings object defined in one place, in AudioIOBase.  The
object also gives the benefit of caching the last-read or written value.

Other users of those preferences must then include "AudioIOBase.h" to make the
dependency explicit at compile time.

It should be checked that no other mentions of those paths remain in the source,
and that there was no unintended change in default values.

This also inverts dependency of AudioIOBase on RecordingPrefs, which is GUI for
changing some of these settings.
This commit is contained in:
Paul Licameli
2021-02-27 12:06:28 -05:00
parent 5fef82dccf
commit 8c04ed3990
10 changed files with 117 additions and 119 deletions

View File

@@ -529,8 +529,8 @@ void OnPunchAndRoll(const CommandContext &context)
auto tracks =
ProjectAudioManager::ChooseExistingRecordingTracks(project, true, rateOfSelected);
if (tracks.empty()) {
int recordingChannels =
std::max(0L, gPrefs->Read(wxT("/AudioIO/RecordChannels"), 2));
auto recordingChannels =
std::max(0, AudioIORecordChannels.Read());
auto message =
(recordingChannels == 1)
? XO("Please select in a mono track.")