mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 07:39:42 +02:00
Resolves reported bugs and (most) recommendations
All: Export/Import now disabled if the Effect (family) doesn't support it Options disabled if the Effect (family) doesn't support it Standarized on "Latency compensation" instead of "Buffer delay compensation" Correct loading/saving of factory default settings Fixed "Mannage" to be "Manage" Removed conditional code since we're keeping the transport buttons Play bases state on actual playback status Play no longer monkeys with selection Play will now start from where it left off IF: The user stops the playback via the Effect Stop button If the user wants to restart from the beginning of the selection then the user can click Rewind while stopped. Rewind will not go past start of selection (sorry Steve ;-)) If Rewind is clicked while not playing, playback will next start at beginning of selection. Fast Forward will stop at end of selection However, if FFwd is clicked while not playing, it will put playback at the end of selection and the next time the user clicks the Effect play button, playback will continue from the end of selection to the end of track. Deleting a preset now prompts user to confirm Button faces should now look a little better Bypass (should we rename that???) button now grays when disabled Audio Units: Corrected all user visible "AudioUnit" strings to be "Audio Unit" Removed unneeded "Buffer Size" in settings dialog Only uses latency if user said it was okay Ladspa: Added settings dialog to allow control of latency usage Removed unused "user selectable" buffer size Only use latency if user wants it Refresh controls when presets are loaded VST: Removed unused "Rescan at startup" setting Propogate parameter loads to slave effects
This commit is contained in:
parent
dd766fd153
commit
cddff18025
@ -405,6 +405,28 @@ static const char * effect_ffwd_xpm[] = {
|
||||
" MN MN ",
|
||||
" "};
|
||||
|
||||
/* XPM */
|
||||
static const char * effect_off_disabled_xpm[] = {
|
||||
"16 16 2 1",
|
||||
" c None",
|
||||
". c #7f7f7f",
|
||||
" ",
|
||||
" .. ",
|
||||
" . .. . ",
|
||||
" .. .. .. ",
|
||||
" ... .. ... ",
|
||||
" .... .. .... ",
|
||||
" ... .. ... ",
|
||||
" ... .. ... ",
|
||||
" ... .. ... ",
|
||||
" ... ... ",
|
||||
" ... ... ",
|
||||
" ... ... ",
|
||||
" .... .... ",
|
||||
" ............ ",
|
||||
" .......... ",
|
||||
" ........ "};
|
||||
|
||||
/* XPM */
|
||||
static const char * effect_play_disabled_xpm[] = {
|
||||
"16 16 48 1",
|
||||
|
@ -165,13 +165,15 @@ public:
|
||||
virtual void LoadUserPreset(const wxString & name) = 0;
|
||||
virtual void SaveUserPreset(const wxString & name) = 0;
|
||||
|
||||
virtual wxArrayString GetFactoryPresets() = 0;
|
||||
virtual void LoadFactoryPreset(int id) = 0;
|
||||
virtual void LoadFactoryDefaults() = 0;
|
||||
|
||||
virtual wxArrayString GetFactoryPresets() = 0;
|
||||
|
||||
virtual bool CanExport() = 0;
|
||||
virtual void ExportPresets() = 0;
|
||||
virtual void ImportPresets() = 0;
|
||||
|
||||
virtual bool HasOptions() = 0;
|
||||
virtual void ShowOptions() = 0;
|
||||
};
|
||||
|
||||
|
@ -39,6 +39,7 @@ greater use in future.
|
||||
#include "../Prefs.h"
|
||||
#include "../Project.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../toolbars/ControlToolBar.h"
|
||||
#include "../widgets/AButton.h"
|
||||
#include "../widgets/ProgressDialog.h"
|
||||
#include "../ondemand/ODManager.h"
|
||||
@ -1995,6 +1996,8 @@ public:
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../../images/Effect.h"
|
||||
|
||||
enum
|
||||
{
|
||||
kDummyID = 30000,
|
||||
@ -2003,8 +2006,8 @@ enum
|
||||
kExportID = 30003,
|
||||
kDefaultsID = 30004,
|
||||
kOptionsID = 30005,
|
||||
kDeleteAllID = 30006,
|
||||
#if defined(TRY_BUTTONS)
|
||||
kUserPresetsDummyID = 30006,
|
||||
kDeletePresetDummyID = 30007,
|
||||
kMenuID = 30100,
|
||||
kBypassID = 30101,
|
||||
kPlayID = 30102,
|
||||
@ -2012,7 +2015,6 @@ enum
|
||||
kFFwdID = 30104,
|
||||
kPlaybackID = 30105,
|
||||
kCaptureID = 30106,
|
||||
#endif
|
||||
kUserPresetsID = 31000,
|
||||
kDeletePresetID = 32000,
|
||||
kFactoryPresetsID = 33000,
|
||||
@ -2022,21 +2024,16 @@ BEGIN_EVENT_TABLE(EffectUIHost, wxDialog)
|
||||
EVT_CLOSE(EffectUIHost::OnClose)
|
||||
EVT_BUTTON(wxID_APPLY, EffectUIHost::OnApply)
|
||||
EVT_BUTTON(wxID_CANCEL, EffectUIHost::OnCancel)
|
||||
EVT_BUTTON(ePreviewID, EffectUIHost::OnPreview)
|
||||
EVT_BUTTON(eSettingsID, EffectUIHost::OnSettings)
|
||||
#if defined(TRY_BUTTONS)
|
||||
EVT_BUTTON(kMenuID, EffectUIHost::OnMenu)
|
||||
EVT_BUTTON(kBypassID, EffectUIHost::OnBypass)
|
||||
EVT_BUTTON(kPlayID, EffectUIHost::OnPlay)
|
||||
EVT_BUTTON(kRewindID, EffectUIHost::OnRewind)
|
||||
EVT_BUTTON(kFFwdID, EffectUIHost::OnFFwd)
|
||||
#endif
|
||||
EVT_MENU(kSaveAsID, EffectUIHost::OnSaveAs)
|
||||
EVT_MENU(kImportID, EffectUIHost::OnImport)
|
||||
EVT_MENU(kExportID, EffectUIHost::OnExport)
|
||||
EVT_MENU(kOptionsID, EffectUIHost::OnOptions)
|
||||
EVT_MENU(kDefaultsID, EffectUIHost::OnDefaults)
|
||||
EVT_MENU(kDeleteAllID, EffectUIHost::OnDeleteAllPresets)
|
||||
EVT_MENU_RANGE(kUserPresetsID, kUserPresetsID + 999, EffectUIHost::OnUserPreset)
|
||||
EVT_MENU_RANGE(kDeletePresetID, kDeletePresetID + 999, EffectUIHost::OnDeletePreset)
|
||||
EVT_MENU_RANGE(kFactoryPresetsID, kFactoryPresetsID + 999, EffectUIHost::OnFactoryPreset)
|
||||
@ -2073,42 +2070,6 @@ EffectUIHost::~EffectUIHost()
|
||||
}
|
||||
}
|
||||
|
||||
#define TRY_BUTTONS 1
|
||||
#if defined(TRY_BUTTONS)
|
||||
|
||||
#include "../../images/Effect.h"
|
||||
|
||||
wxBitmap EffectUIHost::CreateBitmap(const char *xpm[], bool up, bool pusher)
|
||||
{
|
||||
wxMemoryDC dc;
|
||||
wxBitmap pic(xpm);
|
||||
|
||||
wxBitmap mod(pic.GetWidth() + 6, pic.GetHeight() + 6);
|
||||
dc.SelectObject(mod);
|
||||
#if defined( __WXGTK__ )
|
||||
wxColour newColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
|
||||
#else
|
||||
wxColour newColour = wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE );
|
||||
#endif
|
||||
dc.SetBackground(wxBrush(newColour));
|
||||
dc.Clear();
|
||||
|
||||
int offset = 3;
|
||||
if (pusher)
|
||||
{
|
||||
if (!up)
|
||||
{
|
||||
offset += 1;
|
||||
}
|
||||
}
|
||||
dc.DrawBitmap(pic, offset, offset, true);
|
||||
|
||||
dc.SelectObject(wxNullBitmap);
|
||||
|
||||
return mod;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// EffectUIHost implementation
|
||||
// ============================================================================
|
||||
@ -2126,7 +2087,6 @@ bool EffectUIHost::Initialize()
|
||||
|
||||
w->SetScrollRate(0, 20);
|
||||
|
||||
#if defined(TRY_BUTTONS)
|
||||
mPlaying = gAudioIO->IsStreamActive(); // not exactly right, but will suffice
|
||||
mCapturing = gAudioIO->IsStreamActive() && gAudioIO->GetNumCaptureChannels() > 0;
|
||||
|
||||
@ -2135,13 +2095,15 @@ bool EffectUIHost::Initialize()
|
||||
bar->SetSizer(bs);
|
||||
|
||||
mMenuBtn = new wxBitmapButton(bar, kMenuID, CreateBitmap(effect_menu_xpm, true, false));
|
||||
mMenuBtn->SetToolTip(_("Mannage effect"));
|
||||
mMenuBtn->SetToolTip(_("Manage effect"));
|
||||
|
||||
bs->Add(mMenuBtn);
|
||||
|
||||
mOnBM = CreateBitmap(effect_on_xpm, true, false);
|
||||
mOffBM = CreateBitmap(effect_off_xpm, true, false);
|
||||
mOffDisabledBM = CreateBitmap(effect_off_disabled_xpm, true, false);
|
||||
mBypassBtn = new wxBitmapButton(bar, kBypassID, mOnBM);
|
||||
mBypassBtn->SetBitmapDisabled(mOffDisabledBM);
|
||||
mBypassBtn->SetToolTip(_("Bypass effect"));
|
||||
mOnToggle = true;
|
||||
bs->Add(mBypassBtn);
|
||||
@ -2155,7 +2117,6 @@ bool EffectUIHost::Initialize()
|
||||
mPlayBtn = new wxBitmapButton(bar, kPlayID, mPlayBM);
|
||||
mPlayBtn->SetBitmapDisabled(mPlayDisabledBM);
|
||||
mPlayBtn->SetToolTip(_("Play/Stop"));
|
||||
mPlayToggle = true;
|
||||
bs->Add(mPlayBtn);
|
||||
|
||||
mRewindBtn = new wxBitmapButton(bar, kRewindID, CreateBitmap(effect_rewind_xpm, true, true));
|
||||
@ -2190,10 +2151,6 @@ bool EffectUIHost::Initialize()
|
||||
mCloseBtn = (wxButton *) FindWindowById(wxID_CANCEL);
|
||||
|
||||
UpdateControls();
|
||||
#else
|
||||
wxSizer *s = CreateStdButtonSizer(this, eSettingsButton | eApplyButton | eCloseButton);
|
||||
#endif
|
||||
|
||||
|
||||
hs->Add(w, 1, wxEXPAND);
|
||||
vs->Add(hs, 1, wxEXPAND);
|
||||
@ -2227,7 +2184,6 @@ bool EffectUIHost::Initialize()
|
||||
|
||||
EffectManager::Get().RealtimeAddEffect(mEffect);
|
||||
|
||||
#if defined(TRY_BUTTONS)
|
||||
wxTheApp->Connect(EVT_AUDIOIO_PLAYBACK,
|
||||
wxCommandEventHandler(EffectUIHost::OnPlayback),
|
||||
NULL,
|
||||
@ -2237,7 +2193,6 @@ bool EffectUIHost::Initialize()
|
||||
wxCommandEventHandler(EffectUIHost::OnCapture),
|
||||
NULL,
|
||||
this);
|
||||
#endif
|
||||
|
||||
mInitialized = true;
|
||||
|
||||
@ -2250,7 +2205,6 @@ void EffectUIHost::OnClose(wxCloseEvent & WXUNUSED(evt))
|
||||
{
|
||||
mInitialized = false;
|
||||
|
||||
#if defined(TRY_BUTTONS)
|
||||
wxTheApp->Disconnect(EVT_AUDIOIO_PLAYBACK,
|
||||
wxCommandEventHandler(EffectUIHost::OnPlayback),
|
||||
NULL,
|
||||
@ -2260,7 +2214,6 @@ void EffectUIHost::OnClose(wxCloseEvent & WXUNUSED(evt))
|
||||
wxCommandEventHandler(EffectUIHost::OnCapture),
|
||||
NULL,
|
||||
this);
|
||||
#endif
|
||||
|
||||
EffectManager::Get().RealtimeRemoveEffect(mEffect);
|
||||
mEffect->RealtimeFinalize();
|
||||
@ -2283,15 +2236,26 @@ void EffectUIHost::OnApply(wxCommandEvent & WXUNUSED(evt))
|
||||
|
||||
mClient->SaveUserPreset(mEffect->GetCurrentSettingsGroup());
|
||||
|
||||
if (mInitialized)
|
||||
{
|
||||
mInitialized = false;
|
||||
EffectManager::Get().RealtimeRemoveEffect(mEffect);
|
||||
mEffect->RealtimeFinalize();
|
||||
}
|
||||
|
||||
if (IsModal())
|
||||
{
|
||||
if (mInitialized)
|
||||
{
|
||||
mInitialized = false;
|
||||
|
||||
wxTheApp->Disconnect(EVT_AUDIOIO_PLAYBACK,
|
||||
wxCommandEventHandler(EffectUIHost::OnPlayback),
|
||||
NULL,
|
||||
this);
|
||||
|
||||
wxTheApp->Disconnect(EVT_AUDIOIO_CAPTURE,
|
||||
wxCommandEventHandler(EffectUIHost::OnCapture),
|
||||
NULL,
|
||||
this);
|
||||
|
||||
EffectManager::Get().RealtimeRemoveEffect(mEffect);
|
||||
mEffect->RealtimeFinalize();
|
||||
}
|
||||
|
||||
SetReturnCode(true);
|
||||
|
||||
Close();
|
||||
@ -2304,17 +2268,6 @@ void EffectUIHost::OnApply(wxCommandEvent & WXUNUSED(evt))
|
||||
|
||||
mEffect->Apply();
|
||||
|
||||
#if defined(CLOSE_ON_APPLY)
|
||||
if (!mClient->HideUI())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Hide();
|
||||
|
||||
Close();
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2324,7 +2277,6 @@ void EffectUIHost::OnCancel(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
mInitialized = false;
|
||||
|
||||
#if defined(TRY_BUTTONS)
|
||||
wxTheApp->Disconnect(EVT_AUDIOIO_PLAYBACK,
|
||||
wxCommandEventHandler(EffectUIHost::OnPlayback),
|
||||
NULL,
|
||||
@ -2334,7 +2286,6 @@ void EffectUIHost::OnCancel(wxCommandEvent & WXUNUSED(evt))
|
||||
wxCommandEventHandler(EffectUIHost::OnCapture),
|
||||
NULL,
|
||||
this);
|
||||
#endif
|
||||
|
||||
EffectManager::Get().RealtimeRemoveEffect(mEffect);
|
||||
mEffect->RealtimeFinalize();
|
||||
@ -2360,12 +2311,6 @@ void EffectUIHost::OnCancel(wxCommandEvent & WXUNUSED(evt))
|
||||
return;
|
||||
}
|
||||
|
||||
void EffectUIHost::OnPreview(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
mEffect->Preview();
|
||||
}
|
||||
|
||||
#if defined(TRY_BUTTONS)
|
||||
void EffectUIHost::OnMenu(wxCommandEvent & evt)
|
||||
{
|
||||
wxBitmapButton *b = (wxBitmapButton *)evt.GetEventObject();
|
||||
@ -2375,12 +2320,19 @@ void EffectUIHost::OnMenu(wxCommandEvent & evt)
|
||||
|
||||
LoadUserPresets();
|
||||
|
||||
sub = new wxMenu();
|
||||
for (size_t i = 0, cnt = mUserPresets.GetCount(); i < cnt; i++)
|
||||
if (mUserPresets.GetCount() == 0)
|
||||
{
|
||||
sub->Append(kUserPresetsID + i, mUserPresets[i]);
|
||||
menu->Append(kUserPresetsDummyID, _("User Presets"))->Enable(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
sub = new wxMenu();
|
||||
for (size_t i = 0, cnt = mUserPresets.GetCount(); i < cnt; i++)
|
||||
{
|
||||
sub->Append(kUserPresetsID + i, mUserPresets[i]);
|
||||
}
|
||||
menu->Append(0, _("User Presets"), sub);
|
||||
}
|
||||
menu->Append(0, _("User Presets"), sub);
|
||||
|
||||
wxArrayString factory = mClient->GetFactoryPresets();
|
||||
|
||||
@ -2402,20 +2354,27 @@ void EffectUIHost::OnMenu(wxCommandEvent & evt)
|
||||
}
|
||||
menu->Append(0, _("Factory Presets"), sub);
|
||||
|
||||
sub = new wxMenu();
|
||||
for (size_t i = 0, cnt = mUserPresets.GetCount(); i < cnt; i++)
|
||||
if (mUserPresets.GetCount() == 0)
|
||||
{
|
||||
sub->Append(kDeletePresetID + i, mUserPresets[i]);
|
||||
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->Append(0, _("Delete Preset"), sub);
|
||||
|
||||
menu->AppendSeparator();
|
||||
menu->Append(kSaveAsID, _("Save As..."));
|
||||
menu->AppendSeparator();
|
||||
menu->Append(kImportID, _("Import..."));
|
||||
menu->Append(kExportID, _("Export..."));
|
||||
menu->Append(kImportID, _("Import..."))->Enable(mClient->CanExport());
|
||||
menu->Append(kExportID, _("Export..."))->Enable(mClient->CanExport());
|
||||
menu->AppendSeparator();
|
||||
menu->Append(kOptionsID, _("Options..."));
|
||||
menu->Append(kOptionsID, _("Options..."))->Enable(mClient->HasOptions());
|
||||
menu->AppendSeparator();
|
||||
|
||||
sub = new wxMenu();
|
||||
@ -2454,31 +2413,84 @@ void EffectUIHost::OnBypass(wxCommandEvent & WXUNUSED(evt))
|
||||
|
||||
void EffectUIHost::OnPlay(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
if (mPlayToggle)
|
||||
AudacityProject *p = GetActiveProject();
|
||||
|
||||
if (mPlaying)
|
||||
{
|
||||
mPlayToggle = false;
|
||||
GetActiveProject()->OnPlayStop();
|
||||
mPlayPos = gAudioIO->GetStreamTime();
|
||||
p->GetControlToolBar()->StopPlaying();
|
||||
}
|
||||
else
|
||||
{
|
||||
mPlayToggle = true;
|
||||
GetActiveProject()->OnPlayStop();
|
||||
if (p->mViewInfo.selectedRegion.t0() != mRegion.t0() ||
|
||||
p->mViewInfo.selectedRegion.t1() != mRegion.t1())
|
||||
{
|
||||
mRegion = p->mViewInfo.selectedRegion;
|
||||
mPlayPos = mRegion.t0();
|
||||
}
|
||||
|
||||
if (mPlayPos > mRegion.t1())
|
||||
{
|
||||
mPlayPos = mRegion.t1();
|
||||
}
|
||||
|
||||
p->GetControlToolBar()->PlayPlayRegion(mPlayPos, mRegion.t1());
|
||||
}
|
||||
}
|
||||
|
||||
void EffectUIHost::OnRewind(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
GetActiveProject()->OnSeekLeftShort();
|
||||
if (mPlaying)
|
||||
{
|
||||
double seek;
|
||||
gPrefs->Read(wxT("/AudioIO/SeekShortPeriod"), &seek, 1.0);
|
||||
|
||||
double pos = gAudioIO->GetStreamTime();
|
||||
if (pos - seek < mRegion.t0())
|
||||
{
|
||||
seek = pos - mRegion.t0();
|
||||
}
|
||||
|
||||
gAudioIO->SeekStream(-seek);
|
||||
}
|
||||
else
|
||||
{
|
||||
mPlayPos = mRegion.t0();
|
||||
}
|
||||
}
|
||||
|
||||
void EffectUIHost::OnFFwd(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
GetActiveProject()->OnSeekRightShort();
|
||||
if (mPlaying)
|
||||
{
|
||||
double seek;
|
||||
gPrefs->Read(wxT("/AudioIO/SeekShortPeriod"), &seek, 1.0);
|
||||
|
||||
double pos = gAudioIO->GetStreamTime();
|
||||
if (mRegion.t0() < mRegion.t1() && pos + seek > mRegion.t1())
|
||||
{
|
||||
seek = mRegion.t1() - pos;
|
||||
}
|
||||
|
||||
gAudioIO->SeekStream(seek);
|
||||
}
|
||||
else
|
||||
{
|
||||
// It allows to play past end of selection...probably useless
|
||||
mPlayPos = mRegion.t1();
|
||||
}
|
||||
}
|
||||
|
||||
void EffectUIHost::OnPlayback(wxCommandEvent & evt)
|
||||
{
|
||||
mPlaying = evt.GetInt() != 0;
|
||||
|
||||
if (mPlaying)
|
||||
{
|
||||
mRegion = GetActiveProject()->mViewInfo.selectedRegion;
|
||||
mPlayPos = mRegion.t0();
|
||||
}
|
||||
|
||||
UpdateControls();
|
||||
}
|
||||
|
||||
@ -2489,95 +2501,37 @@ void EffectUIHost::OnCapture(wxCommandEvent & evt)
|
||||
UpdateControls();
|
||||
}
|
||||
|
||||
void EffectUIHost::UpdateControls()
|
||||
void EffectUIHost::OnUserPreset(wxCommandEvent & evt)
|
||||
{
|
||||
mApplyBtn->Enable(!mCapturing);
|
||||
mBypassBtn->Enable(!mCapturing);
|
||||
mPlayBtn->Enable(!mCapturing);
|
||||
mRewindBtn->Enable(!mCapturing);
|
||||
mFFwdBtn->Enable(!mCapturing);
|
||||
int preset = evt.GetId() - kUserPresetsID;
|
||||
|
||||
mOnToggle = !EffectManager::Get().RealtimeIsSuspended();
|
||||
if (mOnToggle && mCapturing)
|
||||
{
|
||||
mOnToggle = false;
|
||||
EffectManager::Get().RealtimeSuspend();
|
||||
}
|
||||
mClient->LoadUserPreset(mEffect->GetUserPresetsGroup(mUserPresets[preset]));
|
||||
|
||||
mPlayBtn->SetBitmapLabel(mPlaying ? mStopBM : mPlayBM);
|
||||
mPlayBtn->SetBitmapDisabled(mPlaying ? mStopDisabledBM: mPlayDisabledBM);
|
||||
mBypassBtn->SetBitmapLabel(mOnToggle ? mOnBM : mOffBM);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void EffectUIHost::OnSettings(wxCommandEvent & evt)
|
||||
void EffectUIHost::OnFactoryPreset(wxCommandEvent & evt)
|
||||
{
|
||||
wxButton *b = (wxButton *)evt.GetEventObject();
|
||||
mClient->LoadFactoryPreset(evt.GetId() - kFactoryPresetsID);
|
||||
|
||||
wxMenu *menu = new wxMenu();
|
||||
wxMenu *sub;
|
||||
return;
|
||||
}
|
||||
|
||||
void EffectUIHost::OnDeletePreset(wxCommandEvent & evt)
|
||||
{
|
||||
wxString preset = mUserPresets[evt.GetId() - kDeletePresetID];
|
||||
|
||||
int res = wxMessageBox(wxString::Format(_("Are you sure you want to delete \"%s\"?"), preset.c_str()),
|
||||
_("Delete Preset"),
|
||||
wxICON_QUESTION | wxYES_NO);
|
||||
if (res == wxYES)
|
||||
{
|
||||
mEffect->RemovePrivateConfigSubgroup(mEffect->GetUserPresetsGroup(preset));
|
||||
}
|
||||
|
||||
LoadUserPresets();
|
||||
|
||||
sub = new wxMenu();
|
||||
for (size_t i = 0, cnt = mUserPresets.GetCount(); i < cnt; i++)
|
||||
{
|
||||
sub->Append(kUserPresetsID + i, mUserPresets[i]);
|
||||
}
|
||||
menu->Append(0, _("User Presets"), sub);
|
||||
|
||||
wxArrayString factory = mClient->GetFactoryPresets();
|
||||
|
||||
sub = new wxMenu();
|
||||
sub->Append(kDefaultsID, _("Defaults"));
|
||||
if (factory.GetCount() > 0)
|
||||
{
|
||||
sub->AppendSeparator();
|
||||
for (size_t i = 0, cnt = factory.GetCount(); i < cnt; i++)
|
||||
{
|
||||
wxString label = factory[i];
|
||||
if (label.IsEmpty())
|
||||
{
|
||||
label = _("None");
|
||||
}
|
||||
|
||||
sub->Append(kFactoryPresetsID + i, label);
|
||||
}
|
||||
}
|
||||
menu->Append(0, _("Factory Presets"), sub);
|
||||
|
||||
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..."));
|
||||
menu->Append(kExportID, _("Export..."));
|
||||
menu->AppendSeparator();
|
||||
menu->Append(kOptionsID, _("Options..."));
|
||||
menu->AppendSeparator();
|
||||
|
||||
sub = new wxMenu();
|
||||
|
||||
sub->Append(kDummyID, wxString::Format(_("Type: %s"), mEffect->GetFamily().c_str()));
|
||||
sub->Append(kDummyID, wxString::Format(_("Name: %s"), mEffect->GetName().c_str()));
|
||||
sub->Append(kDummyID, wxString::Format(_("Version: %s"), mEffect->GetVersion().c_str()));
|
||||
sub->Append(kDummyID, wxString::Format(_("Vendor: %s"), mEffect->GetVendor().c_str()));
|
||||
sub->Append(kDummyID, wxString::Format(_("Description: %s"), mEffect->GetDescription().c_str()));
|
||||
// sub->Append(kDummyID, wxString::Format(_("Audio In: %d"), mEffect->GetAudioInCount()));
|
||||
// sub->Append(kDummyID, wxString::Format(_("Audio Out: %d"), mEffect->GetAudioOutCount()));
|
||||
|
||||
menu->Append(0, _("About"), sub);
|
||||
|
||||
wxRect r = b->GetRect();
|
||||
PopupMenu(menu, wxPoint(r.GetLeft(), r.GetBottom()));
|
||||
|
||||
delete menu;
|
||||
return;
|
||||
}
|
||||
|
||||
void EffectUIHost::OnSaveAs(wxCommandEvent & WXUNUSED(evt))
|
||||
@ -2646,13 +2600,6 @@ void EffectUIHost::OnExport(wxCommandEvent & WXUNUSED(evt))
|
||||
return;
|
||||
}
|
||||
|
||||
void EffectUIHost::OnDefaults(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
mClient->LoadFactoryDefaults();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void EffectUIHost::OnOptions(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
mClient->ShowOptions();
|
||||
@ -2660,43 +2607,67 @@ void EffectUIHost::OnOptions(wxCommandEvent & WXUNUSED(evt))
|
||||
return;
|
||||
}
|
||||
|
||||
void EffectUIHost::OnUserPreset(wxCommandEvent & evt)
|
||||
void EffectUIHost::OnDefaults(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
int preset = evt.GetId() - kUserPresetsID;
|
||||
|
||||
mClient->LoadUserPreset(mEffect->GetUserPresetsGroup(mUserPresets[preset]));
|
||||
mClient->LoadFactoryDefaults();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void EffectUIHost::OnFactoryPreset(wxCommandEvent & evt)
|
||||
wxBitmap EffectUIHost::CreateBitmap(const char *xpm[], bool up, bool pusher)
|
||||
{
|
||||
mClient->LoadFactoryPreset(evt.GetId() - kFactoryPresetsID);
|
||||
wxMemoryDC dc;
|
||||
wxBitmap pic(xpm);
|
||||
|
||||
return;
|
||||
}
|
||||
wxBitmap mod(pic.GetWidth() + 6, pic.GetHeight() + 6);
|
||||
dc.SelectObject(mod);
|
||||
|
||||
void EffectUIHost::OnDeletePreset(wxCommandEvent & evt)
|
||||
{
|
||||
mEffect->RemovePrivateConfigSubgroup(mEffect->GetUserPresetsGroup(mUserPresets[evt.GetId() - kDeletePresetID]));
|
||||
#if !defined(__WXMAC__)
|
||||
|
||||
LoadUserPresets();
|
||||
#if defined(__WXGTK__)
|
||||
wxColour newColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND);
|
||||
#elif defined(__WXMSW__)
|
||||
wxColour newColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
dc.SetBackground(wxBrush(newColour));
|
||||
dc.Clear();
|
||||
#endif
|
||||
|
||||
void EffectUIHost::OnDeleteAllPresets(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
int res = wxMessageBox(_("This will delete all of your user presets. Are you sure?"),
|
||||
_("Delete All Presets"),
|
||||
wxICON_QUESTION | wxYES_NO);
|
||||
if (res == wxID_YES)
|
||||
int offset = 3;
|
||||
if (pusher)
|
||||
{
|
||||
mEffect->RemovePrivateConfigSubgroup(mEffect->GetUserPresetsGroup(wxEmptyString));
|
||||
mUserPresets.Clear();
|
||||
if (!up)
|
||||
{
|
||||
offset += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
dc.DrawBitmap(pic, offset, offset, true);
|
||||
|
||||
dc.SelectObject(wxNullBitmap);
|
||||
|
||||
return mod;
|
||||
}
|
||||
|
||||
void EffectUIHost::UpdateControls()
|
||||
{
|
||||
mApplyBtn->Enable(!mCapturing);
|
||||
mBypassBtn->Enable(!mCapturing);
|
||||
mPlayBtn->Enable(!mCapturing);
|
||||
mRewindBtn->Enable(!mCapturing);
|
||||
mFFwdBtn->Enable(!mCapturing);
|
||||
|
||||
mOnToggle = !EffectManager::Get().RealtimeIsSuspended();
|
||||
if (mOnToggle && mCapturing)
|
||||
{
|
||||
mOnToggle = false;
|
||||
EffectManager::Get().RealtimeSuspend();
|
||||
}
|
||||
|
||||
mPlayBtn->SetBitmapLabel(mPlaying ? mStopBM : mPlayBM);
|
||||
mPlayBtn->SetBitmapDisabled(mPlaying ? mStopDisabledBM: mPlayDisabledBM);
|
||||
mBypassBtn->SetBitmapLabel(mOnToggle ? mOnBM : mOffBM);
|
||||
}
|
||||
|
||||
void EffectUIHost::LoadUserPresets()
|
||||
|
@ -12,8 +12,6 @@
|
||||
#ifndef __AUDACITY_EFFECT__
|
||||
#define __AUDACITY_EFFECT__
|
||||
|
||||
#define TRY_BUTTONS 1
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <wx/bmpbuttn.h>
|
||||
@ -29,6 +27,7 @@ class wxWindow;
|
||||
|
||||
#include "../Experimental.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../SelectedRegion.h"
|
||||
#include "../Shuttle.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../Internat.h"
|
||||
@ -488,7 +487,9 @@ public:
|
||||
bool Initialize();
|
||||
|
||||
private:
|
||||
#if defined(TRY_BUTTONS)
|
||||
void OnClose(wxCloseEvent & evt);
|
||||
void OnApply(wxCommandEvent & evt);
|
||||
void OnCancel(wxCommandEvent & evt);
|
||||
void OnMenu(wxCommandEvent & evt);
|
||||
void OnBypass(wxCommandEvent & evt);
|
||||
void OnPlay(wxCommandEvent & evt);
|
||||
@ -496,25 +497,17 @@ private:
|
||||
void OnFFwd(wxCommandEvent & evt);
|
||||
void OnPlayback(wxCommandEvent & evt);
|
||||
void OnCapture(wxCommandEvent & evt);
|
||||
void UpdateControls();
|
||||
wxBitmap CreateBitmap(const char *xpm[], bool up, bool pusher);
|
||||
#endif
|
||||
|
||||
void OnClose(wxCloseEvent & evt);
|
||||
void OnApply(wxCommandEvent & evt);
|
||||
void OnCancel(wxCommandEvent & evt);
|
||||
void OnPreview(wxCommandEvent & evt);
|
||||
void OnSettings(wxCommandEvent & evt);
|
||||
void OnUserPreset(wxCommandEvent & evt);
|
||||
void OnFactoryPreset(wxCommandEvent & evt);
|
||||
void OnDeletePreset(wxCommandEvent & evt);
|
||||
void OnSaveAs(wxCommandEvent & evt);
|
||||
void OnImport(wxCommandEvent & evt);
|
||||
void OnExport(wxCommandEvent & evt);
|
||||
void OnOptions(wxCommandEvent & evt);
|
||||
void OnUserPreset(wxCommandEvent & evt);
|
||||
void OnDeletePreset(wxCommandEvent & evt);
|
||||
void OnFactoryPreset(wxCommandEvent & evt);
|
||||
void OnDefaults(wxCommandEvent & evt);
|
||||
void OnDeleteAllPresets(wxCommandEvent & evt);
|
||||
|
||||
void UpdateControls();
|
||||
wxBitmap CreateBitmap(const char *xpm[], bool up, bool pusher);
|
||||
void LoadUserPresets();
|
||||
|
||||
private:
|
||||
@ -525,7 +518,6 @@ private:
|
||||
wxArrayString mUserPresets;
|
||||
bool mInitialized;
|
||||
|
||||
#if defined(TRY_BUTTONS)
|
||||
wxButton *mApplyBtn;
|
||||
wxButton *mCloseBtn;
|
||||
wxBitmapButton *mMenuBtn;
|
||||
@ -534,7 +526,6 @@ private:
|
||||
wxBitmapButton *mRewindBtn;
|
||||
wxBitmapButton *mFFwdBtn;
|
||||
|
||||
bool mPlayToggle;
|
||||
wxBitmap mPlayBM;
|
||||
wxBitmap mPlayDisabledBM;
|
||||
wxBitmap mStopBM;
|
||||
@ -543,10 +534,13 @@ private:
|
||||
bool mOnToggle;
|
||||
wxBitmap mOnBM;
|
||||
wxBitmap mOffBM;
|
||||
wxBitmap mOffDisabledBM;
|
||||
|
||||
bool mPlaying;
|
||||
bool mCapturing;
|
||||
#endif
|
||||
|
||||
SelectedRegion mRegion;
|
||||
double mPlayPos;
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
@ -625,9 +625,8 @@ public:
|
||||
private:
|
||||
EffectHostInterface *mHost;
|
||||
int mBufferSize;
|
||||
bool mUseBufferDelay;
|
||||
bool mUseLatency;
|
||||
bool mUseGUI;
|
||||
bool mRescan;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
@ -642,9 +641,8 @@ VSTEffectSettingsDialog::VSTEffectSettingsDialog(wxWindow * parent, EffectHostIn
|
||||
mHost = host;
|
||||
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("BufferSize"), mBufferSize, 8192);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseBufferDelay"), mUseBufferDelay, true);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseLatency"), mUseLatency, true);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseGUI"), mUseGUI, true);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("Rescan"), mRescan, false);
|
||||
|
||||
ShuttleGui S(this, eIsCreating);
|
||||
PopulateOrExchange(S);
|
||||
@ -686,7 +684,7 @@ void VSTEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S)
|
||||
}
|
||||
S.EndStatic();
|
||||
|
||||
S.StartStatic(_("Buffer Delay Compensation"));
|
||||
S.StartStatic(_("Latency Compensation"));
|
||||
{
|
||||
S.AddVariableText(wxString() +
|
||||
_("As part of their processing, some VST effects must delay returning ") +
|
||||
@ -698,7 +696,7 @@ void VSTEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S)
|
||||
S.StartHorizontalLay(wxALIGN_LEFT);
|
||||
{
|
||||
S.TieCheckBox(_("Enable &compensation"),
|
||||
mUseBufferDelay);
|
||||
mUseLatency);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
}
|
||||
@ -714,18 +712,6 @@ void VSTEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S)
|
||||
mUseGUI);
|
||||
}
|
||||
S.EndStatic();
|
||||
|
||||
S.StartStatic(_("Rescan Effects"));
|
||||
{
|
||||
S.AddVariableText(wxString() +
|
||||
_("To improve Audacity startup, a search for VST effects is performed ") +
|
||||
_("once and relevant information is recorded. When you add VST effects ") +
|
||||
_("to your system, you need to tell Audacity to rescan so the new ") +
|
||||
_("information can be recorded."))->Wrap(650);
|
||||
S.TieCheckBox(_("&Rescan effects on next launch"),
|
||||
mRescan);
|
||||
}
|
||||
S.EndStatic();
|
||||
}
|
||||
S.EndVerticalLay();
|
||||
}
|
||||
@ -749,9 +735,8 @@ void VSTEffectSettingsDialog::OnOk(wxCommandEvent & WXUNUSED(evt))
|
||||
PopulateOrExchange(S);
|
||||
|
||||
mHost->SetSharedConfig(wxT("Settings"), wxT("BufferSize"), mBufferSize);
|
||||
mHost->SetSharedConfig(wxT("Settings"), wxT("UseBufferDelay"), mUseBufferDelay);
|
||||
mHost->SetSharedConfig(wxT("Settings"), wxT("UseLatency"), mUseLatency);
|
||||
mHost->SetSharedConfig(wxT("Settings"), wxT("UseGUI"), mUseGUI);
|
||||
mHost->SetSharedConfig(wxT("Settings"), wxT("Rescan"), mRescan);
|
||||
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
@ -1418,7 +1403,7 @@ VSTEffect::VSTEffect(const wxString & path, VSTEffect *master)
|
||||
mWantsEditIdle = false;
|
||||
mUserBlockSize = 8192;
|
||||
mBlockSize = mUserBlockSize;
|
||||
mUseBufferDelay = true;
|
||||
mUseLatency = true;
|
||||
mReady = false;
|
||||
|
||||
mMasterIn = NULL;
|
||||
@ -1634,19 +1619,19 @@ bool VSTEffect::SetHost(EffectHostInterface *host)
|
||||
if (mHost)
|
||||
{
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("BufferSize"), mUserBlockSize, 8192);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseBufferDelay"), mUseBufferDelay, true);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseLatency"), mUseLatency, true);
|
||||
|
||||
mBlockSize = mUserBlockSize;
|
||||
|
||||
bool haveDefaults;
|
||||
mHost->GetPrivateConfig(wxT("Default"), wxT("Initialized"), haveDefaults, false);
|
||||
mHost->GetPrivateConfig(mHost->GetFactoryDefaultsGroup(), wxT("Initialized"), haveDefaults, false);
|
||||
if (!haveDefaults)
|
||||
{
|
||||
SaveParameters(wxT("Default"));
|
||||
mHost->SetPrivateConfig(wxT("Default"), wxT("Initialized"), true);
|
||||
SaveParameters(mHost->GetFactoryDefaultsGroup());
|
||||
mHost->SetPrivateConfig(mHost->GetFactoryDefaultsGroup(), wxT("Initialized"), true);
|
||||
}
|
||||
|
||||
LoadParameters(wxT("Current"));
|
||||
LoadParameters(mHost->GetCurrentSettingsGroup());
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1693,7 +1678,7 @@ void VSTEffect::SetSampleRate(sampleCount rate)
|
||||
|
||||
sampleCount VSTEffect::GetLatency()
|
||||
{
|
||||
if (mUseBufferDelay)
|
||||
if (mUseLatency)
|
||||
{
|
||||
// ??? Threading issue ???
|
||||
sampleCount delay = mBufferDelay;
|
||||
@ -2118,6 +2103,8 @@ bool VSTEffect::CloseUI()
|
||||
void VSTEffect::LoadUserPreset(const wxString & name)
|
||||
{
|
||||
LoadParameters(name);
|
||||
|
||||
RefreshParameters();
|
||||
}
|
||||
|
||||
void VSTEffect::SaveUserPreset(const wxString & name)
|
||||
@ -2125,18 +2112,6 @@ void VSTEffect::SaveUserPreset(const wxString & name)
|
||||
SaveParameters(name);
|
||||
}
|
||||
|
||||
void VSTEffect::LoadFactoryPreset(int id)
|
||||
{
|
||||
callDispatcher(effSetProgram, 0, id, NULL, 0.0);
|
||||
|
||||
RefreshParameters();
|
||||
}
|
||||
|
||||
void VSTEffect::LoadFactoryDefaults()
|
||||
{
|
||||
LoadParameters(mHost->GetFactoryDefaultsGroup());
|
||||
}
|
||||
|
||||
wxArrayString VSTEffect::GetFactoryPresets()
|
||||
{
|
||||
wxArrayString progs;
|
||||
@ -2152,6 +2127,25 @@ wxArrayString VSTEffect::GetFactoryPresets()
|
||||
return progs;
|
||||
}
|
||||
|
||||
void VSTEffect::LoadFactoryPreset(int id)
|
||||
{
|
||||
callDispatcher(effSetProgram, 0, id, NULL, 0.0);
|
||||
|
||||
RefreshParameters();
|
||||
}
|
||||
|
||||
void VSTEffect::LoadFactoryDefaults()
|
||||
{
|
||||
LoadParameters(mHost->GetFactoryDefaultsGroup());
|
||||
|
||||
RefreshParameters();
|
||||
}
|
||||
|
||||
bool VSTEffect::CanExport()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void VSTEffect::ExportPresets()
|
||||
{
|
||||
wxString path;
|
||||
@ -2265,6 +2259,11 @@ void VSTEffect::ImportPresets()
|
||||
return;
|
||||
}
|
||||
|
||||
bool VSTEffect::HasOptions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void VSTEffect::ShowOptions()
|
||||
{
|
||||
VSTEffectSettingsDialog dlg(mParent, mHost);
|
||||
@ -2614,8 +2613,11 @@ void VSTEffect::LoadParameters(const wxString & group)
|
||||
if (len)
|
||||
{
|
||||
callDispatcher(effSetChunk, 1, len, buf, 0.0);
|
||||
for (size_t i = 0, cnt = mSlaves.GetCount(); i < cnt; i++)
|
||||
{
|
||||
mSlaves[i]->callDispatcher(effSetChunk, 1, len, buf, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
delete [] buf;
|
||||
|
||||
return;
|
||||
@ -2623,6 +2625,8 @@ void VSTEffect::LoadParameters(const wxString & group)
|
||||
|
||||
if (mHost->GetPrivateConfig(group, wxT("Value"), value, wxEmptyString))
|
||||
{
|
||||
size_t cnt = mSlaves.GetCount();
|
||||
|
||||
wxStringTokenizer st(value, wxT(','));
|
||||
for (int i = 0; st.HasMoreTokens(); i++)
|
||||
{
|
||||
@ -2632,6 +2636,10 @@ void VSTEffect::LoadParameters(const wxString & group)
|
||||
if (val >= -1.0 && val <= 1.0)
|
||||
{
|
||||
callSetParameter(i, val);
|
||||
for (size_t i = 0; i < cnt; i++)
|
||||
{
|
||||
mSlaves[i]->callSetParameter(i, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2788,7 +2796,7 @@ void VSTEffect::Automate(int index, float value)
|
||||
void VSTEffect::SetBufferDelay(int samples)
|
||||
{
|
||||
// We do not support negative delay
|
||||
if (samples >= 0 && mUseBufferDelay)
|
||||
if (samples >= 0 && mUseLatency)
|
||||
{
|
||||
mBufferDelay = samples;
|
||||
}
|
||||
|
@ -138,13 +138,15 @@ class VSTEffect : public EffectClientInterface,
|
||||
virtual void LoadUserPreset(const wxString & name);
|
||||
virtual void SaveUserPreset(const wxString & name);
|
||||
|
||||
virtual wxArrayString GetFactoryPresets();
|
||||
virtual void LoadFactoryPreset(int id);
|
||||
virtual void LoadFactoryDefaults();
|
||||
|
||||
virtual wxArrayString GetFactoryPresets();
|
||||
|
||||
virtual bool CanExport();
|
||||
virtual void ExportPresets();
|
||||
virtual void ImportPresets();
|
||||
|
||||
virtual bool HasOptions();
|
||||
virtual void ShowOptions();
|
||||
|
||||
// VSTEffect implementation
|
||||
@ -272,7 +274,7 @@ private:
|
||||
|
||||
VstTimeInfo mTimeInfo;
|
||||
|
||||
bool mUseBufferDelay;
|
||||
bool mUseLatency;
|
||||
int mBufferDelay;
|
||||
|
||||
sampleCount mBlockSize;
|
||||
|
@ -92,7 +92,7 @@ wxString AudioUnitEffectsModule::GetPath()
|
||||
|
||||
wxString AudioUnitEffectsModule::GetName()
|
||||
{
|
||||
return _("AudioUnit Effects Module");
|
||||
return _("Audio Unit Effects Module");
|
||||
}
|
||||
|
||||
wxString AudioUnitEffectsModule::GetVendor()
|
||||
@ -108,7 +108,7 @@ wxString AudioUnitEffectsModule::GetVersion()
|
||||
|
||||
wxString AudioUnitEffectsModule::GetDescription()
|
||||
{
|
||||
return _("Provides AudioUnit Effects support to Audacity");
|
||||
return _("Provides Audio Unit Effects support to Audacity");
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@ -291,10 +291,8 @@ public:
|
||||
|
||||
private:
|
||||
EffectHostInterface *mHost;
|
||||
int mBufferSize;
|
||||
bool mUseBufferDelay;
|
||||
bool mUseLatency;
|
||||
bool mUseGUI;
|
||||
bool mRescan;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
@ -304,11 +302,11 @@ BEGIN_EVENT_TABLE(AudioUnitEffectSettingsDialog, wxDialog)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
AudioUnitEffectSettingsDialog::AudioUnitEffectSettingsDialog(wxWindow * parent, EffectHostInterface *host)
|
||||
: wxDialog(parent, wxID_ANY, wxString(_("AudioUnit Effect Settings")))
|
||||
: wxDialog(parent, wxID_ANY, wxString(_("Audio Unit Effect Settings")))
|
||||
{
|
||||
mHost = host;
|
||||
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseBufferDelay"), mUseBufferDelay, true);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseLatency"), mUseLatency, true);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseGUI"), mUseGUI, true);
|
||||
|
||||
ShuttleGui S(this, eIsCreating);
|
||||
@ -326,19 +324,19 @@ void AudioUnitEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S)
|
||||
{
|
||||
S.StartVerticalLay(false);
|
||||
{
|
||||
S.StartStatic(_("Buffer Delay Compensation"));
|
||||
S.StartStatic(_("Latency Compensation"));
|
||||
{
|
||||
S.AddVariableText(wxString() +
|
||||
_("As part of their processing, some AudioUnit effects must delay returning ") +
|
||||
_("As part of their processing, some Audio Unit effects must delay returning ") +
|
||||
_("audio to Audacity. When not compensating for this delay, you will ") +
|
||||
_("notice that small silences have been inserted into the audio. ") +
|
||||
_("Enabling this setting will provide that compensation, but it may ") +
|
||||
_("not work for all AudioUnit effects."))->Wrap(650);
|
||||
_("not work for all Audio Unit effects."))->Wrap(650);
|
||||
|
||||
S.StartHorizontalLay(wxALIGN_LEFT);
|
||||
{
|
||||
S.TieCheckBox(_("Enable &compensation"),
|
||||
mUseBufferDelay);
|
||||
mUseLatency);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
}
|
||||
@ -347,7 +345,7 @@ void AudioUnitEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S)
|
||||
S.StartStatic(_("Graphical Mode"));
|
||||
{
|
||||
S.AddVariableText(wxString() +
|
||||
_("Most AudioUnit effects have a graphical interface for setting parameter values.") +
|
||||
_("Most Audio Unit effects have a graphical interface for setting parameter values.") +
|
||||
_(" A basic text-only method is also available. ") +
|
||||
_(" Reopen the effect for this to take effect."))->Wrap(650);
|
||||
S.TieCheckBox(_("Enable &graphical interface"),
|
||||
@ -376,7 +374,7 @@ void AudioUnitEffectSettingsDialog::OnOk(wxCommandEvent & WXUNUSED(evt))
|
||||
ShuttleGui S(this, eIsGettingFromDialog);
|
||||
PopulateOrExchange(S);
|
||||
|
||||
mHost->SetSharedConfig(wxT("Settings"), wxT("UseBufferDelay"), mUseBufferDelay);
|
||||
mHost->SetSharedConfig(wxT("Settings"), wxT("UseLatency"), mUseLatency);
|
||||
mHost->SetSharedConfig(wxT("Settings"), wxT("UseGUI"), mUseGUI);
|
||||
|
||||
EndModal(wxID_OK);
|
||||
@ -415,7 +413,7 @@ BEGIN_EVENT_TABLE(AudioUnitEffectExportDialog, wxDialog)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
AudioUnitEffectExportDialog::AudioUnitEffectExportDialog(wxWindow * parent, AudioUnitEffect *effect)
|
||||
: wxDialog(parent, wxID_ANY, wxString(_("Export AudioUnit Presets")))
|
||||
: wxDialog(parent, wxID_ANY, wxString(_("Export Audio Unit Presets")))
|
||||
{
|
||||
mEffect = effect;
|
||||
|
||||
@ -582,7 +580,7 @@ BEGIN_EVENT_TABLE(AudioUnitEffectImportDialog, wxDialog)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
AudioUnitEffectImportDialog::AudioUnitEffectImportDialog(wxWindow * parent, AudioUnitEffect *effect)
|
||||
: wxDialog(parent, wxID_ANY, wxString(_("Import AudioUnit Presets")))
|
||||
: wxDialog(parent, wxID_ANY, wxString(_("Import Audio Unit Presets")))
|
||||
{
|
||||
mEffect = effect;
|
||||
|
||||
@ -1131,19 +1129,18 @@ bool AudioUnitEffect::SetHost(EffectHostInterface *host)
|
||||
// mHost will be null during registration
|
||||
if (mHost)
|
||||
{
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("BufferSize"), mBufferSize, 8192);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseBufferDelay"), mUseBufferDelay, true);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseLatency"), mUseLatency, true);
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseGUI"), mUseGUI, true);
|
||||
|
||||
bool haveDefaults;
|
||||
mHost->GetPrivateConfig(wxT("Default"), wxT("Initialized"), haveDefaults, false);
|
||||
mHost->GetPrivateConfig(mHost->GetFactoryDefaultsGroup(), wxT("Initialized"), haveDefaults, false);
|
||||
if (!haveDefaults)
|
||||
{
|
||||
SaveParameters(wxT("Default"));
|
||||
mHost->SetPrivateConfig(wxT("Default"), wxT("Initialized"), true);
|
||||
SaveParameters(mHost->GetFactoryDefaultsGroup());
|
||||
mHost->SetPrivateConfig(mHost->GetFactoryDefaultsGroup(), wxT("Initialized"), true);
|
||||
}
|
||||
|
||||
LoadParameters(wxT("Current"));
|
||||
LoadParameters(mHost->GetCurrentSettingsGroup());
|
||||
}
|
||||
|
||||
if (!mMaster)
|
||||
@ -1264,7 +1261,7 @@ sampleCount AudioUnitEffect::GetBlockSize(sampleCount maxBlockSize)
|
||||
|
||||
sampleCount AudioUnitEffect::GetLatency()
|
||||
{
|
||||
if (!mLatencyDone)
|
||||
if (mUseLatency && !mLatencyDone)
|
||||
{
|
||||
mLatencyDone = true;
|
||||
return mLatency * mSampleRate;
|
||||
@ -2026,6 +2023,11 @@ wxArrayString AudioUnitEffect::GetFactoryPresets()
|
||||
return presets;
|
||||
}
|
||||
|
||||
bool AudioUnitEffect::CanExport()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AudioUnitEffect::ExportPresets()
|
||||
{
|
||||
AudioUnitEffectExportDialog dlg(mDialog, this);
|
||||
@ -2038,6 +2040,11 @@ void AudioUnitEffect::ImportPresets()
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
bool AudioUnitEffect::HasOptions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AudioUnitEffect::ShowOptions()
|
||||
{
|
||||
AudioUnitEffectSettingsDialog dlg(mParent, mHost);
|
||||
|
@ -117,8 +117,11 @@ public:
|
||||
|
||||
virtual wxArrayString GetFactoryPresets();
|
||||
|
||||
virtual bool CanExport();
|
||||
virtual void ExportPresets();
|
||||
virtual void ImportPresets();
|
||||
|
||||
virtual bool HasOptions();
|
||||
virtual void ShowOptions();
|
||||
|
||||
// AudioUnitEffect implementation
|
||||
@ -186,7 +189,7 @@ private:
|
||||
double mSampleRate;
|
||||
|
||||
int mBufferSize;
|
||||
bool mUseBufferDelay;
|
||||
bool mUseLatency;
|
||||
|
||||
AudioTimeStamp mTimeStamp;
|
||||
bool mReady;
|
||||
|
@ -48,6 +48,7 @@ effects from this one class.
|
||||
|
||||
#include "LadspaEffect.h" // This class's header file
|
||||
#include "../../Internat.h"
|
||||
#include "../../ShuttleGui.h"
|
||||
#include "../../widgets/valnum.h"
|
||||
|
||||
// ============================================================================
|
||||
@ -373,6 +374,99 @@ void LadspaEffectsModule::DeleteInstance(IdentInterface *instance)
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// LadspaEffectSettingsDialog
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class LadspaEffectSettingsDialog:public wxDialog
|
||||
{
|
||||
public:
|
||||
LadspaEffectSettingsDialog(wxWindow * parent, EffectHostInterface *host);
|
||||
virtual ~LadspaEffectSettingsDialog();
|
||||
|
||||
void PopulateOrExchange(ShuttleGui & S);
|
||||
|
||||
void OnOk(wxCommandEvent & evt);
|
||||
|
||||
private:
|
||||
EffectHostInterface *mHost;
|
||||
bool mUseLatency;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(LadspaEffectSettingsDialog, wxDialog)
|
||||
EVT_BUTTON(wxID_OK, LadspaEffectSettingsDialog::OnOk)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
LadspaEffectSettingsDialog::LadspaEffectSettingsDialog(wxWindow * parent, EffectHostInterface *host)
|
||||
: wxDialog(parent, wxID_ANY, wxString(_("Ladspa Effect Settings")))
|
||||
{
|
||||
mHost = host;
|
||||
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseLatency"), mUseLatency, true);
|
||||
|
||||
ShuttleGui S(this, eIsCreating);
|
||||
PopulateOrExchange(S);
|
||||
}
|
||||
|
||||
LadspaEffectSettingsDialog::~LadspaEffectSettingsDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void LadspaEffectSettingsDialog::PopulateOrExchange(ShuttleGui & S)
|
||||
{
|
||||
S.SetBorder(5);
|
||||
S.StartHorizontalLay(wxEXPAND, 1);
|
||||
{
|
||||
S.StartVerticalLay(false);
|
||||
{
|
||||
S.StartStatic(_("Latency Compensation"));
|
||||
{
|
||||
S.AddVariableText(wxString() +
|
||||
_("As part of their processing, some Ladspa effects must delay returning ") +
|
||||
_("audio to Audacity. When not compensating for this delay, you will ") +
|
||||
_("notice that small silences have been inserted into the audio. ") +
|
||||
_("Enabling this setting will provide that compensation, but it may ") +
|
||||
_("not work for all Ladspa effects."))->Wrap(650);
|
||||
|
||||
S.StartHorizontalLay(wxALIGN_LEFT);
|
||||
{
|
||||
S.TieCheckBox(_("Enable &compensation"),
|
||||
mUseLatency);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
}
|
||||
S.EndStatic();
|
||||
}
|
||||
S.EndVerticalLay();
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
|
||||
S.AddStandardButtons();
|
||||
|
||||
Layout();
|
||||
Fit();
|
||||
Center();
|
||||
}
|
||||
|
||||
void LadspaEffectSettingsDialog::OnOk(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
if (!Validate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ShuttleGui S(this, eIsGettingFromDialog);
|
||||
PopulateOrExchange(S);
|
||||
|
||||
mHost->SetSharedConfig(wxT("Settings"), wxT("UseLatency"), mUseLatency);
|
||||
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// LadspaEffectEventHelper
|
||||
@ -739,18 +833,17 @@ bool LadspaEffect::SetHost(EffectHostInterface *host)
|
||||
// mHost will be null during registration
|
||||
if (mHost)
|
||||
{
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("BufferSize"), mUserBlockSize, 8192);
|
||||
mBlockSize = mUserBlockSize;
|
||||
mHost->GetSharedConfig(wxT("Settings"), wxT("UseLatency"), mUseLatency, true);
|
||||
|
||||
bool haveDefaults;
|
||||
mHost->GetPrivateConfig(wxT("Default"), wxT("Initialized"), haveDefaults, false);
|
||||
mHost->GetPrivateConfig(mHost->GetFactoryDefaultsGroup(), wxT("Initialized"), haveDefaults, false);
|
||||
if (!haveDefaults)
|
||||
{
|
||||
SaveParameters(wxT("Default"));
|
||||
mHost->SetPrivateConfig(wxT("Default"), wxT("Initialized"), true);
|
||||
SaveParameters(mHost->GetFactoryDefaultsGroup());
|
||||
mHost->SetPrivateConfig(mHost->GetFactoryDefaultsGroup(), wxT("Initialized"), true);
|
||||
}
|
||||
|
||||
LoadParameters(wxT("Current"));
|
||||
LoadParameters(mHost->GetCurrentSettingsGroup());
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -783,24 +876,12 @@ void LadspaEffect::SetSampleRate(sampleCount rate)
|
||||
|
||||
sampleCount LadspaEffect::GetBlockSize(sampleCount maxBlockSize)
|
||||
{
|
||||
#if 0
|
||||
// TODO: Allow user to specify the max blocksize
|
||||
if (mUserBlockSize > maxBlockSize)
|
||||
{
|
||||
mBlockSize = maxBlockSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
mBlockSize = mUserBlockSize;
|
||||
}
|
||||
#endif
|
||||
|
||||
return mBlockSize;
|
||||
}
|
||||
|
||||
sampleCount LadspaEffect::GetLatency()
|
||||
{
|
||||
if (mLatencyPort >= 0 && !mLatencyDone)
|
||||
if (mUseLatency && mLatencyPort >= 0 && !mLatencyDone)
|
||||
{
|
||||
mLatencyDone = true;
|
||||
return mOutputControls[mLatencyPort] * 2;
|
||||
@ -1284,6 +1365,7 @@ bool LadspaEffect::CloseUI()
|
||||
void LadspaEffect::LoadUserPreset(const wxString & name)
|
||||
{
|
||||
LoadParameters(name);
|
||||
RefreshControls();
|
||||
}
|
||||
|
||||
void LadspaEffect::SaveUserPreset(const wxString & name)
|
||||
@ -1291,6 +1373,11 @@ void LadspaEffect::SaveUserPreset(const wxString & name)
|
||||
SaveParameters(name);
|
||||
}
|
||||
|
||||
wxArrayString LadspaEffect::GetFactoryPresets()
|
||||
{
|
||||
return wxArrayString();
|
||||
}
|
||||
|
||||
void LadspaEffect::LoadFactoryPreset(int WXUNUSED(id))
|
||||
{
|
||||
return;
|
||||
@ -1299,11 +1386,12 @@ void LadspaEffect::LoadFactoryPreset(int WXUNUSED(id))
|
||||
void LadspaEffect::LoadFactoryDefaults()
|
||||
{
|
||||
LoadParameters(mHost->GetFactoryDefaultsGroup());
|
||||
RefreshControls();
|
||||
}
|
||||
|
||||
wxArrayString LadspaEffect::GetFactoryPresets()
|
||||
bool LadspaEffect::CanExport()
|
||||
{
|
||||
return wxArrayString();
|
||||
return false;
|
||||
}
|
||||
|
||||
void LadspaEffect::ExportPresets()
|
||||
@ -1314,8 +1402,19 @@ void LadspaEffect::ImportPresets()
|
||||
{
|
||||
}
|
||||
|
||||
bool LadspaEffect::HasOptions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void LadspaEffect::ShowOptions()
|
||||
{
|
||||
LadspaEffectSettingsDialog dlg(mParent, mHost);
|
||||
if (dlg.ShowModal())
|
||||
{
|
||||
// Reinitialize configuration settings
|
||||
SetHost(mHost);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@ -109,13 +109,15 @@ public:
|
||||
virtual void LoadUserPreset(const wxString & name);
|
||||
virtual void SaveUserPreset(const wxString & name);
|
||||
|
||||
virtual wxArrayString GetFactoryPresets();
|
||||
virtual void LoadFactoryPreset(int id);
|
||||
virtual void LoadFactoryDefaults();
|
||||
|
||||
virtual wxArrayString GetFactoryPresets();
|
||||
|
||||
virtual bool CanExport();
|
||||
virtual void ExportPresets();
|
||||
virtual void ImportPresets();
|
||||
|
||||
virtual bool HasOptions();
|
||||
virtual void ShowOptions();
|
||||
|
||||
// LadspaEffect implementation
|
||||
@ -167,6 +169,7 @@ private:
|
||||
int mNumOutputControls;
|
||||
float *mOutputControls;
|
||||
|
||||
bool mUseLatency;
|
||||
int mLatencyPort;
|
||||
bool mLatencyDone;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user