New attached structure ProjectSettings stores rate, snap-to, et al.
This commit is contained in:
parent
327845b0ee
commit
dd10e00a2d
|
@ -1522,7 +1522,7 @@ bool AudacityApp::OnInit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( project->mShowSplashScreen ){
|
if( ProjectSettings::Get( *project ).GetShowSplashScreen() ){
|
||||||
// This may do a check-for-updates at every start up.
|
// This may do a check-for-updates at every start up.
|
||||||
// Mainly this is to tell users of ALPHAS who don't know that they have an ALPHA.
|
// Mainly this is to tell users of ALPHAS who don't know that they have an ALPHA.
|
||||||
// Disabled for now, after discussion.
|
// Disabled for now, after discussion.
|
||||||
|
|
|
@ -801,14 +801,15 @@ bool MacroCommands::ApplyCommandInBatchMode( const wxString &friendlyCommand,
|
||||||
CommandContext const * pContext)
|
CommandContext const * pContext)
|
||||||
{
|
{
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = GetActiveProject();
|
||||||
|
auto &settings = ProjectSettings::Get( *project );
|
||||||
// Recalc flags and enable items that may have become enabled.
|
// Recalc flags and enable items that may have become enabled.
|
||||||
MenuManager::Get(*project).UpdateMenus(*project, false);
|
MenuManager::Get(*project).UpdateMenus(*project, false);
|
||||||
// enter batch mode...
|
// enter batch mode...
|
||||||
bool prevShowMode = project->GetShowId3Dialog();
|
bool prevShowMode = settings.GetShowId3Dialog();
|
||||||
project->mBatchMode++;
|
project->mBatchMode++;
|
||||||
auto cleanup = finally( [&] {
|
auto cleanup = finally( [&] {
|
||||||
// exit batch mode...
|
// exit batch mode...
|
||||||
project->SetShowId3Dialog(prevShowMode);
|
settings.SetShowId3Dialog(prevShowMode);
|
||||||
project->mBatchMode--;
|
project->mBatchMode--;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,8 @@ static void ReplaceBlockFiles(BlockPtrArray &blocks,
|
||||||
void FindDependencies(AudacityProject *project,
|
void FindDependencies(AudacityProject *project,
|
||||||
AliasedFileArray &outAliasedFiles)
|
AliasedFileArray &outAliasedFiles)
|
||||||
{
|
{
|
||||||
sampleFormat format = project->GetDefaultFormat();
|
const auto &settings = ProjectSettings::Get( *project );
|
||||||
|
sampleFormat format = settings.GetDefaultFormat();
|
||||||
|
|
||||||
BlockPtrArray blocks;
|
BlockPtrArray blocks;
|
||||||
GetAllSeqBlocks(project, &blocks);
|
GetAllSeqBlocks(project, &blocks);
|
||||||
|
@ -164,6 +165,7 @@ 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
|
||||||
(_("Removing Dependencies"),
|
(_("Removing Dependencies"),
|
||||||
|
@ -183,7 +185,7 @@ static void RemoveDependencies(AudacityProject *project,
|
||||||
BlockPtrArray blocks;
|
BlockPtrArray blocks;
|
||||||
GetAllSeqBlocks(project, &blocks);
|
GetAllSeqBlocks(project, &blocks);
|
||||||
|
|
||||||
const sampleFormat format = project->GetDefaultFormat();
|
const sampleFormat format = settings.GetDefaultFormat();
|
||||||
ReplacedBlockFileHash blockFileHash;
|
ReplacedBlockFileHash blockFileHash;
|
||||||
wxLongLong completedBytes = 0;
|
wxLongLong completedBytes = 0;
|
||||||
for (const auto blockFile : blocks) {
|
for (const auto blockFile : blocks) {
|
||||||
|
|
|
@ -3085,11 +3085,12 @@ int LabelTrack::FindNextLabel(const SelectedRegion& currentRegion)
|
||||||
void LabelTrack::DoEditLabels
|
void LabelTrack::DoEditLabels
|
||||||
(AudacityProject &project, LabelTrack *lt, int index)
|
(AudacityProject &project, LabelTrack *lt, int index)
|
||||||
{
|
{
|
||||||
auto format = project.GetSelectionFormat(),
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
freqFormat = project.GetFrequencySelectionFormatName();
|
auto format = settings.GetSelectionFormat(),
|
||||||
|
freqFormat = settings.GetFrequencySelectionFormatName();
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &trackFactory = TrackFactory::Get( project );
|
auto &trackFactory = TrackFactory::Get( project );
|
||||||
auto rate = project.GetRate();
|
auto rate = ProjectSettings::Get( project ).GetRate();
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
||||||
|
|
|
@ -554,7 +554,8 @@ CommandFlag MenuManager::GetUpdateFlags
|
||||||
if (FileHistory::Global().GetCount() > 0)
|
if (FileHistory::Global().GetCount() > 0)
|
||||||
flags |= HaveRecentFiles;
|
flags |= HaveRecentFiles;
|
||||||
|
|
||||||
if (project.IsSyncLocked())
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
|
if (settings.IsSyncLocked())
|
||||||
flags |= IsSyncLockedFlag;
|
flags |= IsSyncLockedFlag;
|
||||||
else
|
else
|
||||||
flags |= IsNotSyncLockedFlag;
|
flags |= IsNotSyncLockedFlag;
|
||||||
|
@ -589,6 +590,8 @@ void MenuManager::ModifyToolbarMenus(AudacityProject &project)
|
||||||
|
|
||||||
auto &commandManager = CommandManager::Get( project );
|
auto &commandManager = CommandManager::Get( project );
|
||||||
|
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
|
||||||
commandManager.Check(wxT("ShowScrubbingTB"),
|
commandManager.Check(wxT("ShowScrubbingTB"),
|
||||||
toolManager.IsVisible(ScrubbingBarID));
|
toolManager.IsVisible(ScrubbingBarID));
|
||||||
commandManager.Check(wxT("ShowDeviceTB"),
|
commandManager.Check(wxT("ShowDeviceTB"),
|
||||||
|
@ -644,8 +647,10 @@ void MenuManager::ModifyToolbarMenus(AudacityProject &project)
|
||||||
commandManager.Check(wxT("Overdub"), active);
|
commandManager.Check(wxT("Overdub"), active);
|
||||||
gPrefs->Read(wxT("/AudioIO/SWPlaythrough"),&active, false);
|
gPrefs->Read(wxT("/AudioIO/SWPlaythrough"),&active, false);
|
||||||
commandManager.Check(wxT("SWPlaythrough"), active);
|
commandManager.Check(wxT("SWPlaythrough"), active);
|
||||||
|
|
||||||
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &active, false);
|
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &active, false);
|
||||||
project.SetSyncLock(active);
|
settings.SetSyncLock(active);
|
||||||
|
|
||||||
commandManager.Check(wxT("SyncLock"), active);
|
commandManager.Check(wxT("SyncLock"), active);
|
||||||
gPrefs->Read(wxT("/GUI/TypeToCreateLabel"),&active, false);
|
gPrefs->Read(wxT("/GUI/TypeToCreateLabel"),&active, false);
|
||||||
commandManager.Check(wxT("TypeToCreateLabel"), active);
|
commandManager.Check(wxT("TypeToCreateLabel"), active);
|
||||||
|
|
|
@ -283,7 +283,7 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
|
||||||
*(mMixerBoard->mImageSoloDisabled),
|
*(mMixerBoard->mImageSoloDisabled),
|
||||||
true); // toggle button
|
true); // toggle button
|
||||||
mToggleButton_Solo->SetName(_("Solo"));
|
mToggleButton_Solo->SetName(_("Solo"));
|
||||||
bool bSoloNone = mProject->IsSoloNone();
|
bool bSoloNone = ProjectSettings::Get( *mProject ).IsSoloNone();
|
||||||
mToggleButton_Solo->Show(!bSoloNone);
|
mToggleButton_Solo->Show(!bSoloNone);
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ void MixerTrackCluster::HandleResize() // For wxSizeEvents, update gain slider a
|
||||||
mSlider_Velocity->SetSize(-1, nGainSliderHeight);
|
mSlider_Velocity->SetSize(-1, nGainSliderHeight);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool bSoloNone = mProject->IsSoloNone();
|
bool bSoloNone = ProjectSettings::Get( *mProject ).IsSoloNone();
|
||||||
|
|
||||||
mToggleButton_Solo->Show(!bSoloNone);
|
mToggleButton_Solo->Show(!bSoloNone);
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ void MixerTrackCluster::OnButton_Mute(wxCommandEvent& WXUNUSED(event))
|
||||||
mToggleButton_Mute->SetAlternateIdx(mTrack->GetSolo() ? 1 : 0);
|
mToggleButton_Mute->SetAlternateIdx(mTrack->GetSolo() ? 1 : 0);
|
||||||
|
|
||||||
// Update the TrackPanel correspondingly.
|
// Update the TrackPanel correspondingly.
|
||||||
if (mProject->IsSoloSimple())
|
if (ProjectSettings::Get(*mProject).IsSoloSimple())
|
||||||
ProjectWindow::Get( *mProject ).RedrawProject();
|
ProjectWindow::Get( *mProject ).RedrawProject();
|
||||||
else
|
else
|
||||||
// Update only the changed track.
|
// Update only the changed track.
|
||||||
|
|
217
src/Project.cpp
217
src/Project.cpp
|
@ -1061,32 +1061,13 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||||
const wxPoint & pos,
|
const wxPoint & pos,
|
||||||
const wxSize & size)
|
const wxSize & size)
|
||||||
: wxFrame(parent, id, _TS("Audacity"), pos, size),
|
: wxFrame(parent, id, _TS("Audacity"), pos, size),
|
||||||
mbLoadedFromAup( false ),
|
mbLoadedFromAup( false )
|
||||||
mDefaultFormat(QualityPrefs::SampleFormatChoice()),
|
|
||||||
mSnapTo(gPrefs->Read(wxT("/SnapTo"), SNAP_OFF)),
|
|
||||||
mSelectionFormat( NumericTextCtrl::LookupFormat(
|
|
||||||
NumericConverter::TIME,
|
|
||||||
gPrefs->Read(wxT("/SelectionFormat"), wxT("")) ) ),
|
|
||||||
mFrequencySelectionFormatName( NumericTextCtrl::LookupFormat(
|
|
||||||
NumericConverter::FREQUENCY,
|
|
||||||
gPrefs->Read(wxT("/FrequencySelectionFormatName"), wxT("")) ) ),
|
|
||||||
mBandwidthSelectionFormatName( NumericTextCtrl::LookupFormat(
|
|
||||||
NumericConverter::BANDWIDTH,
|
|
||||||
gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) ) )
|
|
||||||
{
|
{
|
||||||
auto &project = *this;
|
auto &project = *this;
|
||||||
auto &window = project;
|
auto &window = project;
|
||||||
|
|
||||||
mNextWindowID = NextID;
|
mNextWindowID = NextID;
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_DA2
|
#ifdef EXPERIMENTAL_DA2
|
||||||
SetBackgroundColour(theTheme.Colour( clrMedium ));
|
SetBackgroundColour(theTheme.Colour( clrMedium ));
|
||||||
#endif
|
#endif
|
||||||
|
@ -1113,11 +1094,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||||
|
|
||||||
mLockPlayRegion = false;
|
mLockPlayRegion = false;
|
||||||
|
|
||||||
// Make sure valgrind sees mIsSyncLocked is initialized, even
|
|
||||||
// though we're about to set it from prefs.
|
|
||||||
mIsSyncLocked = false;
|
|
||||||
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false);
|
|
||||||
|
|
||||||
// LLL: Read this!!!
|
// LLL: Read this!!!
|
||||||
//
|
//
|
||||||
// Until the time (and cpu) required to refresh the track panel is
|
// Until the time (and cpu) required to refresh the track panel is
|
||||||
|
@ -1378,7 +1354,8 @@ void AudacityProject::ApplyUpdatedTheme()
|
||||||
AudioIOStartStreamOptions
|
AudioIOStartStreamOptions
|
||||||
DefaultPlayOptions( AudacityProject &project )
|
DefaultPlayOptions( AudacityProject &project )
|
||||||
{
|
{
|
||||||
AudioIOStartStreamOptions options { project.GetRate() };
|
AudioIOStartStreamOptions options {
|
||||||
|
ProjectSettings::Get( project ).GetRate() };
|
||||||
options.timeTrack = TrackList::Get( project ).GetTimeTrack();
|
options.timeTrack = TrackList::Get( project ).GetTimeTrack();
|
||||||
options.listener = &project;
|
options.listener = &project;
|
||||||
return options;
|
return options;
|
||||||
|
@ -1390,7 +1367,7 @@ DefaultSpeedPlayOptions( AudacityProject &project )
|
||||||
auto PlayAtSpeedRate = gAudioIO->GetBestRate(
|
auto PlayAtSpeedRate = gAudioIO->GetBestRate(
|
||||||
false, //not capturing
|
false, //not capturing
|
||||||
true, //is playing
|
true, //is playing
|
||||||
project.GetRate() //suggested rate
|
ProjectSettings::Get( project ).GetRate() //suggested rate
|
||||||
);
|
);
|
||||||
AudioIOStartStreamOptions options{ PlayAtSpeedRate };
|
AudioIOStartStreamOptions options{ PlayAtSpeedRate };
|
||||||
options.timeTrack = TrackList::Get( project ).GetTimeTrack();
|
options.timeTrack = TrackList::Get( project ).GetTimeTrack();
|
||||||
|
@ -1398,7 +1375,7 @@ DefaultSpeedPlayOptions( AudacityProject &project )
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::UpdatePrefsVariables()
|
void ProjectSettings::UpdatePrefs()
|
||||||
{
|
{
|
||||||
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &mShowId3Dialog, true);
|
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &mShowId3Dialog, true);
|
||||||
gPrefs->Read(wxT("/AudioFiles/NormalizeOnLoad"),&mNormalizeOnLoad, false);
|
gPrefs->Read(wxT("/AudioFiles/NormalizeOnLoad"),&mNormalizeOnLoad, false);
|
||||||
|
@ -1430,8 +1407,6 @@ void AudacityProject::UpdatePrefsVariables()
|
||||||
|
|
||||||
void AudacityProject::UpdatePrefs()
|
void AudacityProject::UpdatePrefs()
|
||||||
{
|
{
|
||||||
UpdatePrefsVariables();
|
|
||||||
|
|
||||||
SetProjectTitle();
|
SetProjectTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1532,12 +1507,15 @@ void AudacityProject::SetProjectTitle( int number)
|
||||||
|
|
||||||
bool AudacityProject::SnapSelection()
|
bool AudacityProject::SnapSelection()
|
||||||
{
|
{
|
||||||
if (mSnapTo != SNAP_OFF) {
|
auto &project = *this;
|
||||||
auto &project = *this;
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
auto snapTo = settings.GetSnapTo();
|
||||||
|
if (snapTo != SNAP_OFF) {
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
SelectedRegion &selectedRegion = viewInfo.selectedRegion;
|
SelectedRegion &selectedRegion = viewInfo.selectedRegion;
|
||||||
NumericConverter nc(NumericConverter::TIME, GetSelectionFormat(), 0, GetRate());
|
NumericConverter nc(NumericConverter::TIME,
|
||||||
const bool nearest = (mSnapTo == SNAP_NEAREST);
|
settings.GetSelectionFormat(), 0, settings.GetRate());
|
||||||
|
const bool nearest = (snapTo == SNAP_NEAREST);
|
||||||
|
|
||||||
const double oldt0 = selectedRegion.t0();
|
const double oldt0 = selectedRegion.t0();
|
||||||
const double oldt1 = selectedRegion.t1();
|
const double oldt1 = selectedRegion.t1();
|
||||||
|
@ -1562,30 +1540,37 @@ bool AudacityProject::SnapSelection()
|
||||||
|
|
||||||
double AudacityProject::AS_GetRate()
|
double AudacityProject::AS_GetRate()
|
||||||
{
|
{
|
||||||
return mRate;
|
auto &project = *this;
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
return settings.GetRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Typically this came from the SelectionToolbar and does not need to
|
// Typically this came from the SelectionToolbar and does not need to
|
||||||
// be communicated back to it.
|
// be communicated back to it.
|
||||||
void AudacityProject::AS_SetRate(double rate)
|
void AudacityProject::AS_SetRate(double rate)
|
||||||
{
|
{
|
||||||
mRate = rate;
|
auto &project = *this;
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
settings.SetRate( rate );
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudacityProject::AS_GetSnapTo()
|
int AudacityProject::AS_GetSnapTo()
|
||||||
{
|
{
|
||||||
return GetSnapTo();
|
auto &project = *this;
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
return settings.GetSnapTo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::AS_SetSnapTo(int snap)
|
void AudacityProject::AS_SetSnapTo(int snap)
|
||||||
{
|
{
|
||||||
auto &project = *this;
|
auto &project = *this;
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
|
||||||
SetSnapTo( snap );
|
settings.SetSnapTo( snap );
|
||||||
|
|
||||||
// LLL: TODO - what should this be changed to???
|
// LLL: TODO - what should this be changed to???
|
||||||
// GetCommandManager()->Check(wxT("Snap"), mSnapTo);
|
// GetCommandManager()->Check(wxT("Snap"), mSnapTo);
|
||||||
gPrefs->Write(wxT("/SnapTo"), mSnapTo);
|
gPrefs->Write(wxT("/SnapTo"), snap);
|
||||||
gPrefs->Flush();
|
gPrefs->Flush();
|
||||||
|
|
||||||
SnapSelection();
|
SnapSelection();
|
||||||
|
@ -1597,15 +1582,18 @@ void AudacityProject::AS_SetSnapTo(int snap)
|
||||||
|
|
||||||
const NumericFormatSymbol & AudacityProject::AS_GetSelectionFormat()
|
const NumericFormatSymbol & AudacityProject::AS_GetSelectionFormat()
|
||||||
{
|
{
|
||||||
return GetSelectionFormat();
|
auto &project = *this;
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
return settings.GetSelectionFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::AS_SetSelectionFormat(const NumericFormatSymbol & format)
|
void AudacityProject::AS_SetSelectionFormat(const NumericFormatSymbol & format)
|
||||||
{
|
{
|
||||||
auto &project = *this;
|
auto &project = *this;
|
||||||
SetSelectionFormat( format );
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
settings.SetSelectionFormat( format );
|
||||||
|
|
||||||
gPrefs->Write(wxT("/SelectionFormat"), mSelectionFormat.Internal());
|
gPrefs->Write(wxT("/SelectionFormat"), format.Internal());
|
||||||
gPrefs->Flush();
|
gPrefs->Flush();
|
||||||
|
|
||||||
if (SnapSelection())
|
if (SnapSelection())
|
||||||
|
@ -1617,25 +1605,29 @@ void AudacityProject::AS_SetSelectionFormat(const NumericFormatSymbol & format)
|
||||||
double AudacityProject::SSBL_GetRate() const
|
double AudacityProject::SSBL_GetRate() const
|
||||||
{
|
{
|
||||||
auto &project = *this;
|
auto &project = *this;
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
// Return maximum of project rate and all track rates.
|
// Return maximum of project rate and all track rates.
|
||||||
return std::max( mRate,
|
return std::max( settings.GetRate(),
|
||||||
tracks.Any<const WaveTrack>().max( &WaveTrack::GetRate ) );
|
tracks.Any<const WaveTrack>().max( &WaveTrack::GetRate ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
const NumericFormatSymbol & AudacityProject::SSBL_GetFrequencySelectionFormatName()
|
const NumericFormatSymbol & AudacityProject::SSBL_GetFrequencySelectionFormatName()
|
||||||
{
|
{
|
||||||
return GetFrequencySelectionFormatName();
|
auto &project = *this;
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
return settings.GetFrequencySelectionFormatName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::SSBL_SetFrequencySelectionFormatName(const NumericFormatSymbol & formatName)
|
void AudacityProject::SSBL_SetFrequencySelectionFormatName(const NumericFormatSymbol & formatName)
|
||||||
{
|
{
|
||||||
auto &project = *this;
|
auto &project = *this;
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
|
||||||
SetFrequencySelectionFormatName( formatName );
|
settings.SetFrequencySelectionFormatName( formatName );
|
||||||
|
|
||||||
gPrefs->Write(wxT("/FrequencySelectionFormatName"),
|
gPrefs->Write(wxT("/FrequencySelectionFormatName"),
|
||||||
mFrequencySelectionFormatName.Internal());
|
formatName.Internal());
|
||||||
gPrefs->Flush();
|
gPrefs->Flush();
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||||
|
@ -1645,17 +1637,20 @@ void AudacityProject::SSBL_SetFrequencySelectionFormatName(const NumericFormatSy
|
||||||
|
|
||||||
const NumericFormatSymbol & AudacityProject::SSBL_GetBandwidthSelectionFormatName()
|
const NumericFormatSymbol & AudacityProject::SSBL_GetBandwidthSelectionFormatName()
|
||||||
{
|
{
|
||||||
return GetBandwidthSelectionFormatName();
|
auto &project = *this;
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
return settings.GetBandwidthSelectionFormatName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::SSBL_SetBandwidthSelectionFormatName(const NumericFormatSymbol & formatName)
|
void AudacityProject::SSBL_SetBandwidthSelectionFormatName(const NumericFormatSymbol & formatName)
|
||||||
{
|
{
|
||||||
auto &project = *this;
|
auto &project = *this;
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
|
||||||
SetBandwidthSelectionFormatName( formatName );
|
settings.SetBandwidthSelectionFormatName( formatName );
|
||||||
|
|
||||||
gPrefs->Write(wxT("/BandwidthSelectionFormatName"),
|
gPrefs->Write(wxT("/BandwidthSelectionFormatName"),
|
||||||
mBandwidthSelectionFormatName.Internal());
|
formatName.Internal());
|
||||||
gPrefs->Flush();
|
gPrefs->Flush();
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||||
|
@ -1685,32 +1680,32 @@ void AudacityProject::SSBL_ModifySpectralSelection(double &bottom, double &top,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const NumericFormatSymbol & AudacityProject::GetFrequencySelectionFormatName() const
|
const NumericFormatSymbol & ProjectSettings::GetFrequencySelectionFormatName() const
|
||||||
{
|
{
|
||||||
return mFrequencySelectionFormatName;
|
return mFrequencySelectionFormatName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::SetFrequencySelectionFormatName(const NumericFormatSymbol & formatName)
|
void ProjectSettings::SetFrequencySelectionFormatName(const NumericFormatSymbol & formatName)
|
||||||
{
|
{
|
||||||
mFrequencySelectionFormatName = formatName;
|
mFrequencySelectionFormatName = formatName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NumericFormatSymbol & AudacityProject::GetBandwidthSelectionFormatName() const
|
const NumericFormatSymbol & ProjectSettings::GetBandwidthSelectionFormatName() const
|
||||||
{
|
{
|
||||||
return mBandwidthSelectionFormatName;
|
return mBandwidthSelectionFormatName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::SetBandwidthSelectionFormatName(const NumericFormatSymbol & formatName)
|
void ProjectSettings::SetBandwidthSelectionFormatName(const NumericFormatSymbol & formatName)
|
||||||
{
|
{
|
||||||
mBandwidthSelectionFormatName = formatName;
|
mBandwidthSelectionFormatName = formatName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::SetSelectionFormat(const NumericFormatSymbol & format)
|
void ProjectSettings::SetSelectionFormat(const NumericFormatSymbol & format)
|
||||||
{
|
{
|
||||||
mSelectionFormat = format;
|
mSelectionFormat = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NumericFormatSymbol & AudacityProject::GetSelectionFormat() const
|
const NumericFormatSymbol & ProjectSettings::GetSelectionFormat() const
|
||||||
{
|
{
|
||||||
return mSelectionFormat;
|
return mSelectionFormat;
|
||||||
}
|
}
|
||||||
|
@ -2463,6 +2458,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
||||||
{
|
{
|
||||||
auto &project = *this;
|
auto &project = *this;
|
||||||
auto &projectFileIO = project;
|
auto &projectFileIO = project;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &window = project;
|
auto &window = project;
|
||||||
|
|
||||||
|
@ -2510,7 +2506,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
||||||
|
|
||||||
// We may not bother to prompt the user to save, if the
|
// We may not bother to prompt the user to save, if the
|
||||||
// project is now empty.
|
// project is now empty.
|
||||||
if (event.CanVeto() && (mEmptyCanBeDirty || bHasTracks)) {
|
if (event.CanVeto() && (settings.EmptyCanBeDirty() || bHasTracks)) {
|
||||||
if ( UndoManager::Get( project ).UnsavedChanges() ) {
|
if ( UndoManager::Get( project ).UnsavedChanges() ) {
|
||||||
TitleRestorer Restorer( this );// RAII
|
TitleRestorer Restorer( this );// RAII
|
||||||
/* i18n-hint: The first %s numbers the project, the second %s is the project name.*/
|
/* i18n-hint: The first %s numbers the project, the second %s is the project name.*/
|
||||||
|
@ -3136,10 +3132,13 @@ void AudacityProject::OpenFile(const FilePath &fileNameArg, bool addtohistory)
|
||||||
const bool err = results.trackError;
|
const bool err = results.trackError;
|
||||||
|
|
||||||
if (bParseSuccess) {
|
if (bParseSuccess) {
|
||||||
AS_SetSnapTo(GetSnapTo());
|
auto &settings = ProjectSettings::Get( project );
|
||||||
AS_SetSelectionFormat(GetSelectionFormat());
|
AS_SetSnapTo(settings.GetSnapTo());
|
||||||
SSBL_SetFrequencySelectionFormatName(GetFrequencySelectionFormatName());
|
AS_SetSelectionFormat(settings.GetSelectionFormat());
|
||||||
SSBL_SetBandwidthSelectionFormatName(GetBandwidthSelectionFormatName());
|
SSBL_SetFrequencySelectionFormatName(
|
||||||
|
settings.GetFrequencySelectionFormatName());
|
||||||
|
SSBL_SetBandwidthSelectionFormatName(
|
||||||
|
settings.GetBandwidthSelectionFormatName());
|
||||||
|
|
||||||
InitialState();
|
InitialState();
|
||||||
trackPanel.SetFocusedTrack( *tracks.Any().begin() );
|
trackPanel.SetFocusedTrack( *tracks.Any().begin() );
|
||||||
|
@ -3395,6 +3394,7 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
auto &dirManager = DirManager::Get( project );
|
auto &dirManager = DirManager::Get( project );
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
bool bFileVersionFound = false;
|
bool bFileVersionFound = false;
|
||||||
wxString fileVersion = _("<unrecognized version -- possibly corrupt project file>");
|
wxString fileVersion = _("<unrecognized version -- possibly corrupt project file>");
|
||||||
wxString audacityVersion = _("<unrecognized version -- possibly corrupt project file>");
|
wxString audacityVersion = _("<unrecognized version -- possibly corrupt project file>");
|
||||||
|
@ -3511,24 +3511,26 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!wxStrcmp(attr, wxT("rate"))) {
|
else if (!wxStrcmp(attr, wxT("rate"))) {
|
||||||
Internat::CompatibleToDouble(value, &mRate);
|
double rate;
|
||||||
SelectionBar::Get( project ).SetRate( mRate );
|
Internat::CompatibleToDouble(value, &rate);
|
||||||
|
settings.SetRate( rate );
|
||||||
|
SelectionBar::Get( project ).SetRate( rate );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!wxStrcmp(attr, wxT("snapto"))) {
|
else if (!wxStrcmp(attr, wxT("snapto"))) {
|
||||||
SetSnapTo(wxString(value) == wxT("on") ? true : false);
|
settings.SetSnapTo(wxString(value) == wxT("on") ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!wxStrcmp(attr, wxT("selectionformat")))
|
else if (!wxStrcmp(attr, wxT("selectionformat")))
|
||||||
SetSelectionFormat(
|
settings.SetSelectionFormat(
|
||||||
NumericConverter::LookupFormat( NumericConverter::TIME, value) );
|
NumericConverter::LookupFormat( NumericConverter::TIME, value) );
|
||||||
|
|
||||||
else if (!wxStrcmp(attr, wxT("frequencyformat")))
|
else if (!wxStrcmp(attr, wxT("frequencyformat")))
|
||||||
SetFrequencySelectionFormatName(
|
settings.SetFrequencySelectionFormatName(
|
||||||
NumericConverter::LookupFormat( NumericConverter::FREQUENCY, value ) );
|
NumericConverter::LookupFormat( NumericConverter::FREQUENCY, value ) );
|
||||||
|
|
||||||
else if (!wxStrcmp(attr, wxT("bandwidthformat")))
|
else if (!wxStrcmp(attr, wxT("bandwidthformat")))
|
||||||
SetBandwidthSelectionFormatName(
|
settings.SetBandwidthSelectionFormatName(
|
||||||
NumericConverter::LookupFormat( NumericConverter::BANDWIDTH, value ) );
|
NumericConverter::LookupFormat( NumericConverter::BANDWIDTH, value ) );
|
||||||
} // while
|
} // while
|
||||||
|
|
||||||
|
@ -3645,6 +3647,7 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile, bool bWantSaveCopy)
|
||||||
auto &viewInfo = ViewInfo::Get( proj );
|
auto &viewInfo = ViewInfo::Get( proj );
|
||||||
auto &dirManager = DirManager::Get( proj );
|
auto &dirManager = DirManager::Get( proj );
|
||||||
auto &tags = Tags::Get( proj );
|
auto &tags = Tags::Get( proj );
|
||||||
|
const auto &settings = ProjectSettings::Get( proj );
|
||||||
|
|
||||||
//TIMER_START( "AudacityProject::WriteXML", xml_writer_timer );
|
//TIMER_START( "AudacityProject::WriteXML", xml_writer_timer );
|
||||||
// Warning: This block of code is duplicated in Save, for now...
|
// Warning: This block of code is duplicated in Save, for now...
|
||||||
|
@ -3680,14 +3683,14 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile, bool bWantSaveCopy)
|
||||||
xmlFile.WriteAttr(wxT("audacityversion"), AUDACITY_VERSION_STRING);
|
xmlFile.WriteAttr(wxT("audacityversion"), AUDACITY_VERSION_STRING);
|
||||||
|
|
||||||
viewInfo.WriteXMLAttributes(xmlFile);
|
viewInfo.WriteXMLAttributes(xmlFile);
|
||||||
xmlFile.WriteAttr(wxT("rate"), mRate);
|
xmlFile.WriteAttr(wxT("rate"), settings.GetRate());
|
||||||
xmlFile.WriteAttr(wxT("snapto"), GetSnapTo() ? wxT("on") : wxT("off"));
|
xmlFile.WriteAttr(wxT("snapto"), settings.GetSnapTo() ? wxT("on") : wxT("off"));
|
||||||
xmlFile.WriteAttr(wxT("selectionformat"),
|
xmlFile.WriteAttr(wxT("selectionformat"),
|
||||||
GetSelectionFormat().Internal());
|
settings.GetSelectionFormat().Internal());
|
||||||
xmlFile.WriteAttr(wxT("frequencyformat"),
|
xmlFile.WriteAttr(wxT("frequencyformat"),
|
||||||
GetFrequencySelectionFormatName().Internal());
|
settings.GetFrequencySelectionFormatName().Internal());
|
||||||
xmlFile.WriteAttr(wxT("bandwidthformat"),
|
xmlFile.WriteAttr(wxT("bandwidthformat"),
|
||||||
GetBandwidthSelectionFormatName().Internal());
|
settings.GetBandwidthSelectionFormatName().Internal());
|
||||||
|
|
||||||
tags.WriteXML(xmlFile);
|
tags.WriteXML(xmlFile);
|
||||||
|
|
||||||
|
@ -3796,6 +3799,7 @@ bool AudacityProject::DoSave (const bool fromSaveAs,
|
||||||
auto &proj = *this;
|
auto &proj = *this;
|
||||||
auto &window = GetProjectFrame( proj );
|
auto &window = GetProjectFrame( proj );
|
||||||
auto &dirManager = DirManager::Get( proj );
|
auto &dirManager = DirManager::Get( proj );
|
||||||
|
const auto &settings = ProjectSettings::Get( proj );
|
||||||
|
|
||||||
wxASSERT_MSG(!bWantSaveCopy || fromSaveAs, "Copy Project SHOULD only be availabele from SaveAs");
|
wxASSERT_MSG(!bWantSaveCopy || fromSaveAs, "Copy Project SHOULD only be availabele from SaveAs");
|
||||||
|
|
||||||
|
@ -3806,7 +3810,8 @@ bool AudacityProject::DoSave (const bool fromSaveAs,
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
if ( ! tracks.Any() )
|
if ( ! tracks.Any() )
|
||||||
{
|
{
|
||||||
if ( UndoManager::Get( proj ).UnsavedChanges() && mEmptyCanBeDirty) {
|
if ( UndoManager::Get( proj ).UnsavedChanges()
|
||||||
|
&& settings.EmptyCanBeDirty()) {
|
||||||
int result = AudacityMessageBox(_("Your project is now empty.\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nClick 'No', Edit > Undo until all tracks\nare open, then File > Save Project.\n\nSave anyway?"),
|
int result = AudacityMessageBox(_("Your project is now empty.\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nClick 'No', Edit > Undo until all tracks\nare open, then File > Save Project.\n\nSave anyway?"),
|
||||||
_("Warning - Empty Project"),
|
_("Warning - Empty Project"),
|
||||||
wxYES_NO | wxICON_QUESTION, this);
|
wxYES_NO | wxICON_QUESTION, this);
|
||||||
|
@ -4232,7 +4237,8 @@ AudacityProject::AddImportedTracks(const FilePath &fileName,
|
||||||
// Automatically assign rate of imported file to whole project,
|
// Automatically assign rate of imported file to whole project,
|
||||||
// if this is the first file that is imported
|
// if this is the first file that is imported
|
||||||
if (initiallyEmpty && newRate > 0) {
|
if (initiallyEmpty && newRate > 0) {
|
||||||
mRate = newRate;
|
auto &settings = ProjectSettings::Get( project );
|
||||||
|
settings.SetRate( newRate );
|
||||||
SelectionBar::Get( project ).SetRate( newRate );
|
SelectionBar::Get( project ).SetRate( newRate );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4630,6 +4636,7 @@ void AudacityProject::PushState(const wxString &desc,
|
||||||
UndoPush flags )
|
UndoPush flags )
|
||||||
{
|
{
|
||||||
auto &project = *this;
|
auto &project = *this;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
auto &undoManager = UndoManager::Get( project );
|
auto &undoManager = UndoManager::Get( project );
|
||||||
|
@ -4644,8 +4651,8 @@ void AudacityProject::PushState(const wxString &desc,
|
||||||
menuManager.ModifyUndoMenuItems( project );
|
menuManager.ModifyUndoMenuItems( project );
|
||||||
menuManager.UpdateMenus( project );
|
menuManager.UpdateMenus( project );
|
||||||
|
|
||||||
if (GetTracksFitVerticallyZoomed())
|
if (settings.GetTracksFitVerticallyZoomed())
|
||||||
ViewActions::DoZoomFitV(*this);
|
ViewActions::DoZoomFitV( project );
|
||||||
if((flags & UndoPush::AUTOSAVE) != UndoPush::MINIMAL)
|
if((flags & UndoPush::AUTOSAVE) != UndoPush::MINIMAL)
|
||||||
AutoSave();
|
AutoSave();
|
||||||
|
|
||||||
|
@ -5188,17 +5195,17 @@ void AudacityProject::OnAudioIONewBlockFiles(const AutoSaveFile & blockFileLog)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::SetSnapTo(int snap)
|
void ProjectSettings::SetSnapTo(int snap)
|
||||||
{
|
{
|
||||||
mSnapTo = snap;
|
mSnapTo = snap;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudacityProject::GetSnapTo() const
|
int ProjectSettings::GetSnapTo() const
|
||||||
{
|
{
|
||||||
return mSnapTo;
|
return mSnapTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudacityProject::IsSyncLocked()
|
bool ProjectSettings::IsSyncLocked() const
|
||||||
{
|
{
|
||||||
#ifdef EXPERIMENTAL_SYNC_LOCK
|
#ifdef EXPERIMENTAL_SYNC_LOCK
|
||||||
return mIsSyncLocked;
|
return mIsSyncLocked;
|
||||||
|
@ -5207,9 +5214,9 @@ bool AudacityProject::IsSyncLocked()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::SetSyncLock(bool flag)
|
void ProjectSettings::SetSyncLock(bool flag)
|
||||||
{
|
{
|
||||||
auto &project = *this;
|
auto &project = mProject;
|
||||||
if (flag != mIsSyncLocked) {
|
if (flag != mIsSyncLocked) {
|
||||||
mIsSyncLocked = flag;
|
mIsSyncLocked = flag;
|
||||||
TrackPanel::Get( project ).Refresh(false);
|
TrackPanel::Get( project ).Refresh(false);
|
||||||
|
@ -5350,7 +5357,7 @@ int AudacityProject::GetEstimatedRecordingMinsLeftOnDisk(long lCaptureChannels)
|
||||||
dRecTime = lFreeSpace.GetHi() * 4294967296.0 + lFreeSpace.GetLo();
|
dRecTime = lFreeSpace.GetHi() * 4294967296.0 + lFreeSpace.GetLo();
|
||||||
dRecTime /= bytesOnDiskPerSample;
|
dRecTime /= bytesOnDiskPerSample;
|
||||||
dRecTime /= lCaptureChannels;
|
dRecTime /= lCaptureChannels;
|
||||||
dRecTime /= GetRate();
|
dRecTime /= ProjectSettings::Get( project ).GetRate();
|
||||||
|
|
||||||
// Convert to minutes before returning
|
// Convert to minutes before returning
|
||||||
int iRecMins = (int)round(dRecTime / 60.0);
|
int iRecMins = (int)round(dRecTime / 60.0);
|
||||||
|
@ -5530,3 +5537,51 @@ void AudacityProject::CloseLock()
|
||||||
mLastSavedTracks.reset();
|
mLastSavedTracks.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const AudacityProject::AttachedObjects::RegisteredFactory sProjectSettingsKey{
|
||||||
|
[]( AudacityProject &project ){
|
||||||
|
auto result = std::make_shared< ProjectSettings >( project );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ProjectSettings &ProjectSettings::Get( AudacityProject &project )
|
||||||
|
{
|
||||||
|
return project.AttachedObjects::Get< ProjectSettings >( sProjectSettingsKey );
|
||||||
|
}
|
||||||
|
|
||||||
|
const ProjectSettings &ProjectSettings::Get( const AudacityProject &project )
|
||||||
|
{
|
||||||
|
return Get( const_cast< AudacityProject & >( project ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectSettings::ProjectSettings( AudacityProject &project )
|
||||||
|
: mProject{ project }
|
||||||
|
, mSelectionFormat{ NumericTextCtrl::LookupFormat(
|
||||||
|
NumericConverter::TIME,
|
||||||
|
gPrefs->Read(wxT("/SelectionFormat"), wxT("")) )
|
||||||
|
}
|
||||||
|
, mFrequencySelectionFormatName{ NumericTextCtrl::LookupFormat(
|
||||||
|
NumericConverter::FREQUENCY,
|
||||||
|
gPrefs->Read(wxT("/FrequencySelectionFormatName"), wxT("")) )
|
||||||
|
}
|
||||||
|
, mBandwidthSelectionFormatName{ NumericTextCtrl::LookupFormat(
|
||||||
|
NumericConverter::BANDWIDTH,
|
||||||
|
gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) )
|
||||||
|
}
|
||||||
|
, mDefaultFormat{ QualityPrefs::SampleFormatChoice() }
|
||||||
|
, mSnapTo( gPrefs->Read(wxT("/SnapTo"), SNAP_OFF) )
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &mIsSyncLocked, false);
|
||||||
|
|
||||||
|
UpdatePrefs();
|
||||||
|
}
|
||||||
|
|
133
src/Project.h
133
src/Project.h
|
@ -194,10 +194,6 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
|
||||||
|
|
||||||
virtual void ApplyUpdatedTheme();
|
virtual void ApplyUpdatedTheme();
|
||||||
|
|
||||||
sampleFormat GetDefaultFormat() { return mDefaultFormat; }
|
|
||||||
|
|
||||||
double GetRate() const { return mRate; }
|
|
||||||
|
|
||||||
void GetPlayRegion(double* playRegionStart, double *playRegionEnd);
|
void GetPlayRegion(double* playRegionStart, double *playRegionEnd);
|
||||||
bool IsPlayRegionLocked() { return mLockPlayRegion; }
|
bool IsPlayRegionLocked() { return mLockPlayRegion; }
|
||||||
void SetPlayRegionLocked(bool value) { mLockPlayRegion = value; }
|
void SetPlayRegionLocked(bool value) { mLockPlayRegion = value; }
|
||||||
|
@ -298,15 +294,6 @@ public:
|
||||||
wxWindow *GetMainPage() { return mMainPage; }
|
wxWindow *GetMainPage() { return mMainPage; }
|
||||||
wxPanel *GetTopPanel() { return mTopPanel; }
|
wxPanel *GetTopPanel() { return mTopPanel; }
|
||||||
|
|
||||||
bool GetTracksFitVerticallyZoomed() { return mTracksFitVerticallyZoomed; } //lda
|
|
||||||
void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda
|
|
||||||
|
|
||||||
bool GetShowId3Dialog() { return mShowId3Dialog; } //lda
|
|
||||||
void SetShowId3Dialog(bool flag) { mShowId3Dialog = flag; } //lda
|
|
||||||
|
|
||||||
bool GetNormalizeOnLoad() { return mNormalizeOnLoad; } //lda
|
|
||||||
void SetNormalizeOnLoad(bool flag) { mNormalizeOnLoad = flag; } //lda
|
|
||||||
|
|
||||||
// Timer Record Auto Save/Export Routines
|
// Timer Record Auto Save/Export Routines
|
||||||
bool SaveFromTimerRecording(wxFileName fnFile);
|
bool SaveFromTimerRecording(wxFileName fnFile);
|
||||||
bool IsProjectSaved();
|
bool IsProjectSaved();
|
||||||
|
@ -348,7 +335,6 @@ public:
|
||||||
|
|
||||||
int GetProjectNumber(){ return mProjectNo;};
|
int GetProjectNumber(){ return mProjectNo;};
|
||||||
void UpdatePrefs() override;
|
void UpdatePrefs() override;
|
||||||
void UpdatePrefsVariables();
|
|
||||||
void RedrawProject(const bool bForceWaveTracks = false);
|
void RedrawProject(const bool bForceWaveTracks = false);
|
||||||
void RefreshCursor();
|
void RefreshCursor();
|
||||||
void Zoom(double level);
|
void Zoom(double level);
|
||||||
|
@ -357,27 +343,6 @@ public:
|
||||||
void SkipEnd(bool shift);
|
void SkipEnd(bool shift);
|
||||||
|
|
||||||
|
|
||||||
bool IsSyncLocked();
|
|
||||||
void SetSyncLock(bool flag);
|
|
||||||
|
|
||||||
// Snap To
|
|
||||||
|
|
||||||
void SetSnapTo(int snap);
|
|
||||||
int GetSnapTo() const;
|
|
||||||
|
|
||||||
// Selection Format
|
|
||||||
|
|
||||||
void SetSelectionFormat(const NumericFormatSymbol & format);
|
|
||||||
const NumericFormatSymbol & GetSelectionFormat() const;
|
|
||||||
|
|
||||||
// Spectral Selection Formats
|
|
||||||
|
|
||||||
void SetFrequencySelectionFormatName(const NumericFormatSymbol & format);
|
|
||||||
const NumericFormatSymbol & GetFrequencySelectionFormatName() const;
|
|
||||||
|
|
||||||
void SetBandwidthSelectionFormatName(const NumericFormatSymbol & format);
|
|
||||||
const NumericFormatSymbol & GetBandwidthSelectionFormatName() const;
|
|
||||||
|
|
||||||
// Scrollbars
|
// Scrollbars
|
||||||
|
|
||||||
void OnScrollLeft();
|
void OnScrollLeft();
|
||||||
|
@ -481,10 +446,6 @@ public:
|
||||||
void AutoSave();
|
void AutoSave();
|
||||||
void DeleteCurrentAutoSaveFile();
|
void DeleteCurrentAutoSaveFile();
|
||||||
|
|
||||||
public:
|
|
||||||
bool IsSoloSimple() const { return mSoloPref == wxT("Simple"); }
|
|
||||||
bool IsSoloNone() const { return mSoloPref == wxT("None"); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// The project's name and file info
|
// The project's name and file info
|
||||||
|
@ -494,14 +455,6 @@ public:
|
||||||
static int mProjectCounter;// global counter.
|
static int mProjectCounter;// global counter.
|
||||||
int mProjectNo; // count when this project was created.
|
int mProjectNo; // count when this project was created.
|
||||||
|
|
||||||
double mRate;
|
|
||||||
sampleFormat mDefaultFormat;
|
|
||||||
|
|
||||||
int mSnapTo;
|
|
||||||
NumericFormatSymbol mSelectionFormat;
|
|
||||||
NumericFormatSymbol mFrequencySelectionFormatName;
|
|
||||||
NumericFormatSymbol mBandwidthSelectionFormatName;
|
|
||||||
|
|
||||||
std::shared_ptr<TrackList> mLastSavedTracks;
|
std::shared_ptr<TrackList> mLastSavedTracks;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -536,8 +489,6 @@ private:
|
||||||
MeterPanel *mCaptureMeter{};
|
MeterPanel *mCaptureMeter{};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool mShowSplashScreen;
|
|
||||||
wxString mSoloPref;
|
|
||||||
bool mbBusyImporting{ false }; // used to fix bug 584
|
bool mbBusyImporting{ false }; // used to fix bug 584
|
||||||
int mBatchMode{ 0 };// 0 means not, >0 means in batch mode.
|
int mBatchMode{ 0 };// 0 means not, >0 means in batch mode.
|
||||||
|
|
||||||
|
@ -552,19 +503,12 @@ private:
|
||||||
int mAudioIOToken{ -1 };
|
int mAudioIOToken{ -1 };
|
||||||
|
|
||||||
bool mIsDeleting{ false };
|
bool mIsDeleting{ false };
|
||||||
bool mTracksFitVerticallyZoomed{ false }; //lda
|
|
||||||
bool mNormalizeOnLoad; //lda
|
|
||||||
bool mShowId3Dialog{ true }; //lda
|
|
||||||
bool mEmptyCanBeDirty;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool EmptyCanBeDirty() const { return mEmptyCanBeDirty; }
|
|
||||||
bool IsBeingDeleted() const { return mIsDeleting; }
|
bool IsBeingDeleted() const { return mIsDeleting; }
|
||||||
void SetIsBeingDeleted() { mIsDeleting = true; }
|
void SetIsBeingDeleted() { mIsDeleting = true; }
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool mIsSyncLocked;
|
|
||||||
|
|
||||||
bool mLockPlayRegion;
|
bool mLockPlayRegion;
|
||||||
|
|
||||||
std::unique_ptr<ImportXMLTagHandler> mImportXMLTagHandler;
|
std::unique_ptr<ImportXMLTagHandler> mImportXMLTagHandler;
|
||||||
|
@ -655,8 +599,83 @@ inline const wxFrame *FindProjectFrame( const AudacityProject *project ) {
|
||||||
return project ? &GetProjectFrame( *project ) : nullptr;
|
return project ? &GetProjectFrame( *project ) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ProjectSettings final
|
||||||
|
: public ClientData::Base
|
||||||
|
, private PrefsListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static ProjectSettings &Get( AudacityProject &project );
|
||||||
|
static const ProjectSettings &Get( const AudacityProject &project );
|
||||||
|
|
||||||
|
ProjectSettings( AudacityProject &project );
|
||||||
|
|
||||||
|
sampleFormat GetDefaultFormat() const { return mDefaultFormat; }
|
||||||
|
|
||||||
|
double GetRate() const { return mRate; }
|
||||||
|
void SetRate( double value ) { mRate = value; }
|
||||||
|
|
||||||
|
bool GetTracksFitVerticallyZoomed() const { return mTracksFitVerticallyZoomed; } //lda
|
||||||
|
void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda
|
||||||
|
|
||||||
|
bool GetShowId3Dialog() const { return mShowId3Dialog; } //lda
|
||||||
|
void SetShowId3Dialog(bool flag) { mShowId3Dialog = flag; } //lda
|
||||||
|
|
||||||
|
bool GetNormalizeOnLoad() const { return mNormalizeOnLoad; } //lda
|
||||||
|
void SetNormalizeOnLoad(bool flag) { mNormalizeOnLoad = flag; } //lda
|
||||||
|
|
||||||
|
bool IsSyncLocked() const;
|
||||||
|
void SetSyncLock(bool flag);
|
||||||
|
|
||||||
|
// Snap To
|
||||||
|
|
||||||
|
void SetSnapTo(int snap);
|
||||||
|
int GetSnapTo() const;
|
||||||
|
|
||||||
|
// Selection Format
|
||||||
|
|
||||||
|
void SetSelectionFormat(const NumericFormatSymbol & format);
|
||||||
|
const NumericFormatSymbol & GetSelectionFormat() const;
|
||||||
|
|
||||||
|
// Spectral Selection Formats
|
||||||
|
|
||||||
|
void SetFrequencySelectionFormatName(const NumericFormatSymbol & format);
|
||||||
|
const NumericFormatSymbol & GetFrequencySelectionFormatName() const;
|
||||||
|
|
||||||
|
void SetBandwidthSelectionFormatName(const NumericFormatSymbol & format);
|
||||||
|
const NumericFormatSymbol & GetBandwidthSelectionFormatName() const;
|
||||||
|
|
||||||
|
bool IsSoloSimple() const { return mSoloPref == wxT("Simple"); }
|
||||||
|
bool IsSoloNone() const { return mSoloPref == wxT("None"); }
|
||||||
|
|
||||||
|
bool EmptyCanBeDirty() const { return mEmptyCanBeDirty; }
|
||||||
|
|
||||||
|
bool GetShowSplashScreen() const { return mShowSplashScreen; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void UpdatePrefs() override;
|
||||||
|
|
||||||
|
AudacityProject &mProject;
|
||||||
|
|
||||||
|
NumericFormatSymbol mSelectionFormat;
|
||||||
|
NumericFormatSymbol mFrequencySelectionFormatName;
|
||||||
|
NumericFormatSymbol mBandwidthSelectionFormatName;
|
||||||
|
|
||||||
|
wxString mSoloPref;
|
||||||
|
|
||||||
|
double mRate;
|
||||||
|
|
||||||
|
sampleFormat mDefaultFormat;
|
||||||
|
int mSnapTo;
|
||||||
|
|
||||||
|
bool mTracksFitVerticallyZoomed{ false }; //lda
|
||||||
|
bool mShowId3Dialog{ true }; //lda
|
||||||
|
bool mNormalizeOnLoad; //lda
|
||||||
|
bool mIsSyncLocked{ false };
|
||||||
|
bool mEmptyCanBeDirty;
|
||||||
|
bool mShowSplashScreen;
|
||||||
|
};
|
||||||
|
|
||||||
AudioIOStartStreamOptions DefaultPlayOptions( AudacityProject &project );
|
AudioIOStartStreamOptions DefaultPlayOptions( AudacityProject &project );
|
||||||
AudioIOStartStreamOptions DefaultSpeedPlayOptions( AudacityProject &project );
|
AudioIOStartStreamOptions DefaultSpeedPlayOptions( AudacityProject &project );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
12
src/Snap.cpp
12
src/Snap.cpp
|
@ -72,9 +72,10 @@ SnapManager::~SnapManager()
|
||||||
|
|
||||||
void SnapManager::Reinit()
|
void SnapManager::Reinit()
|
||||||
{
|
{
|
||||||
int snapTo = mProject->GetSnapTo();
|
const auto &settings = ProjectSettings::Get( *mProject );
|
||||||
double rate = mProject->GetRate();
|
int snapTo = settings.GetSnapTo();
|
||||||
auto format = mProject->GetSelectionFormat();
|
double rate = settings.GetRate();
|
||||||
|
auto format = settings.GetSelectionFormat();
|
||||||
|
|
||||||
// No need to reinit if these are still the same
|
// No need to reinit if these are still the same
|
||||||
if (snapTo == mSnapTo && rate == mRate && format == mFormat)
|
if (snapTo == mSnapTo && rate == mRate && format == mFormat)
|
||||||
|
@ -329,7 +330,10 @@ SnapResults SnapManager::Snap
|
||||||
|
|
||||||
if (mSnapToTime) {
|
if (mSnapToTime) {
|
||||||
// Find where it would snap time to the grid
|
// Find where it would snap time to the grid
|
||||||
mConverter.ValueToControls(t, GetActiveProject()->GetSnapTo() == SNAP_NEAREST);
|
mConverter.ValueToControls(
|
||||||
|
t,
|
||||||
|
ProjectSettings::Get( *GetActiveProject() ).GetSnapTo() == SNAP_NEAREST
|
||||||
|
);
|
||||||
mConverter.ControlsToValue();
|
mConverter.ControlsToValue();
|
||||||
results.timeSnappedTime = mConverter.GetValue();
|
results.timeSnappedTime = mConverter.GetValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,14 +125,14 @@ Track::Holder TimeTrack::Copy( double t0, double t1, bool ) const
|
||||||
|
|
||||||
void TimeTrack::Clear(double t0, double t1)
|
void TimeTrack::Clear(double t0, double t1)
|
||||||
{
|
{
|
||||||
auto sampleTime = 1.0 / GetActiveProject()->GetRate();
|
auto sampleTime = 1.0 / ProjectSettings::Get( *GetActiveProject() ).GetRate();
|
||||||
mEnvelope->CollapseRegion( t0, t1, sampleTime );
|
mEnvelope->CollapseRegion( t0, t1, sampleTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeTrack::Paste(double t, const Track * src)
|
void TimeTrack::Paste(double t, const Track * src)
|
||||||
{
|
{
|
||||||
bool bOk = src && src->TypeSwitch< bool >( [&] (const TimeTrack *tt) {
|
bool bOk = src && src->TypeSwitch< bool >( [&] (const TimeTrack *tt) {
|
||||||
auto sampleTime = 1.0 / GetActiveProject()->GetRate();
|
auto sampleTime = 1.0 / ProjectSettings::Get( *GetActiveProject() ).GetRate();
|
||||||
mEnvelope->PasteEnvelope
|
mEnvelope->PasteEnvelope
|
||||||
(t, tt->mEnvelope.get(), sampleTime);
|
(t, tt->mEnvelope.get(), sampleTime);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -323,7 +323,7 @@ bool Track::IsSyncLockSelected() const
|
||||||
{
|
{
|
||||||
#ifdef EXPERIMENTAL_SYNC_LOCK
|
#ifdef EXPERIMENTAL_SYNC_LOCK
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = GetActiveProject();
|
||||||
if (!p || !p->IsSyncLocked())
|
if (!p || !ProjectSettings::Get( *p ).IsSyncLocked())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto pList = mList.lock();
|
auto pList = mList.lock();
|
||||||
|
|
|
@ -93,13 +93,16 @@ WaveTrack::Holder TrackFactory::NewWaveTrack(sampleFormat format, double rate)
|
||||||
WaveTrack::WaveTrack(const std::shared_ptr<DirManager> &projDirManager, sampleFormat format, double rate) :
|
WaveTrack::WaveTrack(const std::shared_ptr<DirManager> &projDirManager, sampleFormat format, double rate) :
|
||||||
PlayableTrack(projDirManager)
|
PlayableTrack(projDirManager)
|
||||||
{
|
{
|
||||||
if (format == (sampleFormat)0)
|
|
||||||
{
|
{
|
||||||
format = GetActiveProject()->GetDefaultFormat();
|
const auto settings = ProjectSettings::Get( *GetActiveProject() );
|
||||||
}
|
if (format == (sampleFormat)0)
|
||||||
if (rate == 0)
|
{
|
||||||
{
|
format = settings.GetDefaultFormat();
|
||||||
rate = GetActiveProject()->GetRate();
|
}
|
||||||
|
if (rate == 0)
|
||||||
|
{
|
||||||
|
rate = settings.GetRate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force creation always:
|
// Force creation always:
|
||||||
|
|
|
@ -194,7 +194,8 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
|
||||||
wxString number;
|
wxString number;
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = GetActiveProject();
|
||||||
mProjectRate = p->GetRate();
|
const auto &settings = ProjectSettings::Get( *p );
|
||||||
|
mProjectRate = settings.GetRate();
|
||||||
|
|
||||||
ShuttleGui S(this, eIsCreating);
|
ShuttleGui S(this, eIsCreating);
|
||||||
|
|
||||||
|
|
|
@ -163,8 +163,7 @@ Effect::Effect()
|
||||||
mUIDebug = false;
|
mUIDebug = false;
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = GetActiveProject();
|
||||||
mProjectRate = p ? p->GetRate() : 44100;
|
mProjectRate = p ? ProjectSettings::Get( *p ).GetRate() : 44100;
|
||||||
|
|
||||||
mIsBatch = false;
|
mIsBatch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,7 +769,7 @@ NumericFormatSymbol Effect::GetDurationFormat()
|
||||||
|
|
||||||
NumericFormatSymbol Effect::GetSelectionFormat()
|
NumericFormatSymbol Effect::GetSelectionFormat()
|
||||||
{
|
{
|
||||||
return GetActiveProject()->GetSelectionFormat();
|
return ProjectSettings( *GetActiveProject() ).GetSelectionFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effect::SetDuration(double seconds)
|
void Effect::SetDuration(double seconds)
|
||||||
|
|
|
@ -620,7 +620,11 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
|
||||||
LoadCurves();
|
LoadCurves();
|
||||||
|
|
||||||
const auto t = *inputTracks()->Any< const WaveTrack >().first;
|
const auto t = *inputTracks()->Any< const WaveTrack >().first;
|
||||||
mHiFreq = (t ? t->GetRate() : GetActiveProject()->GetRate()) / 2.0;
|
mHiFreq =
|
||||||
|
(t
|
||||||
|
? t->GetRate()
|
||||||
|
: ProjectSettings::Get( *GetActiveProject() ).GetRate())
|
||||||
|
/ 2.0;
|
||||||
mLoFreq = loFreqI;
|
mLoFreq = loFreqI;
|
||||||
|
|
||||||
S.SetBorder(0);
|
S.SetBorder(0);
|
||||||
|
|
|
@ -346,7 +346,11 @@ bool EffectScienFilter::Init()
|
||||||
|
|
||||||
{
|
{
|
||||||
auto t = *trackRange.begin();
|
auto t = *trackRange.begin();
|
||||||
mNyquist = (t ? t->GetRate() : GetActiveProject()->GetRate()) / 2.0;
|
mNyquist =
|
||||||
|
(t
|
||||||
|
? t->GetRate()
|
||||||
|
: ProjectSettings::Get( *GetActiveProject() ).GetRate())
|
||||||
|
/ 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto t : trackRange)
|
for (auto t : trackRange)
|
||||||
|
|
|
@ -321,7 +321,11 @@ bool EffectToneGen::SetAutomationParameters(CommandParameters & parms)
|
||||||
mWaveform = Waveform;
|
mWaveform = Waveform;
|
||||||
mInterpolation = Interp;
|
mInterpolation = Interp;
|
||||||
|
|
||||||
double freqMax = (GetActiveProject() ? GetActiveProject()->GetRate() : 44100.0) / 2.0;
|
double freqMax =
|
||||||
|
(GetActiveProject()
|
||||||
|
? ProjectSettings::Get( *GetActiveProject() ).GetRate()
|
||||||
|
: 44100.0)
|
||||||
|
/ 2.0;
|
||||||
mFrequency[1] = TrapDouble(mFrequency[1], MIN_EndFreq, freqMax);
|
mFrequency[1] = TrapDouble(mFrequency[1], MIN_EndFreq, freqMax);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -364,7 +368,10 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S)
|
||||||
S.StartHorizontalLay(wxLEFT, 50);
|
S.StartHorizontalLay(wxLEFT, 50);
|
||||||
{
|
{
|
||||||
FloatingPointValidator<double> vldStartFreq(6, &mFrequency[0], NumValidatorStyle::NO_TRAILING_ZEROES);
|
FloatingPointValidator<double> vldStartFreq(6, &mFrequency[0], NumValidatorStyle::NO_TRAILING_ZEROES);
|
||||||
vldStartFreq.SetRange(MIN_StartFreq, GetActiveProject()->GetRate() / 2.0);
|
vldStartFreq.SetRange(
|
||||||
|
MIN_StartFreq,
|
||||||
|
ProjectSettings::Get( *GetActiveProject() ).GetRate() / 2.0
|
||||||
|
);
|
||||||
t = S.AddTextBox( {}, wxT(""), 12);
|
t = S.AddTextBox( {}, wxT(""), 12);
|
||||||
t->SetName(_("Frequency Hertz Start"));
|
t->SetName(_("Frequency Hertz Start"));
|
||||||
t->SetValidator(vldStartFreq);
|
t->SetValidator(vldStartFreq);
|
||||||
|
@ -374,7 +381,10 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S)
|
||||||
S.StartHorizontalLay(wxLEFT, 50);
|
S.StartHorizontalLay(wxLEFT, 50);
|
||||||
{
|
{
|
||||||
FloatingPointValidator<double> vldEndFreq(6, &mFrequency[1], NumValidatorStyle::NO_TRAILING_ZEROES);
|
FloatingPointValidator<double> vldEndFreq(6, &mFrequency[1], NumValidatorStyle::NO_TRAILING_ZEROES);
|
||||||
vldEndFreq.SetRange(MIN_EndFreq, GetActiveProject()->GetRate() / 2.0);
|
vldEndFreq.SetRange(
|
||||||
|
MIN_EndFreq,
|
||||||
|
ProjectSettings::Get( *GetActiveProject() ).GetRate() / 2.0
|
||||||
|
);
|
||||||
t = S.AddTextBox( {}, wxT(""), 12);
|
t = S.AddTextBox( {}, wxT(""), 12);
|
||||||
t->SetName(_("Frequency Hertz End"));
|
t->SetName(_("Frequency Hertz End"));
|
||||||
t->SetValidator(vldEndFreq);
|
t->SetValidator(vldEndFreq);
|
||||||
|
@ -415,7 +425,10 @@ void EffectToneGen::PopulateOrExchange(ShuttleGui & S)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FloatingPointValidator<double> vldFrequency(6, &mFrequency[0], NumValidatorStyle::NO_TRAILING_ZEROES);
|
FloatingPointValidator<double> vldFrequency(6, &mFrequency[0], NumValidatorStyle::NO_TRAILING_ZEROES);
|
||||||
vldFrequency.SetRange(MIN_Frequency, GetActiveProject()->GetRate() / 2.0);
|
vldFrequency.SetRange(
|
||||||
|
MIN_Frequency,
|
||||||
|
ProjectSettings::Get( *GetActiveProject() ).GetRate() / 2.0
|
||||||
|
);
|
||||||
t = S.AddTextBox(_("Frequency (Hz):"), wxT(""), 12);
|
t = S.AddTextBox(_("Frequency (Hz):"), wxT(""), 12);
|
||||||
t->SetValidator(vldFrequency);
|
t->SetValidator(vldFrequency);
|
||||||
|
|
||||||
|
|
|
@ -328,7 +328,8 @@ bool EffectTruncSilence::ProcessIndependently()
|
||||||
{
|
{
|
||||||
unsigned nGroups = 0;
|
unsigned nGroups = 0;
|
||||||
|
|
||||||
const bool syncLock = ::GetActiveProject()->IsSyncLocked();
|
const auto &settings = ProjectSettings::Get( *::GetActiveProject() );
|
||||||
|
const bool syncLock = settings.IsSyncLocked();
|
||||||
|
|
||||||
// Check if it's permissible
|
// Check if it's permissible
|
||||||
{
|
{
|
||||||
|
|
|
@ -738,7 +738,7 @@ bool NyquistEffect::Process()
|
||||||
// numbers to Nyquist, whereas using "%g" will use the user's
|
// numbers to Nyquist, whereas using "%g" will use the user's
|
||||||
// decimal separator which may be a comma in some countries.
|
// decimal separator which may be a comma in some countries.
|
||||||
mProps += wxString::Format(wxT("(putprop '*PROJECT* (float %s) 'RATE)\n"),
|
mProps += wxString::Format(wxT("(putprop '*PROJECT* (float %s) 'RATE)\n"),
|
||||||
Internat::ToString(project->GetRate()));
|
Internat::ToString(ProjectSettings::Get(*project).GetRate()));
|
||||||
mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'TRACKS)\n"), numTracks);
|
mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'TRACKS)\n"), numTracks);
|
||||||
mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'WAVETRACKS)\n"), numWave);
|
mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'WAVETRACKS)\n"), numWave);
|
||||||
mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'LABELTRACKS)\n"), numLabel);
|
mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'LABELTRACKS)\n"), numLabel);
|
||||||
|
|
|
@ -395,7 +395,7 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d
|
||||||
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
|
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
|
||||||
if (!(EditActions::DoEditMetadata( *project,
|
if (!(EditActions::DoEditMetadata( *project,
|
||||||
_("Edit Metadata Tags"), _("Exported Tags"),
|
_("Edit Metadata Tags"), _("Exported Tags"),
|
||||||
mProject->GetShowId3Dialog()))) {
|
ProjectSettings::Get( *mProject ).GetShowId3Dialog()))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1034,7 +1034,8 @@ bool Exporter::SetAutoExportOptions(AudacityProject *project) {
|
||||||
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
|
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
|
||||||
if (!(EditActions::DoEditMetadata( *project,
|
if (!(EditActions::DoEditMetadata( *project,
|
||||||
_("Edit Metadata Tags"),
|
_("Edit Metadata Tags"),
|
||||||
_("Exported Tags"), mProject->GetShowId3Dialog()))) {
|
_("Exported Tags"),
|
||||||
|
ProjectSettings::Get(*mProject).GetShowId3Dialog()))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,7 +388,7 @@ ProgressResult ExportCL::Export(AudacityProject *project,
|
||||||
wxLogNull nolog;
|
wxLogNull nolog;
|
||||||
|
|
||||||
// establish parameters
|
// establish parameters
|
||||||
int rate = lrint(project->GetRate());
|
int rate = lrint( ProjectSettings::Get( *project ).GetRate());
|
||||||
const size_t maxBlockLen = 44100 * 5;
|
const size_t maxBlockLen = 44100 * 5;
|
||||||
unsigned long totalSamples = lrint((t1 - t0) * rate);
|
unsigned long totalSamples = lrint((t1 - t0) * rate);
|
||||||
unsigned long sampleBytes = totalSamples * channels * SAMPLE_SIZE(int16Sample);
|
unsigned long sampleBytes = totalSamples * channels * SAMPLE_SIZE(int16Sample);
|
||||||
|
|
|
@ -382,6 +382,7 @@ static int set_dict_int(AVDictionary **dict, const char *key, int val)
|
||||||
|
|
||||||
bool ExportFFmpeg::InitCodecs(AudacityProject *project)
|
bool ExportFFmpeg::InitCodecs(AudacityProject *project)
|
||||||
{
|
{
|
||||||
|
const auto &settings = ProjectSettings::Get( *project );
|
||||||
AVCodec *codec = NULL;
|
AVCodec *codec = NULL;
|
||||||
AVDictionary *options = NULL;
|
AVDictionary *options = NULL;
|
||||||
AVDictionaryCleanup cleanup{ &options };
|
AVDictionaryCleanup cleanup{ &options };
|
||||||
|
@ -391,7 +392,7 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
|
||||||
mEncAudioCodecCtx->codec_id = ExportFFmpegOptions::fmts[mSubFormat].codecid;
|
mEncAudioCodecCtx->codec_id = ExportFFmpegOptions::fmts[mSubFormat].codecid;
|
||||||
mEncAudioCodecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
|
mEncAudioCodecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||||
mEncAudioCodecCtx->codec_tag = av_codec_get_tag(mEncFormatCtx->oformat->codec_tag,mEncAudioCodecCtx->codec_id);
|
mEncAudioCodecCtx->codec_tag = av_codec_get_tag(mEncFormatCtx->oformat->codec_tag,mEncAudioCodecCtx->codec_id);
|
||||||
mSampleRate = (int)project->GetRate();
|
mSampleRate = (int)settings.GetRate();
|
||||||
mEncAudioCodecCtx->global_quality = -99999; //quality mode is off by default;
|
mEncAudioCodecCtx->global_quality = -99999; //quality mode is off by default;
|
||||||
|
|
||||||
// Each export type has its own settings
|
// Each export type has its own settings
|
||||||
|
|
|
@ -252,7 +252,8 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
|
||||||
const Tags *metadata,
|
const Tags *metadata,
|
||||||
int WXUNUSED(subformat))
|
int WXUNUSED(subformat))
|
||||||
{
|
{
|
||||||
double rate = project->GetRate();
|
const auto &settings = ProjectSettings::Get( *project );
|
||||||
|
double rate = settings.GetRate();
|
||||||
const auto &tracks = TrackList::Get( *project );
|
const auto &tracks = TrackList::Get( *project );
|
||||||
|
|
||||||
wxLogNull logNo; // temporarily disable wxWidgets error messages
|
wxLogNull logNo; // temporarily disable wxWidgets error messages
|
||||||
|
|
|
@ -210,9 +210,10 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
|
||||||
bool selectionOnly, double t0, double t1, MixerSpec *mixerSpec, const Tags *metadata,
|
bool selectionOnly, double t0, double t1, MixerSpec *mixerSpec, const Tags *metadata,
|
||||||
int WXUNUSED(subformat))
|
int WXUNUSED(subformat))
|
||||||
{
|
{
|
||||||
|
const auto &settings = ProjectSettings::Get( *project );
|
||||||
bool stereo = (channels == 2);
|
bool stereo = (channels == 2);
|
||||||
long bitrate = gPrefs->Read(wxT("/FileFormats/MP2Bitrate"), 160);
|
long bitrate = gPrefs->Read(wxT("/FileFormats/MP2Bitrate"), 160);
|
||||||
double rate = project->GetRate();
|
double rate = settings.GetRate();
|
||||||
const auto &tracks = TrackList::Get( *project );
|
const auto &tracks = TrackList::Get( *project );
|
||||||
|
|
||||||
wxLogNull logNo; /* temporarily disable wxWidgets error messages */
|
wxLogNull logNo; /* temporarily disable wxWidgets error messages */
|
||||||
|
|
|
@ -1753,7 +1753,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
|
||||||
const Tags *metadata,
|
const Tags *metadata,
|
||||||
int WXUNUSED(subformat))
|
int WXUNUSED(subformat))
|
||||||
{
|
{
|
||||||
int rate = lrint(project->GetRate());
|
int rate = lrint( ProjectSettings::Get( *project ).GetRate());
|
||||||
#ifndef DISABLE_DYNAMIC_LOADING_LAME
|
#ifndef DISABLE_DYNAMIC_LOADING_LAME
|
||||||
wxWindow *parent = ProjectWindow::Find( project );
|
wxWindow *parent = ProjectWindow::Find( project );
|
||||||
#endif // DISABLE_DYNAMIC_LOADING_LAME
|
#endif // DISABLE_DYNAMIC_LOADING_LAME
|
||||||
|
|
|
@ -739,13 +739,14 @@ ProgressResult ExportMultiple::ExportMultipleByLabel(bool byName,
|
||||||
setting.filetags.SetTag(TAG_TITLE, title);
|
setting.filetags.SetTag(TAG_TITLE, title);
|
||||||
setting.filetags.SetTag(TAG_TRACK, l+1);
|
setting.filetags.SetTag(TAG_TRACK, l+1);
|
||||||
// let the user have a crack at editing it, exit if cancelled
|
// let the user have a crack at editing it, exit if cancelled
|
||||||
bool bShowTagsDialog = mProject->GetShowId3Dialog();
|
auto &settings = ProjectSettings::Get( *mProject );
|
||||||
|
bool bShowTagsDialog = settings.GetShowId3Dialog();
|
||||||
if( bShowTagsDialog ){
|
if( bShowTagsDialog ){
|
||||||
bool bCancelled = !setting.filetags.ShowEditDialog(
|
bool bCancelled = !setting.filetags.ShowEditDialog(
|
||||||
ProjectWindow::Find( mProject ),
|
ProjectWindow::Find( mProject ),
|
||||||
_("Edit Metadata Tags"), bShowTagsDialog);
|
_("Edit Metadata Tags"), bShowTagsDialog);
|
||||||
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &bShowTagsDialog, true);
|
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &bShowTagsDialog, true);
|
||||||
mProject->SetShowId3Dialog( bShowTagsDialog );
|
settings.SetShowId3Dialog( bShowTagsDialog );
|
||||||
if( bCancelled )
|
if( bCancelled )
|
||||||
return ProgressResult::Cancelled;
|
return ProgressResult::Cancelled;
|
||||||
}
|
}
|
||||||
|
@ -858,13 +859,14 @@ ProgressResult ExportMultiple::ExportMultipleByTrack(bool byName,
|
||||||
setting.filetags.SetTag(TAG_TITLE, title);
|
setting.filetags.SetTag(TAG_TITLE, title);
|
||||||
setting.filetags.SetTag(TAG_TRACK, l+1);
|
setting.filetags.SetTag(TAG_TRACK, l+1);
|
||||||
// let the user have a crack at editing it, exit if cancelled
|
// let the user have a crack at editing it, exit if cancelled
|
||||||
bool bShowTagsDialog = mProject->GetShowId3Dialog();
|
auto &settings = ProjectSettings::Get( *mProject );
|
||||||
|
bool bShowTagsDialog = settings.GetShowId3Dialog();
|
||||||
if( bShowTagsDialog ){
|
if( bShowTagsDialog ){
|
||||||
bool bCancelled = !setting.filetags.ShowEditDialog(
|
bool bCancelled = !setting.filetags.ShowEditDialog(
|
||||||
ProjectWindow::Find( mProject ),
|
ProjectWindow::Find( mProject ),
|
||||||
_("Edit Metadata Tags"), bShowTagsDialog);
|
_("Edit Metadata Tags"), bShowTagsDialog);
|
||||||
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &bShowTagsDialog, true);
|
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &bShowTagsDialog, true);
|
||||||
mProject->SetShowId3Dialog( bShowTagsDialog );
|
settings.SetShowId3Dialog( bShowTagsDialog );
|
||||||
if( bCancelled )
|
if( bCancelled )
|
||||||
return ProgressResult::Cancelled;
|
return ProgressResult::Cancelled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
||||||
const Tags *metadata,
|
const Tags *metadata,
|
||||||
int WXUNUSED(subformat))
|
int WXUNUSED(subformat))
|
||||||
{
|
{
|
||||||
double rate = project->GetRate();
|
double rate = ProjectSettings::Get( *project ).GetRate();
|
||||||
const auto &tracks = TrackList::Get( *project );
|
const auto &tracks = TrackList::Get( *project );
|
||||||
double quality = (gPrefs->Read(wxT("/FileFormats/OggExportQuality"), 50)/(float)100.0);
|
double quality = (gPrefs->Read(wxT("/FileFormats/OggExportQuality"), 50)/(float)100.0);
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,7 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
|
||||||
const Tags *metadata,
|
const Tags *metadata,
|
||||||
int subformat)
|
int subformat)
|
||||||
{
|
{
|
||||||
double rate = project->GetRate();
|
double rate = ProjectSettings::Get( *project ).GetRate();
|
||||||
const auto &tracks = TrackList::Get( *project );
|
const auto &tracks = TrackList::Get( *project );
|
||||||
int sf_format;
|
int sf_format;
|
||||||
|
|
||||||
|
|
|
@ -701,8 +701,9 @@ void DoClipLeftOrRight
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
auto &selectedRegion = viewInfo.selectedRegion;
|
auto &selectedRegion = viewInfo.selectedRegion;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto isSyncLocked = project.IsSyncLocked();
|
auto isSyncLocked = settings.IsSyncLocked();
|
||||||
|
|
||||||
auto amount = DoClipMove( viewInfo, trackPanel.GetFocusedTrack(),
|
auto amount = DoClipMove( viewInfo, trackPanel.GetFocusedTrack(),
|
||||||
tracks, isSyncLocked, right );
|
tracks, isSyncLocked, right );
|
||||||
|
|
|
@ -139,7 +139,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
|
||||||
// with various project and track sample rates.
|
// with various project and track sample rates.
|
||||||
// So do it at the sample rate of the project
|
// So do it at the sample rate of the project
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = GetActiveProject();
|
||||||
double projRate = p->GetRate();
|
double projRate = ProjectSettings::Get( *p ).GetRate();
|
||||||
double quantT0 = QUANTIZED_TIME(clipboard.T0(), projRate);
|
double quantT0 = QUANTIZED_TIME(clipboard.T0(), projRate);
|
||||||
double quantT1 = QUANTIZED_TIME(clipboard.T1(), projRate);
|
double quantT1 = QUANTIZED_TIME(clipboard.T1(), projRate);
|
||||||
selectedRegion.setTimes(
|
selectedRegion.setTimes(
|
||||||
|
@ -201,6 +201,7 @@ bool DoEditMetadata
|
||||||
(AudacityProject &project,
|
(AudacityProject &project,
|
||||||
const wxString &title, const wxString &shortUndoDescription, bool force)
|
const wxString &title, const wxString &shortUndoDescription, bool force)
|
||||||
{
|
{
|
||||||
|
auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tags = Tags::Get( project );
|
auto &tags = Tags::Get( project );
|
||||||
|
|
||||||
// Back up my tags
|
// Back up my tags
|
||||||
|
@ -218,7 +219,7 @@ bool DoEditMetadata
|
||||||
}
|
}
|
||||||
bool bShowInFuture;
|
bool bShowInFuture;
|
||||||
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &bShowInFuture, true);
|
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &bShowInFuture, true);
|
||||||
project.SetShowId3Dialog( bShowInFuture );
|
settings.SetShowId3Dialog( bShowInFuture );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,9 +441,10 @@ void OnPaste(const CommandContext &context)
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &trackFactory = TrackFactory::Get( project );
|
auto &trackFactory = TrackFactory::Get( project );
|
||||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
||||||
auto isSyncLocked = project.IsSyncLocked();
|
auto isSyncLocked = settings.IsSyncLocked();
|
||||||
|
|
||||||
// Handle text paste (into active label) first.
|
// Handle text paste (into active label) first.
|
||||||
if (DoPasteText(project))
|
if (DoPasteText(project))
|
||||||
|
|
|
@ -423,10 +423,11 @@ bool DoEffect(
|
||||||
const PluginID & ID, const CommandContext &context, unsigned flags )
|
const PluginID & ID, const CommandContext &context, unsigned flags )
|
||||||
{
|
{
|
||||||
AudacityProject &project = context.project;
|
AudacityProject &project = context.project;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &trackFactory = TrackFactory::Get( project );
|
auto &trackFactory = TrackFactory::Get( project );
|
||||||
auto rate = project.GetRate();
|
auto rate = settings.GetRate();
|
||||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||||
auto &commandManager = CommandManager::Get( project );
|
auto &commandManager = CommandManager::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
|
@ -93,7 +93,8 @@ void DoNextPeakFrequency(AudacityProject &project, bool up)
|
||||||
double NearestZeroCrossing
|
double NearestZeroCrossing
|
||||||
(AudacityProject &project, double t0)
|
(AudacityProject &project, double t0)
|
||||||
{
|
{
|
||||||
auto rate = project.GetRate();
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
|
auto rate = settings.GetRate();
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
|
|
||||||
// Window is 1/100th of a second.
|
// Window is 1/100th of a second.
|
||||||
|
@ -226,9 +227,10 @@ void SeekWhenAudioActive(double seekStep, wxLongLong &lastSelectionAdjustment)
|
||||||
double GridMove
|
double GridMove
|
||||||
(AudacityProject &project, double t, int minPix)
|
(AudacityProject &project, double t, int minPix)
|
||||||
{
|
{
|
||||||
auto rate = project.GetRate();
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
|
auto rate = settings.GetRate();
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
auto format = project.GetSelectionFormat();
|
auto format = settings.GetSelectionFormat();
|
||||||
|
|
||||||
NumericConverter nc(NumericConverter::TIME, format, t, rate);
|
NumericConverter nc(NumericConverter::TIME, format, t, rate);
|
||||||
|
|
||||||
|
@ -271,10 +273,11 @@ void MoveWhenAudioInactive
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &ruler = AdornedRulerPanel::Get( project );
|
auto &ruler = AdornedRulerPanel::Get( project );
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
||||||
// If TIME_UNIT_SECONDS, snap-to will be off.
|
// If TIME_UNIT_SECONDS, snap-to will be off.
|
||||||
int snapToTime = project.GetSnapTo();
|
int snapToTime = settings.GetSnapTo();
|
||||||
const double t0 = viewInfo.selectedRegion.t0();
|
const double t0 = viewInfo.selectedRegion.t0();
|
||||||
const double end = std::max(
|
const double end = std::max(
|
||||||
tracks.GetEndTime(),
|
tracks.GetEndTime(),
|
||||||
|
@ -324,6 +327,7 @@ SelectionOperation operation)
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
|
|
||||||
if( operation == CURSOR_MOVE )
|
if( operation == CURSOR_MOVE )
|
||||||
{
|
{
|
||||||
|
@ -331,7 +335,7 @@ SelectionOperation operation)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int snapToTime = project.GetSnapTo();
|
int snapToTime = settings.GetSnapTo();
|
||||||
const double t0 = viewInfo.selectedRegion.t0();
|
const double t0 = viewInfo.selectedRegion.t0();
|
||||||
const double t1 = viewInfo.selectedRegion.t1();
|
const double t1 = viewInfo.selectedRegion.t1();
|
||||||
const double end = std::max(
|
const double end = std::max(
|
||||||
|
@ -513,10 +517,12 @@ void DoListSelection
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &selectionState = SelectionState::Get( project );
|
auto &selectionState = SelectionState::Get( project );
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
auto &window = GetProjectFrame( project );
|
auto &window = GetProjectFrame( project );
|
||||||
|
|
||||||
auto isSyncLocked = project.IsSyncLocked();
|
auto isSyncLocked = settings.IsSyncLocked();
|
||||||
|
|
||||||
selectionState.HandleListSelection(
|
selectionState.HandleListSelection(
|
||||||
tracks, viewInfo, *t,
|
tracks, viewInfo, *t,
|
||||||
shift, ctrl, isSyncLocked );
|
shift, ctrl, isSyncLocked );
|
||||||
|
@ -611,6 +617,7 @@ void OnSetLeftSelection(const CommandContext &context)
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
auto token = project.GetAudioIOToken();
|
auto token = project.GetAudioIOToken();
|
||||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &window = GetProjectFrame( project );
|
auto &window = GetProjectFrame( project );
|
||||||
|
|
||||||
|
@ -623,8 +630,8 @@ void OnSetLeftSelection(const CommandContext &context)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto fmt = project.GetSelectionFormat();
|
auto fmt = settings.GetSelectionFormat();
|
||||||
auto rate = project.GetRate();
|
auto rate = settings.GetRate();
|
||||||
|
|
||||||
TimeDialog dlg(&window, _("Set Left Selection Boundary"),
|
TimeDialog dlg(&window, _("Set Left Selection Boundary"),
|
||||||
fmt, rate, selectedRegion.t0(), _("Position"));
|
fmt, rate, selectedRegion.t0(), _("Position"));
|
||||||
|
@ -650,6 +657,7 @@ void OnSetRightSelection(const CommandContext &context)
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
auto token = project.GetAudioIOToken();
|
auto token = project.GetAudioIOToken();
|
||||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &window = GetProjectFrame( project );
|
auto &window = GetProjectFrame( project );
|
||||||
|
|
||||||
|
@ -662,8 +670,8 @@ void OnSetRightSelection(const CommandContext &context)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto fmt = project.GetSelectionFormat();
|
auto fmt = settings.GetSelectionFormat();
|
||||||
auto rate = project.GetRate();
|
auto rate = settings.GetRate();
|
||||||
|
|
||||||
TimeDialog dlg(&window, _("Set Right Selection Boundary"),
|
TimeDialog dlg(&window, _("Set Right Selection Boundary"),
|
||||||
fmt, rate, selectedRegion.t1(), _("Position"));
|
fmt, rate, selectedRegion.t1(), _("Position"));
|
||||||
|
@ -867,6 +875,7 @@ void OnZeroCrossing(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
|
|
||||||
const double t0 = NearestZeroCrossing(project, selectedRegion.t0());
|
const double t0 = NearestZeroCrossing(project, selectedRegion.t0());
|
||||||
|
@ -875,7 +884,7 @@ void OnZeroCrossing(const CommandContext &context)
|
||||||
else {
|
else {
|
||||||
const double t1 = NearestZeroCrossing(project, selectedRegion.t1());
|
const double t1 = NearestZeroCrossing(project, selectedRegion.t1());
|
||||||
// Empty selection is generally not much use, so do not make it if empty.
|
// Empty selection is generally not much use, so do not make it if empty.
|
||||||
if( fabs( t1 - t0 ) * project.GetRate() > 1.5 )
|
if( fabs( t1 - t0 ) * settings.GetRate() > 1.5 )
|
||||||
selectedRegion.setTimes(t0, t1);
|
selectedRegion.setTimes(t0, t1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,11 @@ namespace {
|
||||||
void DoMixAndRender
|
void DoMixAndRender
|
||||||
(AudacityProject &project, bool toNewTrack)
|
(AudacityProject &project, bool toNewTrack)
|
||||||
{
|
{
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &trackFactory = TrackFactory::Get( project );
|
auto &trackFactory = TrackFactory::Get( project );
|
||||||
auto rate = project.GetRate();
|
auto rate = settings.GetRate();
|
||||||
auto defaultFormat = project.GetDefaultFormat();
|
auto defaultFormat = settings.GetDefaultFormat();
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
||||||
|
@ -600,6 +601,7 @@ void DoRemoveTracks( AudacityProject &project )
|
||||||
|
|
||||||
void DoTrackMute(AudacityProject &project, Track *t, bool exclusive)
|
void DoTrackMute(AudacityProject &project, Track *t, bool exclusive)
|
||||||
{
|
{
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
|
|
||||||
|
@ -626,7 +628,7 @@ void DoTrackMute(AudacityProject &project, Track *t, bool exclusive)
|
||||||
for (auto channel : TrackList::Channels(pt))
|
for (auto channel : TrackList::Channels(pt))
|
||||||
channel->SetMute( !wasMute );
|
channel->SetMute( !wasMute );
|
||||||
|
|
||||||
if (project.IsSoloSimple() || project.IsSoloNone())
|
if (settings.IsSoloSimple() || settings.IsSoloNone())
|
||||||
{
|
{
|
||||||
// We also set a solo indicator if we have just one track / stereo pair playing.
|
// We also set a solo indicator if we have just one track / stereo pair playing.
|
||||||
// in a group of more than one playable tracks.
|
// in a group of more than one playable tracks.
|
||||||
|
@ -649,6 +651,7 @@ void DoTrackMute(AudacityProject &project, Track *t, bool exclusive)
|
||||||
|
|
||||||
void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)
|
void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)
|
||||||
{
|
{
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
|
|
||||||
|
@ -660,7 +663,7 @@ void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)
|
||||||
return;
|
return;
|
||||||
bool bWasSolo = pt->GetSolo();
|
bool bWasSolo = pt->GetSolo();
|
||||||
|
|
||||||
bool bSoloMultiple = !project.IsSoloSimple() ^ exclusive;
|
bool bSoloMultiple = !settings.IsSoloSimple() ^ exclusive;
|
||||||
|
|
||||||
// Standard and Simple solo have opposite defaults:
|
// Standard and Simple solo have opposite defaults:
|
||||||
// Standard - Behaves as individual buttons, shift=radio buttons
|
// Standard - Behaves as individual buttons, shift=radio buttons
|
||||||
|
@ -682,12 +685,12 @@ void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)
|
||||||
for (auto channel : group) {
|
for (auto channel : group) {
|
||||||
if (chosen) {
|
if (chosen) {
|
||||||
channel->SetSolo( !bWasSolo );
|
channel->SetSolo( !bWasSolo );
|
||||||
if( project.IsSoloSimple() )
|
if( settings.IsSoloSimple() )
|
||||||
channel->SetMute( false );
|
channel->SetMute( false );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
channel->SetSolo( false );
|
channel->SetSolo( false );
|
||||||
if( project.IsSoloSimple() )
|
if( settings.IsSoloSimple() )
|
||||||
channel->SetMute( !bWasSolo );
|
channel->SetMute( !bWasSolo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -799,13 +802,14 @@ struct Handler : CommandHandlerObject {
|
||||||
void OnNewWaveTrack(const CommandContext &context)
|
void OnNewWaveTrack(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &trackFactory = TrackFactory::Get( project );
|
auto &trackFactory = TrackFactory::Get( project );
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
||||||
auto defaultFormat = project.GetDefaultFormat();
|
auto defaultFormat = settings.GetDefaultFormat();
|
||||||
auto rate = project.GetRate();
|
auto rate = settings.GetRate();
|
||||||
|
|
||||||
auto t = tracks.Add( trackFactory.NewWaveTrack( defaultFormat, rate ) );
|
auto t = tracks.Add( trackFactory.NewWaveTrack( defaultFormat, rate ) );
|
||||||
SelectActions::SelectNone( project );
|
SelectActions::SelectNone( project );
|
||||||
|
@ -821,13 +825,14 @@ void OnNewWaveTrack(const CommandContext &context)
|
||||||
void OnNewStereoTrack(const CommandContext &context)
|
void OnNewStereoTrack(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &trackFactory = TrackFactory::Get( project );
|
auto &trackFactory = TrackFactory::Get( project );
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
auto &trackPanel = TrackPanel::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
||||||
auto defaultFormat = project.GetDefaultFormat();
|
auto defaultFormat = settings.GetDefaultFormat();
|
||||||
auto rate = project.GetRate();
|
auto rate = settings.GetRate();
|
||||||
|
|
||||||
SelectActions::SelectNone( project );
|
SelectActions::SelectNone( project );
|
||||||
|
|
||||||
|
@ -913,7 +918,8 @@ void OnMixAndRenderToNewTrack(const CommandContext &context)
|
||||||
void OnResample(const CommandContext &context)
|
void OnResample(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
auto projectRate = project.GetRate();
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
|
auto projectRate = settings.GetRate();
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &undoManager = UndoManager::Get( project );
|
auto &undoManager = UndoManager::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
@ -1025,11 +1031,12 @@ void OnRemoveTracks(const CommandContext &context)
|
||||||
void OnMuteAllTracks(const CommandContext &context)
|
void OnMuteAllTracks(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
||||||
auto soloSimple = project.IsSoloSimple();
|
auto soloSimple = settings.IsSoloSimple();
|
||||||
auto soloNone = project.IsSoloNone();
|
auto soloNone = settings.IsSoloNone();
|
||||||
|
|
||||||
for (auto pt : tracks.Any<PlayableTrack>())
|
for (auto pt : tracks.Any<PlayableTrack>())
|
||||||
{
|
{
|
||||||
|
@ -1045,11 +1052,12 @@ void OnMuteAllTracks(const CommandContext &context)
|
||||||
void OnUnmuteAllTracks(const CommandContext &context)
|
void OnUnmuteAllTracks(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
||||||
auto soloSimple = project.IsSoloSimple();
|
auto soloSimple = settings.IsSoloSimple();
|
||||||
auto soloNone = project.IsSoloNone();
|
auto soloNone = settings.IsSoloNone();
|
||||||
|
|
||||||
for (auto pt : tracks.Any<PlayableTrack>())
|
for (auto pt : tracks.Any<PlayableTrack>())
|
||||||
{
|
{
|
||||||
|
|
|
@ -399,6 +399,7 @@ void OnRecord2ndChoice(const CommandContext &context)
|
||||||
void OnTimerRecord(const CommandContext &context)
|
void OnTimerRecord(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
auto &undoManager = UndoManager::Get( project );
|
auto &undoManager = UndoManager::Get( project );
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
||||||
|
@ -417,7 +418,7 @@ void OnTimerRecord(const CommandContext &context)
|
||||||
// preventing issues surrounding "dirty" projects when Automatic Save/Export
|
// preventing issues surrounding "dirty" projects when Automatic Save/Export
|
||||||
// is used in Timer Recording.
|
// is used in Timer Recording.
|
||||||
if ((undoManager.UnsavedChanges()) &&
|
if ((undoManager.UnsavedChanges()) &&
|
||||||
(TrackList::Get( project ).Any() || project.EmptyCanBeDirty())) {
|
(TrackList::Get( project ).Any() || settings.EmptyCanBeDirty())) {
|
||||||
AudacityMessageBox(_("Timer Recording cannot be used while you have unsaved changes.\n\nPlease save or close this project and try again."),
|
AudacityMessageBox(_("Timer Recording cannot be used while you have unsaved changes.\n\nPlease save or close this project and try again."),
|
||||||
_("Timer Recording"),
|
_("Timer Recording"),
|
||||||
wxICON_INFORMATION | wxOK);
|
wxICON_INFORMATION | wxOK);
|
||||||
|
|
|
@ -1242,7 +1242,8 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
|
||||||
newTrack->SetName(baseTrackName + wxT("_") + nameSuffix);
|
newTrack->SetName(baseTrackName + wxT("_") + nameSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((recordingChannels > 2) && !(p->GetTracksFitVerticallyZoomed())) {
|
if ((recordingChannels > 2) &&
|
||||||
|
!(ProjectSettings::Get(*p).GetTracksFitVerticallyZoomed())) {
|
||||||
newTrack->SetMinimized(true);
|
newTrack->SetMinimized(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,8 +224,9 @@ UIHandle::Result StretchHandle::Release
|
||||||
|
|
||||||
bool left = mStretchState.mMode == stretchLeft;
|
bool left = mStretchState.mMode == stretchLeft;
|
||||||
bool right = mStretchState.mMode == stretchRight;
|
bool right = mStretchState.mMode == stretchRight;
|
||||||
|
const auto &settings = ProjectSettings::Get( *pProject );
|
||||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||||
if ( pProject->IsSyncLocked() && ( left || right ) ) {
|
if ( settings.IsSyncLocked() && ( left || right ) ) {
|
||||||
for ( auto track :
|
for ( auto track :
|
||||||
TrackList::SyncLockGroup( mpTrack.get() ) ) {
|
TrackList::SyncLockGroup( mpTrack.get() ) ) {
|
||||||
if ( track != mpTrack.get() ) {
|
if ( track != mpTrack.get() ) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ UIHandlePtr MuteButtonHandle::HitTest
|
||||||
wxRect buttonRect;
|
wxRect buttonRect;
|
||||||
if ( pTrack )
|
if ( pTrack )
|
||||||
TrackInfo::GetMuteSoloRect(rect, buttonRect, false,
|
TrackInfo::GetMuteSoloRect(rect, buttonRect, false,
|
||||||
!pProject->IsSoloNone(), pTrack.get());
|
!ProjectSettings::Get( *pProject ).IsSoloNone(), pTrack.get());
|
||||||
if ( TrackInfo::HideTopItem( rect, buttonRect ) )
|
if ( TrackInfo::HideTopItem( rect, buttonRect ) )
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ UIHandlePtr SoloButtonHandle::HitTest
|
||||||
wxRect buttonRect;
|
wxRect buttonRect;
|
||||||
if ( pTrack )
|
if ( pTrack )
|
||||||
TrackInfo::GetMuteSoloRect(rect, buttonRect, true,
|
TrackInfo::GetMuteSoloRect(rect, buttonRect, true,
|
||||||
!pProject->IsSoloNone(), pTrack.get());
|
!ProjectSettings::Get( *pProject ).IsSoloNone(), pTrack.get());
|
||||||
|
|
||||||
if ( TrackInfo::HideTopItem( rect, buttonRect ) )
|
if ( TrackInfo::HideTopItem( rect, buttonRect ) )
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -554,6 +554,7 @@ UIHandle::Result SelectHandle::Click
|
||||||
return RefreshAll | Cancelled;
|
return RefreshAll | Cancelled;
|
||||||
|
|
||||||
auto &selectionState = SelectionState::Get( *pProject );
|
auto &selectionState = SelectionState::Get( *pProject );
|
||||||
|
const auto &settings = ProjectSettings::Get( *pProject );
|
||||||
if (event.LeftDClick() && !event.ShiftDown()) {
|
if (event.LeftDClick() && !event.ShiftDown()) {
|
||||||
auto &trackList = TrackList::Get( *pProject );
|
auto &trackList = TrackList::Get( *pProject );
|
||||||
|
|
||||||
|
@ -564,7 +565,7 @@ UIHandle::Result SelectHandle::Click
|
||||||
|
|
||||||
// Default behavior: select whole track
|
// Default behavior: select whole track
|
||||||
SelectionState::SelectTrackLength
|
SelectionState::SelectTrackLength
|
||||||
( viewInfo, *pTrack, pProject->IsSyncLocked() );
|
( viewInfo, *pTrack, settings.IsSyncLocked() );
|
||||||
|
|
||||||
// Special case: if we're over a clip in a WaveTrack,
|
// Special case: if we're over a clip in a WaveTrack,
|
||||||
// select just that clip
|
// select just that clip
|
||||||
|
|
|
@ -407,7 +407,7 @@ UIHandle::Result TimeShiftHandle::Click
|
||||||
else if ( captureClips )
|
else if ( captureClips )
|
||||||
CreateListOfCapturedClips(
|
CreateListOfCapturedClips(
|
||||||
mClipMoveState, viewInfo, *pTrack, trackList,
|
mClipMoveState, viewInfo, *pTrack, trackList,
|
||||||
pProject->IsSyncLocked(), clickTime );
|
ProjectSettings::Get( *pProject ).IsSyncLocked(), clickTime );
|
||||||
|
|
||||||
mSlideUpDownOnly = event.CmdDown() && !multiToolModeActive;
|
mSlideUpDownOnly = event.CmdDown() && !multiToolModeActive;
|
||||||
mRect = rect;
|
mRect = rect;
|
||||||
|
|
|
@ -1871,7 +1871,7 @@ void MeterPanel::StartMonitoring()
|
||||||
if (start && !gAudioIO->IsBusy()){
|
if (start && !gAudioIO->IsBusy()){
|
||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = GetActiveProject();
|
||||||
if (p){
|
if (p){
|
||||||
gAudioIO->StartMonitoring(p->GetRate());
|
gAudioIO->StartMonitoring( ProjectSettings::Get( *p ).GetRate());
|
||||||
}
|
}
|
||||||
|
|
||||||
mLayoutValid = false;
|
mLayoutValid = false;
|
||||||
|
|
Loading…
Reference in New Issue