1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 23:59:37 +02:00

Move ENV_DB_RANGE out of Envelope.h; that file can be included in fewer places.

This commit is contained in:
Paul Licameli 2015-07-09 13:39:20 -04:00
parent 7bba4500c4
commit e0621819ed
14 changed files with 58 additions and 27 deletions

View File

@ -295,11 +295,11 @@ writing audio.
#include <wx/txtstrm.h>
#include "AudacityApp.h"
#include "Envelope.h"
#include "Mix.h"
#include "MixerBoard.h"
#include "Resample.h"
#include "RingBuffer.h"
#include "prefs/GUISettings.h"
#include "Prefs.h"
#include "Project.h"
#include "TimeTrack.h"
@ -1529,11 +1529,11 @@ int AudioIO::StartStream(WaveTrackArray playbackTracks,
int silenceLevelDB;
gPrefs->Read(wxT("/AudioIO/SilenceLevel"), &silenceLevelDB, -50);
int dBRange;
dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
if(silenceLevelDB < -dBRange)
{
silenceLevelDB = -dBRange + 3; // meter range was made smaller than SilenceLevel
gPrefs->Write(wxT("/GUI/EnvdBRange"), dBRange); // so set SilenceLevel reasonable
gPrefs->Write(ENV_DB_KEY, dBRange); // so set SilenceLevel reasonable
gPrefs->Flush();
}
mSilenceLevel = (silenceLevelDB + dBRange)/(double)dBRange; // meter goes -dBRange dB -> 0dB

View File

@ -31,8 +31,6 @@ class Envelope;
class ZoomInfo;
#define ENV_DB_RANGE 60
class EnvPoint : public XMLTagHandler {
public:

View File

@ -43,6 +43,8 @@ and in the spectrogram spectral selection.
#include "Audacity.h"
#include "FreqWindow.h"
#include <algorithm>
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
@ -71,12 +73,12 @@ and in the spectrogram spectral selection.
#include <math.h>
#include "Envelope.h"
#include "ShuttleGui.h"
#include "AColor.h"
#include "FFT.h"
#include "Internat.h"
#include "PitchName.h"
#include "prefs/GUISettings.h"
#include "Prefs.h"
#include "Project.h"
#include "WaveClip.h"
@ -265,7 +267,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
gPrefs->Read(wxT("/FreqWindow/FuncChoice"), &mFunc, 3);
gPrefs->Read(wxT("/FreqWindow/AxisChoice"), &mAxis, 0);
gPrefs->Read(wxT("/GUI/EnvdBRange"), &dBRange, ENV_DB_RANGE);
gPrefs->Read(ENV_DB_KEY, &dBRange, ENV_DB_RANGE);
if(dBRange < 90.)
dBRange = 90.;
@ -546,7 +548,7 @@ bool FreqWindow::Show(bool show)
if (show && !shown)
{
gPrefs->Read(wxT("/GUI/EnvdBRange"), &dBRange, ENV_DB_RANGE);
gPrefs->Read(ENV_DB_KEY, &dBRange, ENV_DB_RANGE);
if(dBRange < 90.)
dBRange = 90.;
GetAudio();
@ -1079,7 +1081,7 @@ void FreqWindow::OnExport(wxCommandEvent & WXUNUSED(event))
void FreqWindow::OnReplot(wxCommandEvent & WXUNUSED(event))
{
gPrefs->Read(wxT("/GUI/EnvdBRange"), &dBRange, ENV_DB_RANGE);
gPrefs->Read(ENV_DB_KEY, &dBRange, ENV_DB_RANGE);
if(dBRange < 90.)
dBRange = 90.;
GetAudio();

View File

@ -456,6 +456,7 @@ audacity_SOURCES = \
prefs/ExtImportPrefs.h \
prefs/GUIPrefs.cpp \
prefs/GUIPrefs.h \
prefs/GUISettings.h \
prefs/ImportExportPrefs.cpp \
prefs/ImportExportPrefs.h \
prefs/KeyConfigPrefs.cpp \

View File

@ -19,14 +19,12 @@
*//********************************************************************/
#include "Audacity.h"
#include "SoundActivatedRecord.h"
#include <wx/dialog.h>
#include "Envelope.h"
#include "ShuttleGui.h"
#include "ShuttlePrefs.h"
#include "Prefs.h"
#include "SoundActivatedRecord.h"
#include "prefs/GUISettings.h"
BEGIN_EVENT_TABLE(SoundActivatedRecord, wxDialog)
EVT_BUTTON(wxID_OK, SoundActivatedRecord::OnOK)
@ -57,7 +55,7 @@ void SoundActivatedRecord::PopulateOrExchange(ShuttleGui & S)
{
S.StartMultiColumn(2, wxEXPAND);
S.SetStretchyCol(1);
dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
S.TieSlider(_("Activation level (dB):"), wxT("/AudioIO/SilenceLevel"), -50, 0, -dBRange);
S.EndMultiColumn();
}

View File

@ -13,6 +13,13 @@
********************************************************************/
#ifndef __AUDACITY_SOUND_ACTIVATED_RECORD__
#define __AUDACITY_SOUND_ACTIVATED_RECORD__
#include <wx/dialog.h>
class ShuttleGui;
class SoundActivatedRecord : public wxDialog
{
public:
@ -27,3 +34,4 @@ private:
DECLARE_EVENT_TABLE();
};
#endif

View File

@ -173,6 +173,7 @@ audio tracks.
#include "LabelTrack.h"
#include "TimeTrack.h"
#include "Prefs.h"
#include "prefs/GUISettings.h"
#include "prefs/SpectrogramSettings.h"
#include "prefs/WaveformSettings.h"
#include "Spectrum.h"
@ -3108,7 +3109,7 @@ void TrackArtist::DrawTimeTrack(TimeTrack *track,
double lower = track->GetRangeLower(), upper = track->GetRangeUpper();
if(track->GetDisplayLog()) {
// MB: silly way to undo the work of GetWaveYPos while still getting a logarithmic scale
double dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
double dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
lower = LINEAR_TO_DB(std::max(1.0e-7, lower)) / dBRange + 1.0;
upper = LINEAR_TO_DB(std::max(1.0e-7, upper)) / dBRange + 1.0;
}
@ -3118,7 +3119,7 @@ void TrackArtist::DrawTimeTrack(TimeTrack *track,
void TrackArtist::UpdatePrefs()
{
mdBrange = gPrefs->Read(wxT("/GUI/EnvdBRange"), mdBrange);
mdBrange = gPrefs->Read(ENV_DB_KEY, mdBrange);
mShowClipping = gPrefs->Read(wxT("/GUI/ShowClipping"), mShowClipping);
gPrefs->Flush();

View File

@ -12,8 +12,8 @@ Paul Licameli
#include <algorithm>
#include "Envelope.h"
#include "Internat.h"
#include "prefs/GUISettings.h"
#include "Prefs.h"
#include "xml/XMLWriter.h"
@ -37,7 +37,7 @@ ZoomInfo::~ZoomInfo()
void ZoomInfo::UpdatePrefs()
{
dBr = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
dBr = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
}
/// Converts a position (mouse X coordinate) to

View File

@ -18,6 +18,7 @@
*//*******************************************************************/
#include "../Audacity.h"
#include "GUIPrefs.h"
#include <wx/defs.h>
@ -26,7 +27,7 @@
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "GUIPrefs.h"
#include "GUISettings.h"
GUIPrefs::GUIPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Interface"))
@ -99,9 +100,10 @@ void GUIPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(2);
{
const wxString defaultRange = wxString::Format(wxT("%d"), ENV_DB_RANGE);
S.TieChoice(_("Meter/Waveform dB &range:"),
wxT("/GUI/EnvdBRange"),
wxT("60"),
ENV_DB_KEY,
defaultRange,
mRangeChoices,
mRangeCodes);
S.SetSizeHints(mRangeChoices);

18
src/prefs/GUISettings.h Normal file
View File

@ -0,0 +1,18 @@
/**********************************************************************
Audacity: A Digital Audio Editor
GUIPrefs.h
Paul Licameli
Moved a constant here from Envelope.h where it did not belong
Define the key string in one place here too
**********************************************************************/
#ifndef __AUDACITY_GUI_SETTINGS__
#define __AUDACITY_GUI_SETTINGS__
#define ENV_DB_KEY (wxT("/GUI/EnvdBRange"))
#define ENV_DB_RANGE 60
#endif

View File

@ -19,18 +19,17 @@
*//********************************************************************/
#include "../Audacity.h"
#include "RecordingPrefs.h"
#include <wx/defs.h>
#include <wx/textctrl.h>
#include <algorithm>
#include "../AudioIO.h"
#include "../Envelope.h"
#include "../prefs/GUISettings.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "RecordingPrefs.h"
using std::min;
RecordingPrefs::RecordingPrefs(wxWindow * parent)
@ -113,7 +112,7 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.SetStretchyCol(1);
int dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
int dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
S.TieSlider(_("Sound Activation Le&vel (dB):"),
wxT("/AudioIO/SilenceLevel"),
-50,

View File

@ -60,8 +60,8 @@
#include "../AudioIO.h"
#include "../AColor.h"
#include "../Envelope.h"
#include "../ImageManipulation.h"
#include "../prefs/GUISettings.h"
#include "../Project.h"
#include "../toolbars/MeterToolBar.h"
#include "../toolbars/ControlToolBar.h"
@ -367,7 +367,7 @@ Meter::~Meter()
void Meter::UpdatePrefs()
{
mDBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
mDBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
mMeterRefreshRate = gPrefs->Read(Key(wxT("RefreshRate")), 30);
mGradient = gPrefs->Read(Key(wxT("Bars")), wxT("Gradient")) == wxT("Gradient");

View File

@ -536,6 +536,7 @@
<ClInclude Include="..\..\..\src\import\SpecPowerMeter.h" />
<ClInclude Include="..\..\..\src\ModuleManager.h" />
<ClInclude Include="..\..\..\src\NumberScale.h" />
<ClInclude Include="..\..\..\src\prefs\GUISettings.h" />
<ClInclude Include="..\..\..\src\prefs\SpectrogramSettings.h" />
<ClInclude Include="..\..\..\src\prefs\WaveformPrefs.h" />
<ClInclude Include="..\..\..\src\prefs\WaveformSettings.h" />

View File

@ -1705,6 +1705,9 @@
<ClInclude Include="..\..\..\src\WaveTrackLocation.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\prefs\GUISettings.h">
<Filter>src\prefs</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\audacity.ico">