1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-28 22:28:44 +02:00

Merge branch 'master' into scrubbing

This commit is contained in:
Paul Licameli 2015-05-23 23:20:52 -04:00
commit edf05c1ce1
37 changed files with 792 additions and 566 deletions

View File

@ -81,9 +81,6 @@ public:
// Whether the effect supports realtime previewing (while audio is playing).
virtual bool SupportsRealtime() = 0;
// Whether the effect should be shown in menus right from the start.
virtual bool EnableFromGetGo(){ return false;};
// Can the effect be used without the UI.
virtual bool SupportsAutomation() = 0;
};

View File

@ -1,4 +1,4 @@
;nyquist plugin
;nyquist plug-in
;version 4
;type process
;name "Spectral edit multi tool"

View File

@ -1,4 +1,4 @@
;nyquist plugin
;nyquist plug-in
;version 4
;type process
;preview enabled

View File

@ -1,4 +1,4 @@
;nyquist plugin
;nyquist plug-in
;version 4
;type process
;preview enabled

View File

@ -1,8 +1,9 @@
;nyquist plug-in
;version 3
;version 4
;type generate
;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin"
;name "Click Track..."
;preview linear
;action "Generating Click Track..."
;info "For help, select one of two help screens in 'Action choice' below."
;author "Dominic Mazzoni"
@ -13,8 +14,8 @@
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html .
;; original clicktrack.ny by Dominic Mazzoni,
;; modified by David R. Sky and Steve Daulton.
;; Minimum Audacity version: 1.3.4
;;
;; Updated to v4 by Steve Daulton May 2015
;; bug fixes and restructured by Steve Daulton Sept 2011.
;; string input verification added by Steve Daulton, 2009.
;; added click pitch [user request] and sound types fields September 2007 (D.R.Sky).
@ -286,6 +287,12 @@ Use whole numbers only.~%"))))
(if m-s (setq measures
(/ (m-s-to-seconds m-s)(* sig beatlen))))
;if previewing, restrict number of measures
(let ((preview (/ (get '*project* 'preview-duration)
(* sig beatlen))))
(if (not (get '*track* 'view)) ;NIL if preview
(setq measures (min preview measures))))
;round up number of measures
(setq measures (round-up measures))

View File

@ -1,4 +1,4 @@
;nyquist plugin
;nyquist plug-in
;version 4
;type process
;name "Crossfade Tracks..."

View File

@ -1,9 +1,9 @@
;nyquist plug-in
;version 3
;version 4
;type generate
;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin"
;name "Pluck..."
;preview linear
;action "Generating pluck sound..."
;info "MIDI values for C notes: 36, 48, 60 [middle C], 72, 84, 96."
;author "David R.Sky"
@ -12,7 +12,7 @@
;; Released under terms of the GNU General Public License version 2:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html .
;control p "Pluck MIDI pitch" int "" 60 1 127
;control pitch "Pluck MIDI pitch" int "" 60 1 120
;control fade "Fade-out type" choice "abrupt,gradual" 0
;control dur "Duration [seconds]" real "" 1 0.1 30
@ -25,12 +25,24 @@
; maximum amplitude. As defined in Audacity, 'pluck' has
; incorrect length duration and clipping at the start which gives
; rise to DC offset. Using 'snd-pluck' avoids the clipping and
; offset so we don't need the highpass8 filter that we used before.
; reduces offset so we don't need the highpass8 filter that we used before.
; Updated to v4 by Steve Daulton May 2015
; set final-amp for abrupt or gradual fade
(setf final-amp (if (= fade 1) 0.001 0.000001))
(let* ((pluck-sound (snd-pluck *sound-srate* (step-to-hz p) 0 dur final-amp))
;; Get length of preview
(setq pdur
(if (get '*track* 'view) ;NIL if preview
dur
(get '*project* 'preview-duration)))
(let* ((pluck-sound (snd-pluck *sound-srate* (step-to-hz pitch) 0 dur final-amp))
(pluck-sound (extract-abs 0 pdur pluck-sound)) ; shorten if necessary for preview.
(max-peak (peak pluck-sound ny:all)))
(scale (/ 0.8 max-peak) pluck-sound))
;; snd-pluck has a random element and will occasionally produce
;; zero amplitude at very high pitch settings. Avoid division by zero.
(if (> max-peak 0)
(scale (/ 0.8 max-peak) pluck-sound)
pluck-sound))

View File

@ -1,14 +1,15 @@
;nyquist plug-in
;version 3
;version 4
;type generate
;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin"
;preview linear
;name "Risset Drum..."
;action "Generating Risset Drum..."
;author "Steven Jones"
;copyright "Released under terms of the GNU General Public License version 2"
;; rissetdrum.ny by Steven Jones, after Jean Claude Risset.
;; Updated by Steve Daulton July 2012.
;; Updated by Steve Daulton July 2012 and May 2015.
;; Released under terms of the GNU General Public License version 2:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
;;
@ -16,7 +17,7 @@
;; http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference
;control freq "Frequency (Hz)" real "" 100 50 2000
;control decay "Decay (seconds)" real "" 2 0.125 10
;control decay "Decay (seconds)" real "" 2 0.1 60
;control cf "Center frequency of noise (Hz)" real "" 500 100 5000
;control bw "Width of noise band (Hz)" real "" 400 10 1000
;control noise "Amount of noise in mix (percent)" real "" 25 0 100
@ -26,6 +27,8 @@
(defun sanitise (val minx maxx)
(min (max val minx) maxx))
;; Not required with validation in Audacity 2.1.1 but left
;; for compatibility.
(setq freq (sanitise freq 1 (/ *sound-srate* 2)))
(setq decay (sanitise decay 0.1 600))
(setq cf (sanitise cf 1 (/ *sound-srate* 2)))
@ -33,6 +36,12 @@
(setq noise (sanitise (/ noise 100) 0 1))
(setq gain (sanitise gain 0 1))
;; Get length of preview
(setq pdur
(if (get '*track* 'view) ;NIL if preview
decay
(get '*project* 'preview-duration)))
(setq *rdrum-table*
(list
(mult 0.17
@ -73,5 +82,6 @@
;; Generate and normalize
(let* ((output (risset-drum freq decay cf bw noise))
(output (extract-abs 0 pdur output)) ; shorten if necessary for preview.
(peakval (peak output ny:all)))
(scale (/ gain peakval) output))

2
src/AutoRecovery.cpp Normal file → Executable file
View File

@ -692,7 +692,7 @@ bool AutoSaveFile::Decode(const wxString & fileName)
file.Close();
// Decode to a temporary file to preserve the orignal.
wxString tempName = fn.CreateTempFileName(fn.GetPath(true));
wxString tempName = fn.CreateTempFileName(fn.GetPath());
XMLFileWriter out;

0
src/Experimental.h Normal file → Executable file
View File

1
src/FreqWindow.cpp Normal file → Executable file
View File

@ -557,6 +557,7 @@ void FreqWindow::GetAudio()
{
if (mData) {
delete [] mData;
mData = NULL;
}
mDataLen = 0;

View File

@ -39,6 +39,7 @@
#include "widgets/NumericTextCtrl.h"
#include "FileDialog.h"
#include <limits>
enum Column
{
@ -380,7 +381,6 @@ void LabelDialog::FindAllLabels()
TrackListIterator iter(mTracks);
Track *t;
mInitialRow = -1;
// Add labels from all label tracks
for (t = iter.First(); t; t = iter.Next()) {
@ -389,6 +389,8 @@ void LabelDialog::FindAllLabels()
}
}
FindInitialRow();
if (mData.GetCount() == 0) {
wxCommandEvent e;
OnInsert(e);
@ -414,9 +416,45 @@ void LabelDialog::AddLabels(LabelTrack *t)
rd->title = ls->title;
mData.Add(rd);
}
}
if (i == t->getSelectedIndex()) {
mInitialRow = mData.GetCount() - 1;
void LabelDialog::FindInitialRow()
{
int cnt = mData.GetCount();
mInitialRow = -1;
if (cnt == 0)
return;
// find closest previous label
double distMin = std::numeric_limits<double>::max();
double dist;
double t0 = mViewInfo->selectedRegion.t0();
int i;
for (i = 0; i < cnt; i++)
{
dist = t0 - mData[i]->selectedRegion.t0();
if (dist >= 0.0 && dist < distMin)
{
mInitialRow = i;
distMin = dist;
}
}
// if no previous label was found, find first label
if (mInitialRow == -1)
{
double t0Min = std::numeric_limits<double>::max();
for (i = 0; i < cnt; i++)
{
if (mData[i]->selectedRegion.t0() < t0Min)
{
mInitialRow = i;
t0Min = mData[i]->selectedRegion.t0();
}
}
}
}

View File

@ -50,6 +50,7 @@ class LabelDialog:public wxDialog
bool Validate();
void FindAllLabels();
void AddLabels(LabelTrack *t);
void FindInitialRow();
wxString TrackName(int & index, wxString dflt = _("Label Track"));
void OnUpdate(wxCommandEvent &event);

View File

@ -844,7 +844,7 @@ void AudacityProject::CreateMenusAndCommands()
c->BeginSubMenu(_("Add &New"));
c->AddItem(wxT("NewAudioTrack"), _("&Audio Track"), FN(OnNewWaveTrack), wxT("Ctrl+Shift+N"));
c->AddItem(wxT("NewMonoTrack"), _("&Mono Track"), FN(OnNewWaveTrack), wxT("Ctrl+Shift+N"));
c->AddItem(wxT("NewStereoTrack"), _("&Stereo Track"), FN(OnNewStereoTrack));
c->AddItem(wxT("NewLabelTrack"), _("&Label Track"), FN(OnNewLabelTrack));
c->AddItem(wxT("NewTimeTrack"), _("&Time Track"), FN(OnNewTimeTrack));
@ -1014,7 +1014,7 @@ void AudacityProject::CreateMenusAndCommands()
PopulateEffectsMenu(c,
EffectTypeProcess,
AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag | IsRealtimeNotActiveFlag);
IsRealtimeNotActiveFlag);
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
c->AddSeparator();
// We could say Manage Effects on the menu, but More... is more intuitive.
@ -1039,7 +1039,7 @@ void AudacityProject::CreateMenusAndCommands()
PopulateEffectsMenu(c,
EffectTypeAnalyze,
AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag,
AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag | IsRealtimeNotActiveFlag);
IsRealtimeNotActiveFlag);
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
c->AddSeparator();
c->AddItem(wxT("ManageAnalyzers"), _("More..."), FN(OnManageAnalyzers));
@ -3300,12 +3300,10 @@ void AudacityProject::OnRepeatLastEffect(int WXUNUSED(index))
void AudacityProject::OnManagePluginsMenu(EffectType Type)
void AudacityProject::OnManagePluginsMenu(EffectType type)
{
//gPrefs->Write( wxT("/Plugins/Rescan"), true);
//gPrefs->Read(wxT("/Plugins/CheckForUpdates"), &doCheck, true);
PluginManager::Get().CheckForUpdates(Type);
if (PluginManager::Get().ShowManager(this, type))
{
for (size_t i = 0; i < gAudacityProjects.GetCount(); i++) {
AudacityProject *p = gAudacityProjects[i];
@ -3321,11 +3319,23 @@ void AudacityProject::OnManagePluginsMenu(EffectType Type)
p->SetSize(r.GetSize());
#endif
}
}
}
void AudacityProject::OnManageGenerators(){ OnManagePluginsMenu(EffectTypeGenerate); }
void AudacityProject::OnManageEffects(){ OnManagePluginsMenu(EffectTypeProcess); }
void AudacityProject::OnManageAnalyzers(){ OnManagePluginsMenu(EffectTypeAnalyze); }
void AudacityProject::OnManageGenerators()
{
OnManagePluginsMenu(EffectTypeGenerate);
}
void AudacityProject::OnManageEffects()
{
OnManagePluginsMenu(EffectTypeProcess);
}
void AudacityProject::OnManageAnalyzers()
{
OnManagePluginsMenu(EffectTypeAnalyze);
}

862
src/PluginManager.cpp Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -156,13 +156,11 @@ private:
//
///////////////////////////////////////////////////////////////////////////////
WX_DECLARE_STRING_HASH_MAP(wxArrayString, ArrayStringMap);
//WX_DECLARE_STRING_HASH_MAP(PluginDescriptor, PluginMap);
typedef std::map<PluginID, PluginDescriptor> PluginMap;
typedef wxArrayString PluginIDList;
class ProviderMap;
class PluginRegistrationDialog;
class PluginManager : public PluginManagerInterface
@ -256,24 +254,20 @@ public:
wxString GetName(const PluginID & ID);
IdentInterface *GetInstance(const PluginID & ID);
void CheckForUpdates(EffectType Type=EffectTypeNone);
void CheckForUpdates();
bool ShowManager(wxWindow *parent, EffectType type = EffectTypeNone);
// Here solely for the purpose of Nyquist Workbench until
// a better solution is devised.
const PluginID & RegisterPlugin(EffectIdentInterface *effect);
public:
bool mbRegisterAndEnable;
private:
void Load();
void LoadGroup(PluginType type);
void Save();
void SaveGroup(PluginType type);
void DisableMissing();
wxArrayString IsNewOrUpdated(const wxArrayString & paths);
PluginDescriptor & CreatePlugin(const PluginID & id, IdentInterface *ident, PluginType type);
wxFileConfig *GetSettings();

11
src/ShuttleGui.cpp Normal file → Executable file
View File

@ -2225,18 +2225,23 @@ wxSizer *CreateStdButtonSizer(wxWindow *parent, long buttons, wxWindow *extra)
// Add any buttons that need to cuddle up to the right hand cluster
if( buttons & eDebugButton )
{
size_t lastLastSpacer = 0;
size_t lastSpacer = 0;
wxSizerItemList & list = bs->GetChildren();
for ( size_t i = 0, cnt = list.GetCount(); i < cnt; i++ )
for( size_t i = 0, cnt = list.GetCount(); i < cnt; i++ )
{
if ( list[i]->IsSpacer() )
if( list[i]->IsSpacer() )
{
lastSpacer = i;
}
else
{
lastLastSpacer = lastSpacer;
}
}
b = new wxButton( parent, eDebugID, _("Debu&g") );
bs->Insert( lastSpacer + 1, b, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin );
bs->Insert( lastLastSpacer + 1, b, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, margin );
}
wxSizer * s;

View File

@ -214,15 +214,15 @@ void EffectAmplify::PopulateOrExchange(ShuttleGui & S)
// Peak
S.StartMultiColumn(2, wxCENTER);
{
FloatingPointValidator<double> vldNewPeak(2, &mNewPeak);
int precission = 2;
FloatingPointValidator<double> vldNewPeak(precission, &mNewPeak);
double minAmp = MIN_Amp + (20.0 * log10(mPeak));
double maxAmp = MAX_Amp + (20.0 * log10(mPeak));
// TODO: This is a hack that should be fixed in the validator:
// If MAX_Amp is negative, then the truncated text value will be greater
// than the actual float value.
// Add 0.05 to the max value, equivalent to rounding the right way.
if (maxAmp < 0)
maxAmp += 0.005;
// min and max need same precision as what we're validating (bug 963)
minAmp = Internat::CompatibleToDouble(Internat::ToString(minAmp, precission));
maxAmp = Internat::CompatibleToDouble(Internat::ToString(maxAmp, precission));
vldNewPeak.SetRange(minAmp, maxAmp);
mNewPeakT = S.Id(ID_Peak).AddTextBox(_("New Peak Amplitude (dB):"), wxT(""), 12);
mNewPeakT->SetValidator(vldNewPeak);

View File

@ -44,7 +44,6 @@ public:
// EffectIdentInterface implementation
virtual EffectType GetType();
virtual bool EnableFromGetGo(){ return false;};
// EffectClientInterface implementation

View File

@ -207,7 +207,8 @@ void EffectChangeTempo::PopulateOrExchange(ShuttleGui & S)
//
S.AddUnits(_("Length (seconds):"));
FloatingPointValidator<double> vldFromLength(2, &m_FromLength, NUM_VAL_TWO_TRAILING_ZEROES);
int precission = 2;
FloatingPointValidator<double> vldFromLength(precission, &m_FromLength, NUM_VAL_TWO_TRAILING_ZEROES);
m_pTextCtrl_FromLength = S.Id(ID_FromLength)
.AddTextBox(_("from"), wxT(""), 12);
m_pTextCtrl_FromLength->SetName(_("From length in seconds"));
@ -215,8 +216,14 @@ void EffectChangeTempo::PopulateOrExchange(ShuttleGui & S)
m_pTextCtrl_FromLength->Enable(false); // Disable because the value comes from the user selection.
FloatingPointValidator<double> vldToLength(2, &m_ToLength, NUM_VAL_TWO_TRAILING_ZEROES);
vldToLength.SetRange((m_FromLength * 100.0) / (100.0 + MAX_Percentage),
(m_FromLength * 100.0) / (100.0 + MIN_Percentage));
// min and max need same precision as what we're validating (bug 963)
double minLength = (m_FromLength * 100.0) / (100.0 + MAX_Percentage);
double maxLength = (m_FromLength * 100.0) / (100.0 + MIN_Percentage);
minLength = Internat::CompatibleToDouble(Internat::ToString(minLength, precission));
maxLength = Internat::CompatibleToDouble(Internat::ToString(maxLength, precission));
vldToLength.SetRange(minLength, maxLength);
m_pTextCtrl_ToLength = S.Id(ID_ToLength)
.AddTextBox(_("to"), wxT(""), 12);
m_pTextCtrl_ToLength->SetName(_("To length in seconds"));

52
src/effects/Effect.cpp Normal file → Executable file
View File

@ -2396,15 +2396,19 @@ void Effect::Preview(bool dryOnly)
gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &previewLen);
double rate = mProjectRate;
double warpedPreviewLength = CalcPreviewInputLength(previewLen);
double t0 = mT0;
double t1 = t0 + CalcPreviewInputLength(previewLen);
double t1 = t0 + warpedPreviewLength;
// Generators can run without a selection.
if (GetType() == EffectTypeGenerate) {
// If a generator varies over time, it must use the selected duration.
// otherwise set it as a linear effect and process no more than the preview length.
// TODO: When previewing non-linear generate effect, calculate only the first 'preview length'.
double dur = (mIsLinearEffect)? wxMin(mSetDuration, CalcPreviewInputLength(previewLen)) : mSetDuration;
// For generate effects derived from the Nyquist Prompt, the duration is unknow, so
// ensure that we have at least preview length to copy.
double dur = (mIsLinearEffect)? wxMin(mSetDuration, warpedPreviewLength) :
wxMax(mSetDuration, warpedPreviewLength);
t1 = t0 + dur;
this->SetDuration(dur);
}
@ -2446,8 +2450,7 @@ void Effect::Preview(bool dryOnly)
mTracks->Add(mixRight);
}
// TODO: Don't really think this is necessary, but doesn't hurt
// Reset times
// Reset t0 / t1 is required when source tracks have different start times.
t0 = mixLeft->GetStartTime();
t1 = mixLeft->GetEndTime();
}
@ -2472,8 +2475,15 @@ void Effect::Preview(bool dryOnly)
double t0save = mT0;
double t1save = mT1;
if (mIsLinearEffect) {
mT0 = t0;
mT1 = t1;
}
else {
mT0 = 0;
mT1 = t1 - t0;
}
// Apply effect
@ -3184,6 +3194,24 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
menu->Append(0, _("User Presets"), sub);
}
menu->Append(kSaveAsID, _("Save Preset..."));
if (mUserPresets.GetCount() == 0)
{
menu->Append(kDeletePresetDummyID, _("Delete Preset"))->Enable(false);
}
else
{
sub = new wxMenu();
for (size_t i = 0, cnt = mUserPresets.GetCount(); i < cnt; i++)
{
sub->Append(kDeletePresetID + i, mUserPresets[i]);
}
menu->Append(0, _("Delete Preset"), sub);
}
menu->AppendSeparator();
wxArrayString factory = mEffect->GetFactoryPresets();
sub = new wxMenu();
@ -3204,22 +3232,6 @@ void EffectUIHost::OnMenu(wxCommandEvent & WXUNUSED(evt))
}
menu->Append(0, _("Factory Presets"), sub);
if (mUserPresets.GetCount() == 0)
{
menu->Append(kDeletePresetDummyID, _("Delete Preset"))->Enable(false);
}
else
{
sub = new wxMenu();
for (size_t i = 0, cnt = mUserPresets.GetCount(); i < cnt; i++)
{
sub->Append(kDeletePresetID + i, mUserPresets[i]);
}
menu->Append(0, _("Delete Preset"), sub);
}
menu->AppendSeparator();
menu->Append(kSaveAsID, _("Save As..."));
menu->AppendSeparator();
menu->Append(kImportID, _("Import..."))->Enable(mClient->CanExportPresets());
menu->Append(kExportID, _("Export..."))->Enable(mClient->CanExportPresets());

View File

@ -79,7 +79,6 @@ class AUDACITY_DLL_API Effect : public wxEvtHandler,
virtual bool IsLegacy();
virtual bool SupportsRealtime();
virtual bool SupportsAutomation();
virtual bool EnableFromGetGo(){ return true;};
// EffectClientInterface implementation

View File

@ -34,7 +34,6 @@ public:
// EffectIdentInterface implementation
virtual EffectType GetType();
virtual bool EnableFromGetGo(){ return false;};
// EffectClientInterface implementation

View File

@ -128,14 +128,18 @@
EFFECT( TRUNCATESILENCE, EffectTruncSilence() ) \
EFFECT( WAHWAH, EffectWahwah() ) \
EFFECT( FINDCLIPPING, EffectFindClipping() ) \
NOISEREDUCTION_EFFECT \
SOUNDTOUCH_EFFECTS
//
// Define the list of effects that do not get autoregistered
//
#define EXCLUDE_LIST \
EFFECT( AUTODUCK, EffectAutoDuck() ) \
EFFECT( LEVELLER, EffectLeveller() ) \
EFFECT( PAULSTRETCH, EffectPaulstretch() ) \
CLASSICFILTER_EFFECT \
SBSMS_EFFECTS \
NOISEREDUCTION_EFFECT \
SOUNDTOUCH_EFFECTS
SBSMS_EFFECTS
//
// Define the EFFECT() macro to generate enum names
@ -148,6 +152,7 @@
enum
{
EFFECT_LIST
EXCLUDE_LIST
};
//
@ -164,6 +169,13 @@ static const wxChar *kEffectNames[] =
EFFECT_LIST
};
//
// Create the effect name array of excluded effects
//
static const wxChar *kExcludedNames[] =
{
EXCLUDE_LIST
};
//
// Redefine EFFECT() to generate a case statement for the lookup switch
@ -257,6 +269,12 @@ bool BuiltinEffectsModule::Initialize()
{
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
}
for (size_t i = 0; i < WXSIZEOF(kExcludedNames); i++)
{
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kExcludedNames[i]);
}
return true;
}
@ -331,6 +349,7 @@ Effect *BuiltinEffectsModule::Instantiate(const wxString & path)
switch (mNames.Index(path))
{
EFFECT_LIST;
EXCLUDE_LIST;
}
return NULL;

2
src/effects/Normalize.cpp Normal file → Executable file
View File

@ -33,7 +33,7 @@
// Define keys, defaults, minimums, and maximums for the effect parameters
//
// Name Type Key Def Min Max Scale
Param( Level, double, XO("Level"), 0.0, -145.0, 0.0, 1 );
Param( Level, double, XO("Level"), -1.0, -145.0, 0.0, 1 );
Param( RemoveDC, bool, XO("RemoveDcOffset"), true, false, true, 1 );
Param( ApplyGain, bool, XO("ApplyGain"), true, false, true, 1 );
Param( StereoInd, bool, XO("StereoIndependent"), false, false, true, 1 );

View File

@ -33,7 +33,6 @@ public:
// EffectIdentInterface implementation
virtual EffectType GetType();
virtual bool EnableFromGetGo(){ return false;};
// EffectClientInterface implementation

View File

@ -28,8 +28,6 @@ public:
void setParameters(double rateStart, double rateEnd, double pitchStart, double pitchEnd,
SlideType rateSlideType, SlideType pitchSlideType,
bool bLinkRatePitch, bool bRateReferenceInput, bool bPitchReferenceInput);
virtual bool EnableFromGetGo(){ return false;};
private:
bool ProcessLabelTrack(Track *track);

View File

@ -47,7 +47,6 @@ public:
// EffectIdentInterface implementation
virtual EffectType GetType();
virtual bool EnableFromGetGo(){ return false;};
// EffectClientInterface implementation

View File

@ -871,6 +871,7 @@ AudioUnitEffect::AudioUnitEffect(const wxString & path,
mUnit = NULL;
mBlockSize = 0.0;
mInteractive = false;
mUIHost = NULL;
mDialog = NULL;
@ -970,6 +971,7 @@ wxString AudioUnitEffect::GetFamily()
bool AudioUnitEffect::IsInteractive()
{
printf("isinter %d\n", mInteractive);
return mInteractive;
}
@ -1179,6 +1181,32 @@ bool AudioUnitEffect::SetHost(EffectHostInterface *host)
{
return false;
}
AudioUnitCocoaViewInfo cocoaViewInfo;
dataSize = sizeof(AudioUnitCocoaViewInfo);
// Check for a Cocoa UI
result = AudioUnitGetProperty(mUnit,
kAudioUnitProperty_CocoaUI,
kAudioUnitScope_Global,
0,
&cocoaViewInfo,
&dataSize);
bool hasCocoa = result == noErr;
// Check for a Carbon UI
ComponentDescription compDesc;
dataSize = sizeof(compDesc);
result = AudioUnitGetProperty(mUnit,
kAudioUnitProperty_GetUIComponentList,
kAudioUnitScope_Global,
0,
&compDesc,
&dataSize);
bool hasCarbon = result == noErr;
mInteractive = (cnt > 0) || hasCocoa || hasCarbon;
}
return true;

View File

@ -638,7 +638,7 @@ bool LadspaEffect::IsLegacy()
bool LadspaEffect::SupportsRealtime()
{
return GetType() == EffectTypeProcess;
return GetType() != EffectTypeGenerate;
}
bool LadspaEffect::SupportsAutomation()
@ -1356,8 +1356,8 @@ bool LadspaEffect::PopulateUI(wxWindow *parent)
LADSPA_PortRangeHint hint = mData->PortRangeHints[p];
wxString bound;
float lower = -FLT_MAX;
float upper = FLT_MAX;
float lower = 0.0;
float upper = 1.0;
bool haslo = false;
bool hashi = false;
bool forceint = false;

View File

@ -117,7 +117,6 @@ public:
virtual bool IsLegacy();
virtual bool SupportsRealtime();
virtual bool SupportsAutomation();
virtual bool EnableFromGetGo(){ return false;};
// EffectClientInterface implementation

View File

@ -521,6 +521,11 @@ bool NyquistEffect::Process()
mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'MIDITRACKS)\n"), numMidi);
mProps += wxString::Format(wxT("(putprop '*PROJECT* %d 'TIMETRACKS)\n"), numTime);
double previewLen = 6.0;
gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &previewLen);
mProps += wxString::Format(wxT("(putprop '*PROJECT* (float %s) 'PREVIEW-DURATION)\n"),
Internat::ToString(previewLen).c_str());
SelectedTrackListOfKindIterator sel(Track::Wave, mOutputTracks);
int numChannels = 0;
for (WaveTrack *t = (WaveTrack *) sel.First(); t; t = (WaveTrack *) sel.Next()) {
@ -1263,10 +1268,10 @@ void NyquistEffect::Parse(wxString line)
return;
}
// As of version 4 plugins ";nyquist plug-in" is depricated in favour of ";nyquist plugin".
// The hyphenated version must be maintained while we support plugin versions < 4.
// Consistency decission is for "plug-in" as the correct spelling
// "plugin" is allowed as an undocumented convenience.
if (len == 2 && tokens[0] == wxT("nyquist") &&
(tokens[1] == wxT("plugin") || tokens[1] == wxT("plug-in"))) {
(tokens[1] == wxT("plug-in") || tokens[1] == wxT("plugin"))) {
mOK = true;
return;
}
@ -1354,6 +1359,11 @@ void NyquistEffect::Parse(wxString line)
if (len >= 2 && tokens[0] == wxT("preview")) {
if (tokens[1] == wxT("enabled") || tokens[1] == wxT("true")) {
mEnablePreview = true;
SetLinearEffectFlag(false);
}
else if (tokens[1] == wxT("linear")) {
mEnablePreview = true;
SetLinearEffectFlag(true);
}
else if (tokens[1] == wxT("disabled") || tokens[1] == wxT("false")) {
mEnablePreview = false;

View File

@ -84,7 +84,6 @@ public:
virtual wxString GetFamily();
virtual bool IsInteractive();
virtual bool IsDefault();
virtual bool EnableFromGetGo(){ return true;};
// EffectClientInterface implementation

View File

@ -56,8 +56,6 @@ public:
virtual wxString GetFamily();
virtual bool IsInteractive();
virtual bool IsDefault();
// May 21015: There aren't many analyse effects, so let us show them all (for now).
virtual bool EnableFromGetGo(){ return true;};
// EffectClientInterface implementation

View File

@ -570,8 +570,8 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
if (backwards)
std::swap(t0, t1);
t0 = wxMax(t0, 0.0);
t1 = wxMin(t1, latestEnd);
t0 = std::max(0.0, std::min(t0, latestEnd));
t1 = std::max(0.0, std::min(t1, latestEnd));
if (backwards)
std::swap(t0, t1);

67
src/widgets/ProgressDialog.cpp Normal file → Executable file
View File

@ -1049,7 +1049,7 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message,
wxDefaultSize,
wxALIGN_LEFT);
mMessage->SetName(message); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
v->Add(mMessage, 0, wxEXPAND | wxALL, 10);
v->Add(mMessage, 1, wxEXPAND | wxALL, 10);
ds.y += mMessage->GetSize().y + 20;
//
@ -1117,28 +1117,32 @@ ProgressDialog::ProgressDialog(const wxString & title, const wxString & message,
if (!(flags & pdlgHideStopButton))
{
w = new wxButton(this, wxID_OK, _("Stop"));
h->Add(w, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
ds.x += w->GetSize().x + 10;
h->Add(w, 0, wxALIGN_RIGHT | wxRIGHT, 10);
}
if (!(flags & pdlgHideCancelButton))
{
w = new wxButton(this, wxID_CANCEL, _("Cancel"));
h->Add(w, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
ds.x += w->GetSize().x + 10;
h->Add(w, 0, wxALIGN_RIGHT | wxRIGHT, 10);
}
v->Add(h, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
SetSizer(v);
Layout();
ds.x = wxMax(g->GetSize().x, h->GetSize().x) + 10;
ds.y += w->GetSize().y + 10;
SetSizerAndFit(v);
wxClientDC dc(this);
dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
wxCoord widthText = 0;
dc.GetTextExtent(message, &widthText, NULL, NULL, NULL, NULL);
ds.x = (wxCoord) wxMax(wxMax(3 * widthText / 2, 4 * ds.y / 3), 300);
dc.GetMultiLineTextExtent(message, &mLastW, &mLastH);
#if defined(__WXMAC__)
mMessage->SetMinSize(wxSize(mLastW, mLastH));
#endif
// The 300 really isn't needed, but it keeps it at a decent width.
ds.x = wxMax(wxMax(wxMax(ds.x, mLastW) + 20, wxMax(ds.y, mLastH)), 300);
SetClientSize(ds);
Centre(wxCENTER_FRAME | wxBOTH);
@ -1508,16 +1512,43 @@ ProgressDialog::SetMessage(const wxString & message)
{
if (!message.IsEmpty())
{
wxSize sizeBefore = this->GetClientSize();
mMessage->SetLabel(message);
mMessage->Update();
wxSize sizeAfter = this->GetBestSize();
wxSize sizeNeeded;
sizeNeeded.x = wxMax(sizeBefore.x, sizeAfter.x);
sizeNeeded.y = wxMax(sizeBefore.y, sizeAfter.y);
this->SetClientSize(sizeNeeded);
int w, h;
wxClientDC dc(mMessage);
dc.GetMultiLineTextExtent(message, &w, &h);
bool sizeUpdated = false;
wxSize ds = GetClientSize();
if (w > mLastW)
{
ds.x += (w - mLastW);
sizeUpdated = true;
mLastW = w;
}
if (h > mLastH)
{
ds.y += (h - mLastH);
sizeUpdated = true;
mLastH = h;
}
if (sizeUpdated)
{
#if defined(__WXMAC__)
wxSize sz = mMessage->GetSize();
mMessage->SetMinSize(wxSize(wxMax(sz.x, mLastW), wxMax(sz.y, mLastH)));
#endif
// No need to adjust for the margin here since we only add
// to the existing dimensions.
ds.x = wxMax(wxMax(ds.x, mLastW), wxMax(ds.y, mLastH));
SetClientSize(ds);
wxDialog::Update();
}
}
}
void

View File

@ -89,6 +89,9 @@ class AUDACITY_DLL_API ProgressDialog:public wxDialog
wxStaticText *mMessage;
wxWindowDisabler *mDisable;
int mLastW;
int mLastH;
DECLARE_EVENT_TABLE();
};