1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-28 14:18:41 +02:00

Don't store default sample format in ProjectSettings...

... it's a global preference.
This commit is contained in:
Paul Licameli 2019-07-20 15:48:29 -04:00
parent 7532677781
commit 314ede2137
5 changed files with 10 additions and 16 deletions

View File

@ -55,11 +55,11 @@ AliasedFile s.
#include "FileFormats.h" #include "FileFormats.h"
#include "Prefs.h" #include "Prefs.h"
#include "Project.h" #include "Project.h"
#include "ProjectSettings.h"
#include "Sequence.h" #include "Sequence.h"
#include "ShuttleGui.h" #include "ShuttleGui.h"
#include "WaveTrack.h" #include "WaveTrack.h"
#include "WaveClip.h" #include "WaveClip.h"
#include "prefs/QualityPrefs.h"
#include "widgets/AudacityMessageBox.h" #include "widgets/AudacityMessageBox.h"
#include "widgets/ProgressDialog.h" #include "widgets/ProgressDialog.h"
@ -110,8 +110,7 @@ static void ReplaceBlockFiles(BlockPtrArray &blocks,
void FindDependencies(AudacityProject *project, void FindDependencies(AudacityProject *project,
AliasedFileArray &outAliasedFiles) AliasedFileArray &outAliasedFiles)
{ {
const auto &settings = ProjectSettings::Get( *project ); sampleFormat format = QualityPrefs::SampleFormatChoice();
sampleFormat format = settings.GetDefaultFormat();
BlockPtrArray blocks; BlockPtrArray blocks;
GetAllSeqBlocks(project, &blocks); GetAllSeqBlocks(project, &blocks);
@ -168,7 +167,6 @@ static void RemoveDependencies(AudacityProject *project,
// STRONG-GUARANTEE // STRONG-GUARANTEE
{ {
auto &dirManager = DirManager::Get( *project ); auto &dirManager = DirManager::Get( *project );
const auto &settings = ProjectSettings::Get( *project );
ProgressDialog progress( ProgressDialog progress(
XO("Removing Dependencies"), XO("Removing Dependencies"),
@ -188,7 +186,7 @@ static void RemoveDependencies(AudacityProject *project,
BlockPtrArray blocks; BlockPtrArray blocks;
GetAllSeqBlocks(project, &blocks); GetAllSeqBlocks(project, &blocks);
const sampleFormat format = settings.GetDefaultFormat(); const sampleFormat format = QualityPrefs::SampleFormatChoice();
ReplacedBlockFileHash blockFileHash; ReplacedBlockFileHash blockFileHash;
wxLongLong completedBytes = 0; wxLongLong completedBytes = 0;
for (const auto blockFile : blocks) { for (const auto blockFile : blocks) {

View File

@ -14,7 +14,6 @@ Paul Licameli split from AudacityProject.cpp
#include "AudioIOBase.h" #include "AudioIOBase.h"
#include "Project.h" #include "Project.h"
#include "prefs/QualityPrefs.h"
#include "widgets/NumericTextCtrl.h" #include "widgets/NumericTextCtrl.h"
#include "prefs/TracksBehaviorsPrefs.h" #include "prefs/TracksBehaviorsPrefs.h"
@ -62,7 +61,6 @@ ProjectSettings::ProjectSettings( AudacityProject &project )
NumericConverter::BANDWIDTH, NumericConverter::BANDWIDTH,
gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) ) gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) )
} }
, mDefaultFormat{ QualityPrefs::SampleFormatChoice() }
, mSnapTo( gPrefs->Read(wxT("/SnapTo"), SNAP_OFF) ) , mSnapTo( gPrefs->Read(wxT("/SnapTo"), SNAP_OFF) )
{ {
if (!gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), &mRate, if (!gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), &mRate,
@ -115,8 +113,6 @@ void ProjectSettings::UpdatePrefs()
bar.SetRate( mRate ); bar.SetRate( mRate );
} }
#endif #endif
mDefaultFormat = QualityPrefs::SampleFormatChoice();
} }
const NumericFormatSymbol & const NumericFormatSymbol &

View File

@ -64,8 +64,6 @@ public:
ProjectSettings( const ProjectSettings & ) PROHIBITED; ProjectSettings( const ProjectSettings & ) PROHIBITED;
ProjectSettings &operator=( const ProjectSettings & ) PROHIBITED; ProjectSettings &operator=( const ProjectSettings & ) PROHIBITED;
sampleFormat GetDefaultFormat() const { return mDefaultFormat; }
double GetRate() const { return mRate; } double GetRate() const { return mRate; }
void SetRate( double value ) { mRate = value; } void SetRate( double value ) { mRate = value; }
@ -131,7 +129,6 @@ private:
// the main // the main
std::atomic<double> mPlaySpeed{}; std::atomic<double> mPlaySpeed{};
sampleFormat mDefaultFormat;
int mSnapTo; int mSnapTo;
int mCurrentTool; int mCurrentTool;

View File

@ -54,6 +54,7 @@ Track classes.
#include "Prefs.h" #include "Prefs.h"
#include "effects/TimeWarper.h" #include "effects/TimeWarper.h"
#include "prefs/QualityPrefs.h"
#include "prefs/SpectrogramSettings.h" #include "prefs/SpectrogramSettings.h"
#include "prefs/TracksPrefs.h" #include "prefs/TracksPrefs.h"
#include "prefs/WaveformSettings.h" #include "prefs/WaveformSettings.h"
@ -80,7 +81,7 @@ WaveTrack::Holder TrackFactory::DuplicateWaveTrack(const WaveTrack &orig)
WaveTrack::Holder TrackFactory::NewWaveTrack(sampleFormat format, double rate) WaveTrack::Holder TrackFactory::NewWaveTrack(sampleFormat format, double rate)
{ {
if (format == (sampleFormat)0) if (format == (sampleFormat)0)
format = mSettings.GetDefaultFormat(); format = QualityPrefs::SampleFormatChoice();
if (rate == 0) if (rate == 0)
rate = mSettings.GetRate(); rate = mSettings.GetRate();
return std::make_shared<WaveTrack> ( mDirManager, format, rate ); return std::make_shared<WaveTrack> ( mDirManager, format, rate );

View File

@ -29,6 +29,7 @@
#include "../commands/CommandManager.h" #include "../commands/CommandManager.h"
#include "../effects/EffectManager.h" #include "../effects/EffectManager.h"
#include "../effects/EffectUI.h" #include "../effects/EffectUI.h"
#include "../prefs/QualityPrefs.h"
#include "../tracks/playabletrack/wavetrack/ui/WaveTrackControls.h" #include "../tracks/playabletrack/wavetrack/ui/WaveTrackControls.h"
#include "../widgets/ASlider.h" #include "../widgets/ASlider.h"
#include "../widgets/AudacityMessageBox.h" #include "../widgets/AudacityMessageBox.h"
@ -53,7 +54,7 @@ void DoMixAndRender
auto &tracks = TrackList::Get( project ); auto &tracks = TrackList::Get( project );
auto &trackFactory = TrackFactory::Get( project ); auto &trackFactory = TrackFactory::Get( project );
auto rate = settings.GetRate(); auto rate = settings.GetRate();
auto defaultFormat = settings.GetDefaultFormat(); auto defaultFormat = QualityPrefs::SampleFormatChoice();
auto &trackPanel = TrackPanel::Get( project ); auto &trackPanel = TrackPanel::Get( project );
auto &window = ProjectWindow::Get( project ); auto &window = ProjectWindow::Get( project );
@ -597,7 +598,8 @@ void OnNewWaveTrack(const CommandContext &context)
auto &trackFactory = TrackFactory::Get( project ); auto &trackFactory = TrackFactory::Get( project );
auto &window = ProjectWindow::Get( project ); auto &window = ProjectWindow::Get( project );
auto defaultFormat = settings.GetDefaultFormat(); auto defaultFormat = QualityPrefs::SampleFormatChoice();
auto rate = settings.GetRate(); auto rate = settings.GetRate();
auto t = tracks.Add( trackFactory.NewWaveTrack( defaultFormat, rate ) ); auto t = tracks.Add( trackFactory.NewWaveTrack( defaultFormat, rate ) );
@ -620,7 +622,7 @@ void OnNewStereoTrack(const CommandContext &context)
auto &trackFactory = TrackFactory::Get( project ); auto &trackFactory = TrackFactory::Get( project );
auto &window = ProjectWindow::Get( project ); auto &window = ProjectWindow::Get( project );
auto defaultFormat = settings.GetDefaultFormat(); auto defaultFormat = QualityPrefs::SampleFormatChoice();
auto rate = settings.GetRate(); auto rate = settings.GetRate();
SelectUtilities::SelectNone( project ); SelectUtilities::SelectNone( project );