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.
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
// if anything special is needed for asymmetric ranges
@ -1413,7 +1413,7 @@ double Envelope::SolveIntegralOfInverse( double t0, double area )
if(area == 0.0)
return t0;
unsigned int count = mEnv.Count();
int count = mEnv.Count();
if(count == 0) // 'empty' envelope
return t0 + area * mDefaultValue;

View File

@ -476,14 +476,13 @@ END_EVENT_TABLE()
PluginRegistrationDialog::PluginRegistrationDialog(wxWindow *parent, EffectType type)
: wxDialog(parent,
wxID_ANY,
_("Plug-in Manager: Effects"),
_("Plug-in Manager: Effects, Generators and Analyzers"),
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
mType = type;
mEffects = NULL;
SetLabel(_("Plug-in Manager: Effects")); // Provide visual label
SetName(_("Plug-in Manager: Effects")); // Provide audible label
SetName(GetTitle());
mStates.SetCount(STATE_COUNT);
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)

View File

@ -172,7 +172,7 @@ public:
// 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 *provider, EffectIdentInterface *effect);

View File

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

View File

@ -31,7 +31,6 @@
#include "xml/XMLTagHandler.h"
#include "toolbars/SelectionBarListener.h"
#include "toolbars/SpectralSelectionBarListener.h"
#include "widgets/Meter.h"
#include <wx/defs.h>
#include <wx/event.h>
@ -63,6 +62,7 @@ class EffectPlugs;
class TrackPanel;
class FreqWindow;
class ContrastDialog;
class Meter;
// toolbar classes
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)
&& gain == clip->mSpecPxCache->gain
&& range == clip->mSpecPxCache->range
&& minFreq == clip->mSpecPxCache->minFreq
&& maxFreq == clip->mSpecPxCache->maxFreq
#ifdef EXPERIMENTAL_FFT_Y_GRID
&& fftYGrid==fftYGridOld
#endif //EXPERIMENTAL_FFT_Y_GRID
@ -2047,6 +2049,8 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &cache,
clip->mSpecPxCache->valid = true;
clip->mSpecPxCache->gain = gain;
clip->mSpecPxCache->range = range;
clip->mSpecPxCache->minFreq = minFreq;
clip->mSpecPxCache->maxFreq = maxFreq;
#ifdef EXPERIMENTAL_FIND_NOTES
fftFindNotesOld = fftFindNotes;
findNotesMinAOld = findNotesMinA;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -69,7 +69,7 @@ bool ImportMIDI(wxString fName, NoteTrack * dest)
Alg_event_ptr evt;
int note_count = 0;
int pitch_sum = 0;
while ((evt = iterator.next())) {
while (NULL != (evt = iterator.next())) {
// if the event is a note
if (evt->get_type() == 'n') {
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)
bdwn->Enable(FALSE);
bfnd->Enable(FALSE);
#else
// fix compilation warnings about unused variables
bfnd, bdwn;
#endif
}
S.EndTwoColumn();

View File

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

View File

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

View File

@ -2232,31 +2232,38 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
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)
{
*name += wxString::Format(_(" Active "));
*name += wxT(" ") + wxString::Format(_(" Active "));
}
float peak = 0.;
bool clipped = false;
for (int i = 0; i < m->mNumBars; i++)
{
peak = wxMax(peak, m->mBar[i].peakPeakHold);
if (m->mBar[i].clipping)
clipped = true;
}
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
{
*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):
wxPanel( parent, id, pos, size )
{
SetLabel( _("Vertical Ruler") );
SetName( _("Vertical Ruler") );
SetLabel( _("Timeline") );
SetName(GetLabel());
mLeftOffset = 0;
mCurPos = -1;
@ -1677,9 +1677,9 @@ AdornedRulerPanel::AdornedRulerPanel(wxWindow* parent,
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;
mQuickPlayEnabled = gPrefs->Read(wxT("/QuickPlay/QuickPlayEnabled"), 1L);
mQuickPlayEnabled = !!gPrefs->Read(wxT("/QuickPlay/QuickPlayEnabled"), 1L);
UpdatePrefs();
@ -2188,7 +2188,7 @@ void AdornedRulerPanel::ShowMenu(const wxPoint & pos)
DrawQuickPlayIndicator(&cdc, true);
}
void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent& evt)
void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent&)
{
mQuickPlayEnabled = (mQuickPlayEnabled)? false : true;
gPrefs->Write(wxT("/QuickPlay/QuickPlayEnabled"), mQuickPlayEnabled);
@ -2196,7 +2196,7 @@ void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent& evt)
RegenerateTooltips();
}
void AdornedRulerPanel::OnSyncSelToQuickPlay(wxCommandEvent& evt)
void AdornedRulerPanel::OnSyncSelToQuickPlay(wxCommandEvent&)
{
mPlayRegionDragsSelection = (mPlayRegionDragsSelection)? false : true;
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;
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)
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())
mProject->OnUnlockPlayRegion();