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 ea8a3efc8e
commit 44d9916f85
5 changed files with 10 additions and 16 deletions

View File

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

View File

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

View File

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

View File

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

View File

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