1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Merge branch 'master' into scrubbing

This commit is contained in:
Paul Licameli 2015-06-11 10:19:22 -04:00
commit e2f6133268
19 changed files with 75 additions and 43 deletions

View File

@ -336,7 +336,7 @@ float Envelope::ValueOfPixel( int y, int height, bool upper, bool dB,
// TODO: Cache the gPrefs value. Reading it every time is inefficient. // TODO: Cache the gPrefs value. Reading it every time is inefficient.
dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE); dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
float v = ::ValueOfPixel(y, height, mContourOffset, dB, dBRange, zoomMin, zoomMax); float v = ::ValueOfPixel(y, height, 0 != mContourOffset, dB, dBRange, zoomMin, zoomMax);
// MB: this is mostly equivalent to what the old code did, I'm not sure // MB: this is mostly equivalent to what the old code did, I'm not sure
// if anything special is needed for asymmetric ranges // if anything special is needed for asymmetric ranges
@ -1413,7 +1413,7 @@ double Envelope::SolveIntegralOfInverse( double t0, double area )
if(area == 0.0) if(area == 0.0)
return t0; return t0;
unsigned int count = mEnv.Count(); int count = mEnv.Count();
if(count == 0) // 'empty' envelope if(count == 0) // 'empty' envelope
return t0 + area * mDefaultValue; return t0 + area * mDefaultValue;

View File

@ -476,14 +476,13 @@ END_EVENT_TABLE()
PluginRegistrationDialog::PluginRegistrationDialog(wxWindow *parent, EffectType type) PluginRegistrationDialog::PluginRegistrationDialog(wxWindow *parent, EffectType type)
: wxDialog(parent, : wxDialog(parent,
wxID_ANY, wxID_ANY,
_("Plug-in Manager: Effects"), _("Plug-in Manager: Effects, Generators and Analyzers"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{ {
mType = type; mType = type;
mEffects = NULL; mEffects = NULL;
SetLabel(_("Plug-in Manager: Effects")); // Provide visual label SetName(GetTitle());
SetName(_("Plug-in Manager: Effects")); // Provide audible label
mStates.SetCount(STATE_COUNT); mStates.SetCount(STATE_COUNT);
mStates[STATE_Enabled] = _("Enabled"); mStates[STATE_Enabled] = _("Enabled");
@ -1346,14 +1345,17 @@ void PluginDescriptor::SetImporterExtensions(const wxArrayString & extensions)
// //
// ============================================================================ // ============================================================================
bool PluginManager::IsPluginRegistered(const PluginID & ID) bool PluginManager::IsPluginRegistered(const wxString & path)
{ {
if (mPlugins.find(ID) == mPlugins.end()) for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); ++iter)
{ {
return false; if (iter->second.GetPath().IsSameAs(path))
{
return true;
}
} }
return true; return false;
} }
const PluginID & PluginManager::RegisterPlugin(ModuleInterface *module) const PluginID & PluginManager::RegisterPlugin(ModuleInterface *module)

View File

@ -172,7 +172,7 @@ public:
// PluginManagerInterface implementation // PluginManagerInterface implementation
virtual bool IsPluginRegistered(const PluginID & ID); virtual bool IsPluginRegistered(const wxString & path);
virtual const PluginID & RegisterPlugin(ModuleInterface *module); virtual const PluginID & RegisterPlugin(ModuleInterface *module);
virtual const PluginID & RegisterPlugin(ModuleInterface *provider, EffectIdentInterface *effect); virtual const PluginID & RegisterPlugin(ModuleInterface *provider, EffectIdentInterface *effect);

View File

@ -50,6 +50,7 @@ scroll information. It also has some status flags.
*//*******************************************************************/ *//*******************************************************************/
#include "Audacity.h" #include "Audacity.h"
#include "Project.h"
#include <stdio.h> #include <stdio.h>
#include <iostream> #include <iostream>
@ -90,8 +91,6 @@ scroll information. It also has some status flags.
#endif #endif
#endif #endif
#include "Project.h"
#include "FreqWindow.h" #include "FreqWindow.h"
#include "effects/Contrast.h" #include "effects/Contrast.h"
#include "AutoRecovery.h" #include "AutoRecovery.h"

View File

@ -31,7 +31,6 @@
#include "xml/XMLTagHandler.h" #include "xml/XMLTagHandler.h"
#include "toolbars/SelectionBarListener.h" #include "toolbars/SelectionBarListener.h"
#include "toolbars/SpectralSelectionBarListener.h" #include "toolbars/SpectralSelectionBarListener.h"
#include "widgets/Meter.h"
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/event.h> #include <wx/event.h>
@ -63,6 +62,7 @@ class EffectPlugs;
class TrackPanel; class TrackPanel;
class FreqWindow; class FreqWindow;
class ContrastDialog; class ContrastDialog;
class Meter;
// toolbar classes // toolbar classes
class ControlToolBar; class ControlToolBar;

View File

@ -2029,6 +2029,8 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &cache,
if (!updated && clip->mSpecPxCache->valid && (clip->mSpecPxCache->len == mid.height * mid.width) if (!updated && clip->mSpecPxCache->valid && (clip->mSpecPxCache->len == mid.height * mid.width)
&& gain == clip->mSpecPxCache->gain && gain == clip->mSpecPxCache->gain
&& range == clip->mSpecPxCache->range && range == clip->mSpecPxCache->range
&& minFreq == clip->mSpecPxCache->minFreq
&& maxFreq == clip->mSpecPxCache->maxFreq
#ifdef EXPERIMENTAL_FFT_Y_GRID #ifdef EXPERIMENTAL_FFT_Y_GRID
&& fftYGrid==fftYGridOld && fftYGrid==fftYGridOld
#endif //EXPERIMENTAL_FFT_Y_GRID #endif //EXPERIMENTAL_FFT_Y_GRID
@ -2047,6 +2049,8 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &cache,
clip->mSpecPxCache->valid = true; clip->mSpecPxCache->valid = true;
clip->mSpecPxCache->gain = gain; clip->mSpecPxCache->gain = gain;
clip->mSpecPxCache->range = range; clip->mSpecPxCache->range = range;
clip->mSpecPxCache->minFreq = minFreq;
clip->mSpecPxCache->maxFreq = maxFreq;
#ifdef EXPERIMENTAL_FIND_NOTES #ifdef EXPERIMENTAL_FIND_NOTES
fftFindNotesOld = fftFindNotes; fftFindNotesOld = fftFindNotes;
findNotesMinAOld = findNotesMinA; findNotesMinAOld = findNotesMinA;

View File

@ -964,7 +964,6 @@ void SpecCache::Populate
// FFT length may be longer than the window of samples that affect results // FFT length may be longer than the window of samples that affect results
// because of zero padding done for increased frequency resolution // because of zero padding done for increased frequency resolution
const int fftLen = windowSize * zeroPaddingFactor; const int fftLen = windowSize * zeroPaddingFactor;
const int padding = (windowSize * (zeroPaddingFactor - 1)) / 2;
std::vector<float> buffer( std::vector<float> buffer(
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS #ifdef EXPERIMENTAL_FFT_SKIP_POINTS

View File

@ -44,6 +44,7 @@ public:
values = new float[len]; values = new float[len];
valid = false; valid = false;
range = gain = -1; range = gain = -1;
minFreq = maxFreq = -1;
} }
~SpecPxCache() ~SpecPxCache()
@ -57,6 +58,8 @@ public:
int range; int range;
int gain; int gain;
int minFreq;
int maxFreq;
}; };
class WaveClip; class WaveClip;

View File

@ -32,7 +32,7 @@ CommandHandler::~CommandHandler()
delete mCurrentContext; delete mCurrentContext;
} }
void CommandHandler::SetProject(AudacityProject *proj) void CommandHandler::SetProject(AudacityProject *)
{ {
// TODO: Review if the extend command handling is ever utilized // TODO: Review if the extend command handling is ever utilized
// mCurrentContext->proj = proj; // mCurrentContext->proj = proj;

View File

@ -34,7 +34,7 @@ class wxWindow;
#include "../Internat.h" #include "../Internat.h"
#include "../widgets/ProgressDialog.h" #include "../widgets/ProgressDialog.h"
#define BUILTIN_EFFECT_PREFIX wxT("Builtin Effect: ") #define BUILTIN_EFFECT_PREFIX wxT("Built-in Effect: ")
class SelectedRegion; class SelectedRegion;
class TimeWarper; class TimeWarper;

View File

@ -288,11 +288,11 @@ bool BuiltinEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
{ {
for (size_t i = 0; i < WXSIZEOF(kEffectNames); i++) for (size_t i = 0; i < WXSIZEOF(kEffectNames); i++)
{ {
PluginID ID(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]); wxString path(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
if (!pm.IsPluginRegistered(ID)) if (!pm.IsPluginRegistered(path))
{ {
RegisterPlugin(pm, ID); RegisterPlugin(pm, path);
} }
} }

View File

@ -208,11 +208,12 @@ bool LadspaEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxSt
// As a courtesy to some plug-ins that might be bridges to // As a courtesy to some plug-ins that might be bridges to
// open other plug-ins, we set the current working // open other plug-ins, we set the current working
// directory to be the plug-in's directory. // directory to be the plug-in's directory.
wxString envpath;
wxString saveOldCWD = ::wxGetCwd(); bool hadpath = wxGetEnv(wxT("PATH"), &envpath);
wxString prefix = ::wxPathOnly(path); wxSetEnv(wxT("PATH"), f.GetPath() + wxFILE_SEP_PATH + envpath);
::wxSetWorkingDirectory(prefix); wxString saveOldCWD = f.GetCwd();
f.SetCwd();
int index = 0; int index = 0;
LADSPA_Descriptor_Function mainFn = NULL; LADSPA_Descriptor_Function mainFn = NULL;
wxDynamicLibrary lib; wxDynamicLibrary lib;
@ -236,7 +237,8 @@ bool LadspaEffectsModule::RegisterPlugin(PluginManagerInterface & pm, const wxSt
lib.Unload(); lib.Unload();
} }
::wxSetWorkingDirectory(saveOldCWD); wxSetWorkingDirectory(saveOldCWD);
hadpath ? wxSetEnv(wxT("PATH"), envpath) : wxUnsetEnv(wxT("PATH"));
return index > 0; return index > 0;
} }
@ -1507,6 +1509,13 @@ bool LadspaEffect::Load()
return true; return true;
} }
wxFileName f = mPath;
wxString envpath;
bool hadpath = wxGetEnv(wxT("PATH"), &envpath);
wxSetEnv(wxT("PATH"), f.GetPath() + wxFILE_SEP_PATH + envpath);
wxString saveOldCWD = f.GetCwd();
f.SetCwd();
LADSPA_Descriptor_Function mainFn = NULL; LADSPA_Descriptor_Function mainFn = NULL;
if (mLib.Load(mPath, wxDL_NOW)) if (mLib.Load(mPath, wxDL_NOW))
@ -1526,6 +1535,9 @@ bool LadspaEffect::Load()
mLib.Unload(); mLib.Unload();
} }
wxSetWorkingDirectory(saveOldCWD);
hadpath ? wxSetEnv(wxT("PATH"), envpath) : wxUnsetEnv(wxT("PATH"));
return false; return false;
} }

View File

@ -1391,7 +1391,7 @@ void NyquistEffect::Parse(wxString line)
long v; long v;
// Splits are restored by default. Set to 0 to prevent. // Splits are restored by default. Set to 0 to prevent.
tokens[1].ToLong(&v); tokens[1].ToLong(&v);
mRestoreSplits = v; mRestoreSplits = !!v;
return; return;
} }
#endif #endif

View File

@ -69,7 +69,7 @@ bool ImportMIDI(wxString fName, NoteTrack * dest)
Alg_event_ptr evt; Alg_event_ptr evt;
int note_count = 0; int note_count = 0;
int pitch_sum = 0; int pitch_sum = 0;
while ((evt = iterator.next())) { while (NULL != (evt = iterator.next())) {
// if the event is a note // if the event is a note
if (evt->get_type() == 'n') { if (evt->get_type() == 'n') {
Alg_note_ptr note = (Alg_note_ptr) evt; Alg_note_ptr note = (Alg_note_ptr) evt;

View File

@ -140,6 +140,9 @@ void LibraryPrefs::PopulateOrExchange(ShuttleGui & S)
#if !defined(USE_FFMPEG) || defined(DISABLE_DYNAMIC_LOADING_FFMPEG) #if !defined(USE_FFMPEG) || defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
bdwn->Enable(FALSE); bdwn->Enable(FALSE);
bfnd->Enable(FALSE); bfnd->Enable(FALSE);
#else
// fix compilation warnings about unused variables
bfnd, bdwn;
#endif #endif
} }
S.EndTwoColumn(); S.EndTwoColumn();

View File

@ -26,6 +26,8 @@
#include "../ShuttleGui.h" #include "../ShuttleGui.h"
#include "../FFT.h" #include "../FFT.h"
#include <algorithm>
SpectrumPrefs::SpectrumPrefs(wxWindow * parent) SpectrumPrefs::SpectrumPrefs(wxWindow * parent)
: PrefsPanel(parent, _("Spectrograms")) : PrefsPanel(parent, _("Spectrograms"))
{ {

View File

@ -74,8 +74,9 @@ class SpectrumPrefs:public PrefsPanel
}; };
struct SpectrogramSettings class SpectrogramSettings
{ {
public:
static SpectrogramSettings &defaults(); static SpectrogramSettings &defaults();
SpectrogramSettings(); SpectrogramSettings();
~SpectrogramSettings(); ~SpectrogramSettings();

View File

@ -2232,31 +2232,38 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
if (m->mMonitoring) if (m->mMonitoring)
{ {
*name += wxString::Format(_(" Monitoring ")); // translations of strings such as " Monitoring " did not
// always retain the leading space. Therefore a space has
// been added to ensure at least one space, and stop
// words from being merged
*name += wxT(" ") + wxString::Format(_(" Monitoring "));
} }
else if (m->mActive) else if (m->mActive)
{ {
*name += wxString::Format(_(" Active ")); *name += wxT(" ") + wxString::Format(_(" Active "));
} }
float peak = 0.; float peak = 0.;
bool clipped = false;
for (int i = 0; i < m->mNumBars; i++) for (int i = 0; i < m->mNumBars; i++)
{ {
peak = wxMax(peak, m->mBar[i].peakPeakHold); peak = wxMax(peak, m->mBar[i].peakPeakHold);
if (m->mBar[i].clipping)
clipped = true;
} }
if (m->mDB) if (m->mDB)
{ {
*name += wxString::Format(_(" Peak %2.f dB"), (peak * m->mDBRange) - m->mDBRange); *name += wxT(" ") + wxString::Format(_(" Peak %2.f dB"), (peak * m->mDBRange) - m->mDBRange);
} }
else else
{ {
*name += wxString::Format(_(" Peak %.2f "), peak); *name += wxT(" ") + wxString::Format(_(" Peak %.2f "), peak);
} }
if (m->IsClipping()) if (clipped)
{ {
*name += wxString::Format(_(" Clipped ")); *name += wxT(" ") + wxString::Format(_(" Clipped "));
} }
} }

View File

@ -1637,8 +1637,8 @@ AdornedRulerPanel::AdornedRulerPanel(wxWindow* parent,
ViewInfo *viewinfo): ViewInfo *viewinfo):
wxPanel( parent, id, pos, size ) wxPanel( parent, id, pos, size )
{ {
SetLabel( _("Vertical Ruler") ); SetLabel( _("Timeline") );
SetName( _("Vertical Ruler") ); SetName(GetLabel());
mLeftOffset = 0; mLeftOffset = 0;
mCurPos = -1; mCurPos = -1;
@ -1677,9 +1677,9 @@ AdornedRulerPanel::AdornedRulerPanel(wxWindow* parent,
mIsRecording = false; mIsRecording = false;
mTimelineToolTip = gPrefs->Read(wxT("/QuickPlay/ToolTips"), 1L); mTimelineToolTip = !!gPrefs->Read(wxT("/QuickPlay/ToolTips"), 1L);
mPlayRegionDragsSelection = (gPrefs->Read(wxT("/QuickPlay/DragSelection"), 0L) == 1)? true : false; mPlayRegionDragsSelection = (gPrefs->Read(wxT("/QuickPlay/DragSelection"), 0L) == 1)? true : false;
mQuickPlayEnabled = gPrefs->Read(wxT("/QuickPlay/QuickPlayEnabled"), 1L); mQuickPlayEnabled = !!gPrefs->Read(wxT("/QuickPlay/QuickPlayEnabled"), 1L);
UpdatePrefs(); UpdatePrefs();
@ -2188,7 +2188,7 @@ void AdornedRulerPanel::ShowMenu(const wxPoint & pos)
DrawQuickPlayIndicator(&cdc, true); DrawQuickPlayIndicator(&cdc, true);
} }
void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent& evt) void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent&)
{ {
mQuickPlayEnabled = (mQuickPlayEnabled)? false : true; mQuickPlayEnabled = (mQuickPlayEnabled)? false : true;
gPrefs->Write(wxT("/QuickPlay/QuickPlayEnabled"), mQuickPlayEnabled); gPrefs->Write(wxT("/QuickPlay/QuickPlayEnabled"), mQuickPlayEnabled);
@ -2196,7 +2196,7 @@ void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent& evt)
RegenerateTooltips(); RegenerateTooltips();
} }
void AdornedRulerPanel::OnSyncSelToQuickPlay(wxCommandEvent& evt) void AdornedRulerPanel::OnSyncSelToQuickPlay(wxCommandEvent&)
{ {
mPlayRegionDragsSelection = (mPlayRegionDragsSelection)? false : true; mPlayRegionDragsSelection = (mPlayRegionDragsSelection)? false : true;
gPrefs->Write(wxT("/QuickPlay/DragSelection"), mPlayRegionDragsSelection); gPrefs->Write(wxT("/QuickPlay/DragSelection"), mPlayRegionDragsSelection);
@ -2233,7 +2233,7 @@ void AdornedRulerPanel::HandleSnapping()
} }
void AdornedRulerPanel::OnTimelineToolTips(wxCommandEvent& evt) void AdornedRulerPanel::OnTimelineToolTips(wxCommandEvent&)
{ {
mTimelineToolTip = (mTimelineToolTip)? false : true; mTimelineToolTip = (mTimelineToolTip)? false : true;
gPrefs->Write(wxT("/QuickPlay/ToolTips"), mTimelineToolTip); gPrefs->Write(wxT("/QuickPlay/ToolTips"), mTimelineToolTip);
@ -2244,7 +2244,7 @@ void AdornedRulerPanel::OnTimelineToolTips(wxCommandEvent& evt)
} }
void AdornedRulerPanel::OnAutoScroll(wxCommandEvent& evt) void AdornedRulerPanel::OnAutoScroll(wxCommandEvent&)
{ {
if (mViewInfo->bUpdateTrackIndicator) if (mViewInfo->bUpdateTrackIndicator)
gPrefs->Write(wxT("/GUI/AutoScroll"), false); gPrefs->Write(wxT("/GUI/AutoScroll"), false);
@ -2255,7 +2255,7 @@ void AdornedRulerPanel::OnAutoScroll(wxCommandEvent& evt)
} }
void AdornedRulerPanel::OnLockPlayRegion(wxCommandEvent& evt) void AdornedRulerPanel::OnLockPlayRegion(wxCommandEvent&)
{ {
if (mProject->IsPlayRegionLocked()) if (mProject->IsPlayRegionLocked())
mProject->OnUnlockPlayRegion(); mProject->OnUnlockPlayRegion();