2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
Effect.cpp
|
|
|
|
|
|
|
|
Dominic Mazzoni
|
|
|
|
Vaughan Johnson
|
|
|
|
Martyn Shaw
|
|
|
|
|
|
|
|
*******************************************************************//**
|
|
|
|
|
|
|
|
\class Effect
|
|
|
|
\brief Base class for many of the effects in Audacity.
|
|
|
|
|
|
|
|
*//****************************************************************//**
|
|
|
|
|
|
|
|
\class EffectDialog
|
2014-06-03 20:30:19 +00:00
|
|
|
\brief New (Jun-2006) base class for effects dialogs. Likely to get
|
2010-01-23 19:44:49 +00:00
|
|
|
greater use in future.
|
|
|
|
|
|
|
|
*//*******************************************************************/
|
|
|
|
|
|
|
|
#include "../Audacity.h"
|
|
|
|
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/msgdlg.h>
|
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/timer.h>
|
2014-12-02 08:55:02 +00:00
|
|
|
#include <wx/tglbtn.h>
|
2010-01-23 19:44:49 +00:00
|
|
|
#include <wx/hashmap.h>
|
2014-12-12 14:44:50 +00:00
|
|
|
#include <wx/utils.h>
|
2010-01-23 19:44:49 +00:00
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
#include "audacity/ConfigInterface.h"
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
#include "Effect.h"
|
|
|
|
#include "../AudioIO.h"
|
|
|
|
#include "../Mix.h"
|
|
|
|
#include "../Prefs.h"
|
|
|
|
#include "../Project.h"
|
|
|
|
#include "../WaveTrack.h"
|
2014-12-04 06:10:27 +00:00
|
|
|
#include "../toolbars/ControlToolBar.h"
|
2014-12-02 08:55:02 +00:00
|
|
|
#include "../widgets/AButton.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
#include "../widgets/ProgressDialog.h"
|
|
|
|
#include "../ondemand/ODManager.h"
|
|
|
|
#include "TimeWarper.h"
|
|
|
|
|
2014-11-29 01:22:41 +00:00
|
|
|
#if defined(EXPERIMENTAL_REALTIME_EFFECTS) && defined(__WXMAC__)
|
|
|
|
#include <wx/mac/private.h>
|
|
|
|
#endif
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
WX_DECLARE_VOIDPTR_HASH_MAP( bool, t2bHash );
|
|
|
|
|
|
|
|
//
|
|
|
|
// public static methods
|
|
|
|
//
|
|
|
|
|
|
|
|
double Effect::sDefaultGenerateLen = 30.0;
|
|
|
|
|
|
|
|
|
|
|
|
wxString Effect::StripAmpersand(const wxString& str)
|
|
|
|
{
|
|
|
|
wxString strippedStr = str;
|
|
|
|
strippedStr.Replace(wxT("&"), wxT(""));
|
2013-09-22 11:48:29 +00:00
|
|
|
// ! is used for hiding effects, and should not affect sort order.
|
|
|
|
strippedStr.Replace(wxT("!"), wxT(""));
|
2010-01-23 19:44:49 +00:00
|
|
|
return strippedStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// public methods
|
|
|
|
//
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
// Legacy (or full blown effect)
|
2010-01-23 19:44:49 +00:00
|
|
|
Effect::Effect()
|
|
|
|
{
|
2014-11-14 03:03:17 +00:00
|
|
|
mParent = NULL;
|
|
|
|
|
2014-11-05 20:41:29 +00:00
|
|
|
mClient = NULL;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
|
2014-11-05 20:41:29 +00:00
|
|
|
mWarper = NULL;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
|
2014-11-05 20:41:29 +00:00
|
|
|
mTracks = NULL;
|
|
|
|
mOutputTracks = NULL;
|
|
|
|
mOutputTracksType = Track::None;
|
2014-11-07 09:54:04 +00:00
|
|
|
mDuration = 0.0;
|
2014-11-05 20:41:29 +00:00
|
|
|
mNumTracks = 0;
|
|
|
|
mNumGroups = 0;
|
|
|
|
mProgress = NULL;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
|
2014-12-13 18:24:11 +00:00
|
|
|
mRealtimeSuspendLock.Enter();
|
|
|
|
mRealtimeSuspendCount = 1; // Effects are initially suspended
|
|
|
|
mRealtimeSuspendLock.Leave();
|
|
|
|
|
2014-11-05 20:41:29 +00:00
|
|
|
// Can change effect flags later (this is the new way)
|
|
|
|
// OR using the old way, over-ride GetEffectFlags().
|
|
|
|
mFlags = BUILTIN_EFFECT | PROCESS_EFFECT | ADVANCED_EFFECT;
|
|
|
|
|
|
|
|
mNumAudioIn = 0;
|
|
|
|
mNumAudioOut = 0;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
|
|
|
|
mInBuffer = NULL;
|
|
|
|
mOutBuffer = NULL;
|
|
|
|
mInBufPos = NULL;
|
|
|
|
mOutBufPos = NULL;
|
|
|
|
|
|
|
|
mBufferSize = 0;
|
|
|
|
mBlockSize = 0;
|
|
|
|
mNumChannels = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Effect::~Effect()
|
|
|
|
{
|
|
|
|
if (mWarper != NULL)
|
|
|
|
{
|
|
|
|
delete mWarper;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// EffectIdentInterface implementation
|
|
|
|
|
|
|
|
EffectType Effect::GetType()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetType();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mFlags & HIDDEN_EFFECT)
|
|
|
|
{
|
|
|
|
return EffectTypeNone;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mFlags & INSERT_EFFECT)
|
|
|
|
{
|
|
|
|
return EffectTypeGenerate;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mFlags & PROCESS_EFFECT)
|
|
|
|
{
|
|
|
|
return EffectTypeProcess;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mFlags & ANALYZE_EFFECT)
|
|
|
|
{
|
|
|
|
return EffectTypeAnalyze;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxASSERT( true );
|
|
|
|
|
|
|
|
return EffectTypeNone;
|
|
|
|
}
|
|
|
|
|
|
|
|
PluginID Effect::GetID()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetID();
|
|
|
|
}
|
|
|
|
|
|
|
|
return wxString::Format(wxT("LEGACY_EFFECT_ID_%d"), GetEffectID());
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString Effect::GetPath()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetPath();
|
|
|
|
}
|
|
|
|
|
|
|
|
return wxEmptyString;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString Effect::GetName()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetName();
|
|
|
|
}
|
|
|
|
|
2014-12-08 03:11:20 +00:00
|
|
|
return GetEffectIdentifier();
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxString Effect::GetVendor()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetVendor();
|
|
|
|
}
|
|
|
|
|
2014-11-04 01:38:13 +00:00
|
|
|
return _("Audacity");
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxString Effect::GetVersion()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetVersion();
|
|
|
|
}
|
|
|
|
|
|
|
|
return wxT("Various");
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString Effect::GetDescription()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetDescription();
|
|
|
|
}
|
|
|
|
|
|
|
|
return GetEffectIdentifier();
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString Effect::GetFamily()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetFamily();
|
|
|
|
}
|
|
|
|
|
2014-11-04 01:38:13 +00:00
|
|
|
return _("Audacity");
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
bool Effect::IsInteractive()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->IsInteractive();
|
|
|
|
}
|
|
|
|
|
|
|
|
return GetEffectName().EndsWith(wxT("..."));
|
|
|
|
}
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
bool Effect::IsDefault()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->IsDefault();
|
|
|
|
}
|
|
|
|
|
|
|
|
return (mFlags & BUILTIN_EFFECT) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::IsLegacy()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
bool Effect::SupportsAutomation()
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
2014-11-14 03:03:17 +00:00
|
|
|
return mClient->SupportsAutomation();
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
return SupportsChains();
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// EffectHostInterface implementation
|
|
|
|
|
2014-11-07 09:54:04 +00:00
|
|
|
double Effect::GetDuration()
|
|
|
|
{
|
|
|
|
if (mT1 > mT0)
|
|
|
|
{
|
|
|
|
return mT1 - mT0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mClient->GetType() == EffectTypeGenerate)
|
|
|
|
{
|
|
|
|
return sDefaultGenerateLen;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetDuration(double seconds)
|
|
|
|
{
|
|
|
|
mDuration = seconds;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
bool Effect::Apply()
|
|
|
|
{
|
2014-11-07 09:54:04 +00:00
|
|
|
// This is absolute hackage...but easy
|
|
|
|
//
|
|
|
|
// It should callback to the EffectManager to kick off the processing
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
GetActiveProject()->OnEffect(GetID(), true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Effect::Preview()
|
|
|
|
{
|
|
|
|
Preview(false);
|
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
wxDialog *Effect::CreateUI(wxWindow *parent, EffectUIClientInterface *client)
|
|
|
|
{
|
|
|
|
EffectUIHost *dlg = new EffectUIHost(parent, this, client);
|
|
|
|
|
2014-12-01 07:27:49 +00:00
|
|
|
#if defined(__WXMAC__)
|
|
|
|
// We want the effects windows on the Mac to float above the project window
|
|
|
|
// but still have normal modal dialogs appear above the effects windows and
|
|
|
|
// not let the effect windows fall behind the project window.
|
|
|
|
//
|
|
|
|
// This seems to accomplish that, but time will be the real judge.
|
|
|
|
WindowRef windowRef = (WindowRef) dlg->MacGetWindowRef();
|
|
|
|
WindowGroupRef parentGroup = GetWindowGroup((WindowRef) ((wxFrame *)wxGetTopLevelParent(parent))->MacGetWindowRef());
|
|
|
|
ChangeWindowGroupAttributes(parentGroup, kWindowGroupAttrSharedActivation, kWindowGroupAttrMoveTogether);
|
|
|
|
SetWindowGroup(windowRef, parentGroup);
|
|
|
|
#endif
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
if (dlg->Initialize())
|
|
|
|
{
|
|
|
|
return dlg;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete dlg;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString Effect::GetUserPresetsGroup(const wxString & name)
|
|
|
|
{
|
|
|
|
wxString group = wxT("UserPresets");
|
|
|
|
if (!name.IsEmpty())
|
|
|
|
{
|
|
|
|
group += wxCONFIG_PATH_SEPARATOR + name;
|
|
|
|
}
|
|
|
|
|
|
|
|
return group;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString Effect::GetCurrentSettingsGroup()
|
|
|
|
{
|
|
|
|
return wxT("CurrentSettings");
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString Effect::GetFactoryDefaultsGroup()
|
|
|
|
{
|
|
|
|
return wxT("FactoryDefaults");
|
|
|
|
}
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
// ConfigClientInterface implementation
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
bool Effect::GetSharedConfigSubgroups(const wxString & group, wxArrayString & subgroups)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetSharedConfigSubgroups(GetID(), group, subgroups);
|
|
|
|
}
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
bool Effect::GetSharedConfig(const wxString & group, const wxString & key, wxString & value, const wxString & defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetSharedConfig(const wxString & group, const wxString & key, int & value, int defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetSharedConfig(const wxString & group, const wxString & key, bool & value, bool defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetSharedConfig(const wxString & group, const wxString & key, float & value, float defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetSharedConfig(const wxString & group, const wxString & key, double & value, double defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetSharedConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const wxString & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const int & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const bool & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const float & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const double & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const sampleCount & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
bool Effect::RemoveSharedConfigSubgroup(const wxString & group)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().RemoveSharedConfigSubgroup(GetID(), group);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::RemoveSharedConfig(const wxString & group, const wxString & key)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().RemoveSharedConfig(GetID(), group, key);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetPrivateConfigSubgroups(const wxString & group, wxArrayString & subgroups)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetPrivateConfigSubgroups(GetID(), group, subgroups);
|
|
|
|
}
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
bool Effect::GetPrivateConfig(const wxString & group, const wxString & key, wxString & value, const wxString & defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetPrivateConfig(const wxString & group, const wxString & key, int & value, int defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetPrivateConfig(const wxString & group, const wxString & key, bool & value, bool defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetPrivateConfig(const wxString & group, const wxString & key, float & value, float defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetPrivateConfig(const wxString & group, const wxString & key, double & value, double defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::GetPrivateConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, const wxString & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, const int & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, const bool & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, const float & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, const double & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, const sampleCount & value)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
|
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
bool Effect::RemovePrivateConfigSubgroup(const wxString & group)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().RemovePrivateConfigSubgroup(GetID(), group);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::RemovePrivateConfig(const wxString & group, const wxString & key)
|
|
|
|
{
|
|
|
|
return PluginManager::Get().RemovePrivateConfig(GetID(), group, key);
|
|
|
|
}
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
// Effect implementation
|
|
|
|
|
2014-11-05 20:41:29 +00:00
|
|
|
bool Effect::Startup(EffectClientInterface *client)
|
|
|
|
{
|
2014-11-07 09:54:04 +00:00
|
|
|
// Let destructor know we need to be shutdown
|
|
|
|
mClient = client;
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
// Set host so client startup can use our services
|
|
|
|
if (!mClient->SetHost(this))
|
2014-11-05 20:41:29 +00:00
|
|
|
{
|
2014-11-14 03:03:17 +00:00
|
|
|
// Bail if the client startup fails
|
2014-11-07 09:54:04 +00:00
|
|
|
mClient = NULL;
|
2014-11-05 20:41:29 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
mNumAudioIn = mClient->GetAudioInCount();
|
|
|
|
mNumAudioOut = mClient->GetAudioOutCount();
|
|
|
|
|
|
|
|
int flags = PLUGIN_EFFECT;
|
|
|
|
switch (mClient->GetType())
|
|
|
|
{
|
|
|
|
case EffectTypeGenerate:
|
|
|
|
flags |= INSERT_EFFECT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EffectTypeProcess:
|
|
|
|
flags |= PROCESS_EFFECT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EffectTypeAnalyze:
|
|
|
|
flags |= INSERT_EFFECT;
|
|
|
|
break;
|
2014-11-19 06:58:44 +00:00
|
|
|
|
|
|
|
case EffectTypeNone:
|
|
|
|
// Nothing to set
|
|
|
|
break;
|
2014-11-05 20:41:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SetEffectFlags(flags);
|
2014-11-07 09:54:04 +00:00
|
|
|
|
|
|
|
return true;
|
2014-11-05 20:41:29 +00:00
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
bool Effect::GetAutomationParameters(wxString & parms)
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
EffectAutomationParameters eap;
|
|
|
|
if (!mClient->GetAutomationParameters(eap))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return eap.GetParameters(parms);
|
|
|
|
}
|
|
|
|
|
|
|
|
ShuttleCli shuttle;
|
|
|
|
shuttle.mbStoreInClient = false;
|
|
|
|
if (!TransferParameters(shuttle))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
parms = shuttle.mParams;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::SetAutomationParameters(const wxString & parms)
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
EffectAutomationParameters eap;
|
|
|
|
eap.SetParameters(parms);
|
|
|
|
return mClient->SetAutomationParameters(eap);
|
|
|
|
}
|
|
|
|
|
|
|
|
ShuttleCli shuttle;
|
|
|
|
shuttle.mParams = parms;
|
|
|
|
shuttle.mbStoreInClient = true;
|
|
|
|
return TransferParameters(shuttle);
|
|
|
|
}
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
// All legacy effects should have this overridden
|
|
|
|
wxString Effect::GetEffectName()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetName();
|
|
|
|
}
|
|
|
|
|
|
|
|
return wxT("DummyIdentifier");
|
|
|
|
}
|
|
|
|
|
|
|
|
// All legacy effects should have this overridden
|
|
|
|
wxString Effect::GetEffectIdentifier()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetName();
|
|
|
|
}
|
|
|
|
|
|
|
|
return wxT("DummyIdentifier");
|
|
|
|
}
|
|
|
|
|
|
|
|
// All legacy effects should have this overridden
|
|
|
|
wxString Effect::GetEffectAction()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return _("Applying ") + mClient->GetName();
|
|
|
|
}
|
|
|
|
|
|
|
|
return wxT("DummyName");
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::DoEffect(wxWindow *parent, int flags,
|
|
|
|
double projectRate,
|
|
|
|
TrackList *list,
|
|
|
|
TrackFactory *factory,
|
2014-10-05 17:10:09 +00:00
|
|
|
SelectedRegion *selectedRegion, wxString params)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2014-10-05 17:10:09 +00:00
|
|
|
double t0 = selectedRegion->t0();
|
|
|
|
double t1 = selectedRegion->t1();
|
|
|
|
wxASSERT(t0 <= t1);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
if (mOutputTracks)
|
|
|
|
{
|
2010-01-23 19:44:49 +00:00
|
|
|
delete mOutputTracks;
|
|
|
|
mOutputTracks = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
mFactory = factory;
|
|
|
|
mProjectRate = projectRate;
|
|
|
|
mParent = parent;
|
|
|
|
mTracks = list;
|
2014-10-05 17:10:09 +00:00
|
|
|
mT0 = t0;
|
|
|
|
mT1 = t1;
|
2014-10-18 14:19:38 +00:00
|
|
|
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
|
|
|
mF0 = selectedRegion->f0();
|
|
|
|
mF1 = selectedRegion->f1();
|
2014-10-24 20:27:04 +00:00
|
|
|
wxArrayString Names;
|
|
|
|
if( mF0 != SelectedRegion::UndefinedFrequency )
|
|
|
|
Names.Add(wxT("control-f0"));
|
|
|
|
if( mF1 != SelectedRegion::UndefinedFrequency )
|
|
|
|
Names.Add(wxT("control-f1"));
|
|
|
|
SetPresetParameters( &Names, NULL );
|
|
|
|
|
2014-10-18 14:19:38 +00:00
|
|
|
#endif
|
2010-01-23 19:44:49 +00:00
|
|
|
CountWaveTracks();
|
|
|
|
|
|
|
|
// Note: Init may read parameters from preferences
|
|
|
|
if (!Init())
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2010-01-23 19:44:49 +00:00
|
|
|
return false;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
// If a parameter string was provided, it overrides any remembered settings
|
|
|
|
// (but if the user is to be prompted, that takes priority)
|
|
|
|
if (!params.IsEmpty())
|
|
|
|
{
|
|
|
|
ShuttleCli shuttle;
|
|
|
|
shuttle.mParams = params;
|
|
|
|
shuttle.mbStoreInClient=true;
|
|
|
|
if( !TransferParameters( shuttle ))
|
|
|
|
{
|
|
|
|
wxMessageBox(
|
|
|
|
wxString::Format(
|
|
|
|
_("Could not set parameters of effect %s\n to %s."),
|
|
|
|
GetEffectName().c_str(),
|
|
|
|
params.c_str()
|
|
|
|
)
|
|
|
|
);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-03 20:30:19 +00:00
|
|
|
// Don't prompt user if we are dealing with a
|
2010-01-23 19:44:49 +00:00
|
|
|
// effect that is already configured, e.g. repeating
|
|
|
|
// the last effect on a different selection.
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
if ((flags & CONFIGURED_EFFECT) == 0)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
if (!PromptUser())
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2010-01-23 19:44:49 +00:00
|
|
|
return false;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool returnVal = true;
|
|
|
|
bool skipFlag = CheckWhetherSkipEffect();
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
if (skipFlag == false)
|
|
|
|
{
|
2010-01-23 19:44:49 +00:00
|
|
|
mProgress = new ProgressDialog(StripAmpersand(GetEffectName()),
|
2014-06-03 20:30:19 +00:00
|
|
|
GetEffectAction(),
|
2010-09-02 02:40:17 +00:00
|
|
|
pdlgHideStopButton);
|
2010-01-23 19:44:49 +00:00
|
|
|
returnVal = Process();
|
|
|
|
delete mProgress;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
mProgress = NULL;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
End();
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
if (mOutputTracks)
|
|
|
|
{
|
2010-01-23 19:44:49 +00:00
|
|
|
delete mOutputTracks;
|
|
|
|
mOutputTracks = NULL;
|
|
|
|
}
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
if (returnVal)
|
|
|
|
{
|
2014-10-05 17:10:09 +00:00
|
|
|
selectedRegion->setTimes(mT0, mT1);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
return returnVal;
|
|
|
|
}
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
// All legacy effects should have this overridden
|
|
|
|
bool Effect::Init()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::PromptUser()
|
|
|
|
{
|
|
|
|
return PromptUser(mParent);
|
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
bool Effect::PromptUser(wxWindow *parent, bool forceModal)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
2014-11-14 03:03:17 +00:00
|
|
|
bool res = mClient->ShowInterface(parent, forceModal);
|
|
|
|
|
|
|
|
// Really need to clean this up...should get easier when
|
|
|
|
// all effects get converted.
|
2014-11-19 06:58:44 +00:00
|
|
|
if (!res || (SupportsRealtime() && !forceModal))
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-14 03:03:17 +00:00
|
|
|
// Return false to force DoEffect() to skip processing since
|
|
|
|
// this UI has either been shown modeless or there was an error.
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2014-11-19 06:58:44 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
PromptUser();
|
|
|
|
}
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// All legacy effects should have this overridden
|
|
|
|
bool Effect::Process()
|
|
|
|
{
|
|
|
|
if (!mClient)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-11-07 09:54:04 +00:00
|
|
|
bool isGenerator = mClient->GetType() == EffectTypeGenerate;
|
|
|
|
|
|
|
|
CopyInputTracks(Track::All);
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
bool bGoodResult = true;
|
|
|
|
|
|
|
|
mInBuffer = NULL;
|
|
|
|
mOutBuffer = NULL;
|
|
|
|
|
|
|
|
sampleCount prevBufferSize = 0;
|
|
|
|
mBufferSize = 0;
|
|
|
|
mBlockSize = 0;
|
|
|
|
|
|
|
|
TrackListIterator iter(mOutputTracks);
|
|
|
|
int count = 0;
|
|
|
|
bool clear = false;
|
2014-11-07 09:54:04 +00:00
|
|
|
Track* t = iter.First();
|
|
|
|
|
|
|
|
for (t = iter.First(); t; t = iter.Next())
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-07 09:54:04 +00:00
|
|
|
if (t->GetKind() != Track::Wave || !t->GetSelected())
|
|
|
|
{
|
|
|
|
if (t->IsSyncLockSelected())
|
|
|
|
{
|
|
|
|
t->SyncLockAdjust(mT1, mT0 + mDuration);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
WaveTrack *left = (WaveTrack *)t;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
WaveTrack *right;
|
|
|
|
sampleCount len;
|
|
|
|
sampleCount leftStart;
|
|
|
|
sampleCount rightStart;
|
|
|
|
|
2014-11-07 09:54:04 +00:00
|
|
|
if (!isGenerator)
|
|
|
|
{
|
|
|
|
GetSamples(left, &leftStart, &len);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
len = 0;
|
|
|
|
leftStart = 0;
|
|
|
|
}
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
|
|
|
|
mNumChannels = 1;
|
|
|
|
|
|
|
|
right = NULL;
|
|
|
|
rightStart = 0;
|
|
|
|
if (left->GetLinked() && mNumAudioIn > 1)
|
|
|
|
{
|
|
|
|
right = (WaveTrack *) iter.Next();
|
2014-11-07 09:54:04 +00:00
|
|
|
if (!isGenerator)
|
|
|
|
{
|
|
|
|
GetSamples(right, &rightStart, &len);
|
|
|
|
}
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
clear = false;
|
|
|
|
mNumChannels = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Let the client know the sample rate
|
|
|
|
mClient->SetSampleRate(left->GetRate());
|
|
|
|
|
|
|
|
// Get the block size the client wants to use
|
|
|
|
sampleCount max = left->GetMaxBlockSize() * 2;
|
|
|
|
mBlockSize = mClient->GetBlockSize(max);
|
|
|
|
|
|
|
|
// Calculate the buffer size to be at least the max rounded up to the clients
|
|
|
|
// selected block size.
|
|
|
|
prevBufferSize = mBufferSize;
|
|
|
|
mBufferSize = ((max + (mBlockSize - 1)) / mBlockSize) * mBlockSize;
|
|
|
|
|
|
|
|
// If the buffer size has changed, then (re)allocate the buffers
|
|
|
|
if (prevBufferSize != mBufferSize)
|
|
|
|
{
|
|
|
|
// Get rid of any previous buffers
|
|
|
|
if (mInBuffer)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < mNumAudioIn; i++)
|
|
|
|
{
|
|
|
|
if (mInBuffer[i])
|
|
|
|
{
|
|
|
|
delete [] mInBuffer[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete [] mInBuffer;
|
|
|
|
delete [] mInBufPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Always create the number of input buffers the client expects even if we don't have
|
|
|
|
// the same number of channels.
|
|
|
|
mInBufPos = new float *[mNumAudioIn];
|
|
|
|
mInBuffer = new float *[mNumAudioIn];
|
|
|
|
for (int i = 0; i < mNumAudioIn; i++)
|
|
|
|
{
|
|
|
|
mInBuffer[i] = new float[mBufferSize];
|
|
|
|
}
|
|
|
|
|
|
|
|
// We won't be using more than the first 2 buffers, so clear the rest (if any)
|
|
|
|
for (int i = 2; i < mNumAudioIn; i++)
|
|
|
|
{
|
|
|
|
for (int j = 0; j < mBufferSize; j++)
|
|
|
|
{
|
|
|
|
mInBuffer[i][j] = 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get rid of any previous buffers
|
|
|
|
if (mOutBuffer)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < mNumAudioOut; i++)
|
|
|
|
{
|
|
|
|
if (mOutBuffer[i])
|
|
|
|
{
|
|
|
|
delete [] mOutBuffer[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete [] mOutBuffer;
|
|
|
|
delete [] mOutBufPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Always create the number of output buffers the client expects even if we don't have
|
|
|
|
// the same number of channels.
|
|
|
|
mOutBufPos = new float *[mNumAudioOut];
|
|
|
|
mOutBuffer = new float *[mNumAudioOut];
|
|
|
|
for (int i = 0; i < mNumAudioOut; i++)
|
|
|
|
{
|
|
|
|
// Output buffers get an extra mBlockSize worth to give extra room if
|
|
|
|
// the plugin adds latency
|
|
|
|
mOutBuffer[i] = new float[mBufferSize + mBlockSize];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// (Re)Set the input buffer positions
|
|
|
|
for (int i = 0; i < mNumAudioIn; i++)
|
|
|
|
{
|
|
|
|
mInBufPos[i] = mInBuffer[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
// (Re)Set the output buffer positions
|
|
|
|
for (int i = 0; i < mNumAudioOut; i++)
|
|
|
|
{
|
|
|
|
mOutBufPos[i] = mOutBuffer[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clear unused input buffers
|
|
|
|
if (!right && !clear && mNumAudioIn > 1)
|
|
|
|
{
|
|
|
|
for (int j = 0; j < mBufferSize; j++)
|
|
|
|
{
|
|
|
|
mInBuffer[1][j] = 0.0;
|
|
|
|
}
|
|
|
|
clear = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Go process the track(s)
|
|
|
|
bGoodResult = ProcessTrack(count, left, right, leftStart, rightStart, len);
|
|
|
|
if (!bGoodResult)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mOutBuffer)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < mNumAudioOut; i++)
|
|
|
|
{
|
|
|
|
delete [] mOutBuffer[i];
|
|
|
|
}
|
|
|
|
delete [] mOutBuffer;
|
|
|
|
delete [] mOutBufPos;
|
|
|
|
mOutBuffer = NULL;
|
|
|
|
mOutBufPos = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mInBuffer)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < mNumAudioIn; i++)
|
|
|
|
{
|
|
|
|
delete [] mInBuffer[i];
|
|
|
|
}
|
|
|
|
delete [] mInBuffer;
|
|
|
|
delete [] mInBufPos;
|
|
|
|
mInBuffer = NULL;
|
|
|
|
mInBufPos = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReplaceProcessedTracks(bGoodResult);
|
|
|
|
|
|
|
|
return bGoodResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::ProcessTrack(int count,
|
|
|
|
WaveTrack *left,
|
|
|
|
WaveTrack *right,
|
|
|
|
sampleCount leftStart,
|
|
|
|
sampleCount rightStart,
|
|
|
|
sampleCount len)
|
|
|
|
{
|
|
|
|
bool rc = true;
|
|
|
|
|
|
|
|
// Give the plugin a chance to initialize
|
|
|
|
mClient->ProcessInitialize();
|
|
|
|
|
|
|
|
// For each input block of samples, we pass it to the effect along with a
|
|
|
|
// variable output location. This output location is simply a pointer into a
|
|
|
|
// much larger buffer. This reduces the number of calls required to add the
|
|
|
|
// samples to the output track.
|
|
|
|
//
|
|
|
|
// Upon return from the effect, the output samples are "moved to the left" by
|
2014-10-29 03:46:53 +00:00
|
|
|
// the number of samples in the current latency setting, effectively removing any
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
// delay introduced by the effect.
|
|
|
|
//
|
2014-10-29 03:46:53 +00:00
|
|
|
// At the same time the total number of delayed samples are gathered and when
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
// there is no further input data to process, the loop continues to call the
|
|
|
|
// effect with an empty input buffer until the effect has had a chance to
|
|
|
|
// return all of the remaining delayed samples.
|
|
|
|
sampleCount inLeftPos = leftStart;
|
|
|
|
sampleCount inRightPos = rightStart;
|
|
|
|
sampleCount outLeftPos = leftStart;
|
|
|
|
sampleCount outRightPos = rightStart;
|
|
|
|
|
|
|
|
sampleCount inputRemaining = len;
|
|
|
|
sampleCount delayRemaining = 0;
|
|
|
|
sampleCount curBlockSize = 0;
|
|
|
|
sampleCount curDelay = 0;
|
|
|
|
|
|
|
|
sampleCount inputBufferCnt = 0;
|
|
|
|
sampleCount outputBufferCnt = 0;
|
|
|
|
bool cleared = false;
|
|
|
|
|
2014-11-07 09:54:04 +00:00
|
|
|
WaveTrack *genLeft = NULL;
|
|
|
|
WaveTrack *genRight = NULL;
|
|
|
|
sampleCount genLength = 0;
|
|
|
|
bool isGenerator = mClient->GetType() == EffectTypeGenerate;
|
2014-11-14 03:03:17 +00:00
|
|
|
bool isProcessor = mClient->GetType() == EffectTypeProcess;
|
2014-11-07 09:54:04 +00:00
|
|
|
if (isGenerator)
|
|
|
|
{
|
|
|
|
genLength = left->GetRate() * mDuration;
|
|
|
|
delayRemaining = genLength;
|
|
|
|
cleared = true;
|
|
|
|
|
|
|
|
// Create temporary tracks
|
|
|
|
genLeft = mFactory->NewWaveTrack(left->GetSampleFormat(), left->GetRate());
|
|
|
|
if (right)
|
|
|
|
{
|
|
|
|
genRight = mFactory->NewWaveTrack(right->GetSampleFormat(), right->GetRate());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
// Call the effect until we run out of input or delayed samples
|
|
|
|
while (inputRemaining || delayRemaining)
|
|
|
|
{
|
|
|
|
// Still working on the input samples
|
|
|
|
if (inputRemaining)
|
|
|
|
{
|
|
|
|
// Need to refill the input buffers
|
|
|
|
if (inputBufferCnt == 0)
|
|
|
|
{
|
|
|
|
// Calculate the number of samples to get
|
|
|
|
inputBufferCnt = mBufferSize;
|
|
|
|
if (inputBufferCnt > inputRemaining)
|
|
|
|
{
|
|
|
|
inputBufferCnt = inputRemaining;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fill the input buffers
|
|
|
|
left->Get((samplePtr) mInBuffer[0], floatSample, inLeftPos, inputBufferCnt);
|
|
|
|
if (right)
|
|
|
|
{
|
|
|
|
right->Get((samplePtr) mInBuffer[1], floatSample, inRightPos, inputBufferCnt);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset the input buffer positions
|
|
|
|
for (int i = 0; i < mNumChannels; i++)
|
|
|
|
{
|
|
|
|
mInBufPos[i] = mInBuffer[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculate the number of samples to process
|
|
|
|
curBlockSize = mBlockSize;
|
|
|
|
if (curBlockSize > inputRemaining)
|
|
|
|
{
|
|
|
|
// We've reached the last block...set current block size to what's left
|
|
|
|
curBlockSize = inputRemaining;
|
|
|
|
inputRemaining = 0;
|
|
|
|
|
|
|
|
// Clear the remainder of the buffers so that a full block can be passed
|
|
|
|
// to the effect
|
|
|
|
sampleCount cnt = mBlockSize - curBlockSize;
|
|
|
|
for (int i = 0; i < mNumChannels; i++)
|
|
|
|
{
|
|
|
|
for (int j = 0 ; j < cnt; j++)
|
|
|
|
{
|
|
|
|
mInBufPos[i][j + curBlockSize] = 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Might be able to use up some of the delayed samples
|
|
|
|
if (delayRemaining)
|
|
|
|
{
|
|
|
|
// Don't use more than needed
|
|
|
|
if (delayRemaining < cnt)
|
|
|
|
{
|
|
|
|
cnt = delayRemaining;
|
|
|
|
}
|
|
|
|
delayRemaining -= cnt;
|
|
|
|
curBlockSize += cnt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// We've exhausted the input samples and are now working on the delay
|
|
|
|
else if (delayRemaining)
|
|
|
|
{
|
|
|
|
// Calculate the number of samples to process
|
|
|
|
curBlockSize = mBlockSize;
|
|
|
|
if (curBlockSize > delayRemaining)
|
|
|
|
{
|
|
|
|
curBlockSize = delayRemaining;
|
|
|
|
}
|
|
|
|
delayRemaining -= curBlockSize;
|
|
|
|
|
|
|
|
// From this point on, we only want to feed zeros to the plugin
|
|
|
|
if (!cleared)
|
|
|
|
{
|
|
|
|
// Reset the input buffer positions
|
|
|
|
for (int i = 0; i < mNumChannels; i++)
|
|
|
|
{
|
|
|
|
mInBufPos[i] = mInBuffer[i];
|
|
|
|
|
|
|
|
// And clear
|
|
|
|
for (int j = 0; j < mBlockSize; j++)
|
|
|
|
{
|
|
|
|
mInBuffer[i][j] = 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cleared = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Finally call the plugin to process the block
|
|
|
|
try
|
|
|
|
{
|
|
|
|
mClient->ProcessBlock(mInBufPos, mOutBufPos, curBlockSize);
|
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bump to next input buffer position
|
|
|
|
if (inputRemaining)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < mNumChannels; i++)
|
|
|
|
{
|
|
|
|
mInBufPos[i] += curBlockSize;
|
|
|
|
}
|
|
|
|
inputRemaining -= curBlockSize;
|
|
|
|
inputBufferCnt -= curBlockSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the current number of delayed samples and accumulate
|
2014-11-14 03:03:17 +00:00
|
|
|
if (isProcessor)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-07 09:54:04 +00:00
|
|
|
sampleCount delay = mClient->GetLatency();
|
|
|
|
curDelay += delay;
|
|
|
|
delayRemaining += delay;
|
|
|
|
|
|
|
|
// If the plugin has delayed the output by more samples than our current
|
|
|
|
// block size, then we leave the output pointers alone. This effectively
|
|
|
|
// removes those delayed samples from the output buffer.
|
|
|
|
if (curDelay >= curBlockSize)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-07 09:54:04 +00:00
|
|
|
curDelay -= curBlockSize;
|
|
|
|
curBlockSize = 0;
|
|
|
|
}
|
|
|
|
// We have some delayed samples, at the beginning of the output samples,
|
|
|
|
// so overlay them by shifting the remaining output samples.
|
|
|
|
else if (curDelay > 0)
|
|
|
|
{
|
|
|
|
curBlockSize -= curDelay;
|
2014-11-14 03:03:17 +00:00
|
|
|
for (int i = 0; i < wxMin(mNumAudioOut, mNumChannels); i++)
|
2014-11-07 09:54:04 +00:00
|
|
|
{
|
|
|
|
memmove(mOutBufPos[i], mOutBufPos[i] + curDelay, SAMPLE_SIZE(floatSample) * curBlockSize);
|
|
|
|
}
|
|
|
|
curDelay = 0;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
outputBufferCnt += curBlockSize;
|
|
|
|
|
|
|
|
//
|
|
|
|
if (outputBufferCnt < mBufferSize)
|
|
|
|
{
|
|
|
|
// Bump to next output buffer position
|
2014-11-14 03:03:17 +00:00
|
|
|
for (int i = 0; i < wxMin(mNumAudioOut, mNumChannels); i++)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
|
|
|
mOutBufPos[i] += curBlockSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Output buffers have filled
|
|
|
|
else
|
|
|
|
{
|
2014-11-14 03:03:17 +00:00
|
|
|
if (isProcessor)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-07 09:54:04 +00:00
|
|
|
// Write them out
|
|
|
|
left->Set((samplePtr) mOutBuffer[0], floatSample, outLeftPos, outputBufferCnt);
|
|
|
|
if (right)
|
|
|
|
{
|
|
|
|
right->Set((samplePtr) mOutBuffer[1], floatSample, outRightPos, outputBufferCnt);
|
|
|
|
}
|
|
|
|
}
|
2014-11-14 03:03:17 +00:00
|
|
|
else if (isGenerator)
|
2014-11-07 09:54:04 +00:00
|
|
|
{
|
|
|
|
genLeft->Append((samplePtr) mOutBuffer[0], floatSample, outputBufferCnt);
|
|
|
|
if (genRight)
|
|
|
|
{
|
|
|
|
genRight->Append((samplePtr) mOutBuffer[1], floatSample, outputBufferCnt);
|
|
|
|
}
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Reset the output buffer positions
|
2014-11-14 03:03:17 +00:00
|
|
|
for (int i = 0; i < wxMin(mNumAudioOut, mNumChannels); i++)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
|
|
|
mOutBufPos[i] = mOutBuffer[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bump to the next track position
|
|
|
|
outLeftPos += outputBufferCnt;
|
|
|
|
outRightPos += outputBufferCnt;
|
|
|
|
outputBufferCnt = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// "ls" and "rs" serve as the input sample index for the left and
|
|
|
|
// right channels when processing the input samples. If we flip
|
2014-10-29 03:46:53 +00:00
|
|
|
// over to processing delayed samples, they simply become counters
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
// for the progress display.
|
|
|
|
inLeftPos += curBlockSize;
|
|
|
|
inRightPos += curBlockSize;
|
|
|
|
|
|
|
|
if (mNumChannels > 1)
|
|
|
|
{
|
|
|
|
if (TrackGroupProgress(count, (inLeftPos - leftStart) / (double) len))
|
|
|
|
{
|
|
|
|
rc = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (TrackProgress(count, (inLeftPos - leftStart) / (double) len))
|
|
|
|
{
|
|
|
|
rc = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put any remaining output
|
|
|
|
if (outputBufferCnt)
|
|
|
|
{
|
2014-11-14 03:03:17 +00:00
|
|
|
if (isProcessor)
|
2014-11-07 09:54:04 +00:00
|
|
|
{
|
|
|
|
left->Set((samplePtr) mOutBuffer[0], floatSample, outLeftPos, outputBufferCnt);
|
|
|
|
if (right)
|
|
|
|
{
|
|
|
|
right->Set((samplePtr) mOutBuffer[1], floatSample, outRightPos, outputBufferCnt);
|
|
|
|
}
|
|
|
|
}
|
2014-11-14 03:03:17 +00:00
|
|
|
else if (isGenerator)
|
2014-11-07 09:54:04 +00:00
|
|
|
{
|
|
|
|
genLeft->Append((samplePtr) mOutBuffer[0], floatSample, outputBufferCnt);
|
|
|
|
if (genRight)
|
|
|
|
{
|
|
|
|
genRight->Append((samplePtr) mOutBuffer[1], floatSample, outputBufferCnt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isGenerator)
|
|
|
|
{
|
|
|
|
// Transfer the data from the temporary tracks to the actual ones
|
|
|
|
genLeft->Flush();
|
|
|
|
SetTimeWarper(new StepTimeWarper(mT0 + genLength, genLength - (mT1 - mT0)));
|
|
|
|
left->ClearAndPaste(mT0, mT1, genLeft, true, true, GetTimeWarper());
|
|
|
|
delete genLeft;
|
|
|
|
|
|
|
|
if (genRight)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-07 09:54:04 +00:00
|
|
|
genRight->Flush();
|
|
|
|
right->ClearAndPaste(mT0, mT1, genRight, true, true, GetTimeWarper());
|
|
|
|
delete genRight;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Allow the plugin to cleanup
|
|
|
|
mClient->ProcessFinalize();
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Effect::End()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
bool Effect::TotalProgress(double frac)
|
|
|
|
{
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
int updateResult = (mProgress ?
|
|
|
|
mProgress->Update(frac) :
|
|
|
|
eProgressSuccess);
|
2010-09-02 02:40:17 +00:00
|
|
|
return (updateResult != eProgressSuccess);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 22:28:58 +00:00
|
|
|
bool Effect::TrackProgress(int whichTrack, double frac, wxString msg)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
int updateResult = (mProgress ?
|
|
|
|
mProgress->Update(whichTrack + frac, (double) mNumTracks, msg) :
|
|
|
|
eProgressSuccess);
|
2010-09-02 02:40:17 +00:00
|
|
|
return (updateResult != eProgressSuccess);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::TrackGroupProgress(int whichGroup, double frac)
|
|
|
|
{
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
int updateResult = (mProgress ?
|
|
|
|
mProgress->Update(whichGroup + frac, (double) mNumGroups) :
|
|
|
|
eProgressSuccess);
|
2010-09-02 02:40:17 +00:00
|
|
|
return (updateResult != eProgressSuccess);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Effect::GetSamples(WaveTrack *track, sampleCount *start, sampleCount *len)
|
|
|
|
{
|
|
|
|
double trackStart = track->GetStartTime();
|
|
|
|
double trackEnd = track->GetEndTime();
|
|
|
|
double t0 = mT0 < trackStart ? trackStart : mT0;
|
|
|
|
double t1 = mT1 > trackEnd ? trackEnd : mT1;
|
|
|
|
|
2014-11-07 09:54:04 +00:00
|
|
|
#if 0
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
if (GetType() & INSERT_EFFECT) {
|
2014-11-07 09:54:04 +00:00
|
|
|
t1 = t0 + mDuration;
|
2010-01-23 19:44:49 +00:00
|
|
|
if (mT0 == mT1) {
|
|
|
|
// Not really part of the calculation, but convenient to put here
|
2011-11-18 03:47:43 +00:00
|
|
|
bool bResult = track->InsertSilence(t0, t1);
|
|
|
|
wxASSERT(bResult); // TO DO: Actually handle this.
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
}
|
2014-11-07 09:54:04 +00:00
|
|
|
#endif
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
if (t1 > t0) {
|
|
|
|
*start = track->TimeToLongSamples(t0);
|
|
|
|
sampleCount end = track->TimeToLongSamples(t1);
|
|
|
|
*len = (sampleCount)(end - *start);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*start = 0;
|
|
|
|
*len = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Effect::SetTimeWarper(TimeWarper *warper)
|
|
|
|
{
|
|
|
|
if (mWarper != NULL)
|
|
|
|
{
|
|
|
|
delete mWarper;
|
|
|
|
mWarper = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxASSERT(warper != NULL);
|
|
|
|
mWarper = warper;
|
|
|
|
}
|
|
|
|
|
|
|
|
TimeWarper *Effect::GetTimeWarper()
|
|
|
|
{
|
|
|
|
wxASSERT(mWarper != NULL);
|
|
|
|
return mWarper;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// private methods
|
|
|
|
//
|
2014-06-03 20:30:19 +00:00
|
|
|
// Use these two methods to copy the input tracks to mOutputTracks, if
|
2010-01-23 19:44:49 +00:00
|
|
|
// doing the processing on them, and replacing the originals only on success (and not cancel).
|
|
|
|
// Copy the group tracks that have tracks selected
|
|
|
|
void Effect::CopyInputTracks(int trackType)
|
|
|
|
{
|
|
|
|
// Reset map
|
|
|
|
mIMap.Clear();
|
|
|
|
mOMap.Clear();
|
|
|
|
|
|
|
|
mOutputTracks = new TrackList();
|
|
|
|
mOutputTracksType = trackType;
|
|
|
|
|
|
|
|
//iterate over tracks of type trackType (All types if Track::All)
|
|
|
|
TrackListOfKindIterator aIt(trackType, mTracks);
|
|
|
|
t2bHash added;
|
|
|
|
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
for (Track *aTrack = aIt.First(); aTrack; aTrack = aIt.Next())
|
|
|
|
{
|
2010-08-11 22:47:26 +00:00
|
|
|
// Include selected tracks, plus sync-lock selected tracks for Track::All.
|
2010-02-16 20:50:38 +00:00
|
|
|
if (aTrack->GetSelected() ||
|
2010-08-11 22:47:26 +00:00
|
|
|
(trackType == Track::All && aTrack->IsSyncLockSelected()))
|
2010-02-16 20:50:38 +00:00
|
|
|
{
|
2010-01-23 19:44:49 +00:00
|
|
|
Track *o = aTrack->Duplicate();
|
|
|
|
mOutputTracks->Add(o);
|
|
|
|
mIMap.Add(aTrack);
|
|
|
|
mOMap.Add(o);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Effect::AddToOutputTracks(Track *t)
|
|
|
|
{
|
|
|
|
mOutputTracks->Add(t);
|
|
|
|
mIMap.Add(NULL);
|
|
|
|
mOMap.Add(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
// If bGoodResult, replace mTracks tracks with successfully processed mOutputTracks copies.
|
|
|
|
// Else clear and delete mOutputTracks copies.
|
|
|
|
void Effect::ReplaceProcessedTracks(const bool bGoodResult)
|
|
|
|
{
|
|
|
|
wxASSERT(mOutputTracks != NULL); // Make sure we at least did the CopyInputTracks().
|
|
|
|
|
|
|
|
if (!bGoodResult) {
|
|
|
|
// Processing failed or was cancelled so throw away the processed tracks.
|
|
|
|
mOutputTracks->Clear(true); // true => delete the tracks
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
// Reset map
|
|
|
|
mIMap.Clear();
|
|
|
|
mOMap.Clear();
|
|
|
|
|
|
|
|
//TODO:undo the non-gui ODTask transfer
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
TrackListIterator iterOut(mOutputTracks);
|
|
|
|
|
|
|
|
Track *x;
|
|
|
|
size_t cnt = mOMap.GetCount();
|
|
|
|
size_t i = 0;
|
|
|
|
|
|
|
|
for (Track *o = iterOut.First(); o; o = x, i++) {
|
|
|
|
// If tracks were removed from mOutputTracks, then there will be
|
|
|
|
// tracks in the map that must be removed from mTracks.
|
|
|
|
while (i < cnt && mOMap[i] != o) {
|
|
|
|
Track *t = (Track *) mIMap[i];
|
|
|
|
if (t) {
|
|
|
|
mTracks->Remove(t, true);
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This should never happen
|
|
|
|
wxASSERT(i < cnt);
|
|
|
|
|
|
|
|
// Remove the track from the output list...don't delete it
|
|
|
|
x = iterOut.RemoveCurrent(false);
|
|
|
|
|
|
|
|
Track *t = (Track *) mIMap[i];
|
|
|
|
if (t == NULL)
|
|
|
|
{
|
|
|
|
// This track is a new addition to output tracks; add it to mTracks
|
|
|
|
mTracks->Add(o);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Replace mTracks entry with the new track
|
|
|
|
mTracks->Replace(t, o, false);
|
|
|
|
|
|
|
|
// Swap the wavecache track the ondemand task uses, since now the new
|
|
|
|
// one will be kept in the project
|
|
|
|
if (ODManager::IsInstanceCreated()) {
|
|
|
|
ODManager::Instance()->ReplaceWaveTrack((WaveTrack *)t,
|
|
|
|
(WaveTrack *)o);
|
|
|
|
}
|
|
|
|
|
|
|
|
// No longer need the original track
|
|
|
|
delete t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If tracks were removed from mOutputTracks, then there may be tracks
|
|
|
|
// left at the end of the map that must be removed from mTracks.
|
|
|
|
while (i < cnt) {
|
|
|
|
Track *t = (Track *) mIMap[i];
|
|
|
|
if (t) {
|
|
|
|
mTracks->Remove((Track *)mIMap[i], true);
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset map
|
|
|
|
mIMap.Clear();
|
|
|
|
mOMap.Clear();
|
|
|
|
|
|
|
|
// Make sure we processed everything
|
|
|
|
wxASSERT(iterOut.First() == NULL);
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
// The output list is no longer needed
|
|
|
|
delete mOutputTracks;
|
|
|
|
mOutputTracks = NULL;
|
|
|
|
mOutputTracksType = Track::None;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Effect::CountWaveTracks()
|
|
|
|
{
|
|
|
|
mNumTracks = 0;
|
|
|
|
mNumGroups = 0;
|
|
|
|
|
|
|
|
TrackListOfKindIterator iter(Track::Wave, mTracks);
|
|
|
|
Track *t = iter.First();
|
|
|
|
|
|
|
|
while(t) {
|
|
|
|
if (!t->GetSelected()) {
|
|
|
|
t = iter.Next();
|
|
|
|
continue;
|
|
|
|
}
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
if (t->GetKind() == Track::Wave) {
|
|
|
|
mNumTracks++;
|
|
|
|
if (!t->GetLinked())
|
|
|
|
mNumGroups++;
|
|
|
|
}
|
|
|
|
t = iter.Next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float TrapFloat(float x, float min, float max)
|
|
|
|
{
|
|
|
|
if (x <= min)
|
|
|
|
return min;
|
|
|
|
else if (x >= max)
|
|
|
|
return max;
|
|
|
|
else
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
double TrapDouble(double x, double min, double max)
|
|
|
|
{
|
|
|
|
if (x <= min)
|
|
|
|
return min;
|
|
|
|
else if (x >= max)
|
|
|
|
return max;
|
|
|
|
else
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
long TrapLong(long x, long min, long max)
|
|
|
|
{
|
|
|
|
if (x <= min)
|
|
|
|
return min;
|
|
|
|
else if (x >= max)
|
|
|
|
return max;
|
|
|
|
else
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2013-02-15 00:24:43 +00:00
|
|
|
double Effect::CalcPreviewInputLength(double previewLength)
|
|
|
|
{
|
|
|
|
return previewLength;
|
|
|
|
}
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
wxString Effect::GetPreviewName()
|
|
|
|
{
|
|
|
|
return _("Pre&view");
|
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
bool Effect::SupportsRealtime()
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
|
|
|
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
|
|
|
|
if (mClient)
|
|
|
|
{
|
2014-11-14 03:03:17 +00:00
|
|
|
return mClient->SupportsRealtime();
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-10-30 14:04:48 +00:00
|
|
|
bool Effect::RealtimeInitialize()
|
|
|
|
{
|
|
|
|
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
|
|
|
|
if (mClient)
|
|
|
|
{
|
2014-11-03 22:47:55 +00:00
|
|
|
mHighGroup = -1;
|
2014-10-30 14:04:48 +00:00
|
|
|
return mClient->RealtimeInitialize();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
|
|
|
|
bool Effect::RealtimeFinalize()
|
|
|
|
{
|
|
|
|
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->RealtimeFinalize();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::RealtimeSuspend()
|
|
|
|
{
|
|
|
|
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
|
|
|
|
if (mClient)
|
|
|
|
{
|
2014-12-13 18:24:11 +00:00
|
|
|
if (mClient->RealtimeSuspend())
|
|
|
|
{
|
|
|
|
mRealtimeSuspendLock.Enter();
|
|
|
|
mRealtimeSuspendCount++;
|
|
|
|
mRealtimeSuspendLock.Leave();
|
|
|
|
return true;
|
|
|
|
}
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Effect::RealtimeResume()
|
|
|
|
{
|
|
|
|
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
|
|
|
|
if (mClient)
|
|
|
|
{
|
2014-12-13 18:24:11 +00:00
|
|
|
if (mClient->RealtimeResume())
|
|
|
|
{
|
|
|
|
mRealtimeSuspendLock.Enter();
|
|
|
|
mRealtimeSuspendCount--;
|
|
|
|
mRealtimeSuspendLock.Leave();
|
|
|
|
return true;
|
|
|
|
}
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-11-03 06:48:54 +00:00
|
|
|
sampleCount Effect::RealtimeProcess(int group,
|
|
|
|
int chans,
|
|
|
|
float rate,
|
|
|
|
float **inbuf,
|
|
|
|
float **outbuf,
|
|
|
|
sampleCount numSamples)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
|
|
|
#if defined(EXPERIMENTAL_REALTIME_EFFECTS)
|
2014-11-03 06:48:54 +00:00
|
|
|
//
|
|
|
|
// The caller passes the number of channels to process and specifies
|
|
|
|
// the number of input and output buffers. There will always be the
|
|
|
|
// same number of output buffers as there are input buffers.
|
|
|
|
//
|
|
|
|
// Effects always require a certain number of input and output buffers,
|
|
|
|
// so if the number of channels we're curently processing are different
|
2014-12-13 18:24:11 +00:00
|
|
|
// than what the effect expects, then we use a few methods of satisfying
|
2014-11-03 06:48:54 +00:00
|
|
|
// the effects requirements.
|
|
|
|
float **clientIn = (float **) alloca(mNumAudioIn * sizeof(float *));
|
|
|
|
float **clientOut = (float **) alloca(mNumAudioOut * sizeof(float *));
|
|
|
|
float *dummybuf = (float *) alloca(numSamples * sizeof(float));
|
|
|
|
sampleCount len = 0;
|
|
|
|
int ichans = chans;
|
|
|
|
int ochans = chans;
|
|
|
|
int gchans = chans;
|
|
|
|
int indx = 0;
|
|
|
|
int ondx = 0;
|
|
|
|
|
2014-11-03 22:47:55 +00:00
|
|
|
if (group == 0)
|
|
|
|
{
|
|
|
|
mCurrentGroup = 0;
|
|
|
|
}
|
|
|
|
|
2014-11-03 06:48:54 +00:00
|
|
|
// Call the client until we run out of input or output channels
|
|
|
|
while (ichans > 0 && ochans > 0)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-03 06:48:54 +00:00
|
|
|
// If we don't have enough input channels to accomodate the client's
|
|
|
|
// requirements, then we replicate the input channels until the
|
|
|
|
// client's needs are met.
|
|
|
|
if (ichans < mNumAudioIn)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-03 06:48:54 +00:00
|
|
|
for (int i = 0; i < mNumAudioIn; i++)
|
|
|
|
{
|
|
|
|
if (indx == ichans)
|
|
|
|
{
|
|
|
|
indx = 0;
|
|
|
|
}
|
|
|
|
clientIn[i] = inbuf[indx++];
|
|
|
|
}
|
|
|
|
|
|
|
|
// All input channels have been consumed
|
|
|
|
ichans = 0;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
2014-11-03 06:48:54 +00:00
|
|
|
// Otherwise fullfil the client's needs with as many input channels as possible.
|
|
|
|
// After calling the client with this set, we will loop back up to process more
|
|
|
|
// of the input/output channels.
|
|
|
|
else if (ichans >= mNumAudioIn)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-03 06:48:54 +00:00
|
|
|
gchans = 0;
|
|
|
|
for (int i = 0; i < mNumAudioIn; i++, ichans--, gchans++)
|
|
|
|
{
|
|
|
|
clientIn[i] = inbuf[indx++];
|
|
|
|
}
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-03 06:48:54 +00:00
|
|
|
// If we don't have enough output channels to accomodate the client's
|
|
|
|
// requirements, then we provide all of the output channels and fulfill
|
|
|
|
// the client's needs with dummy buffers. These will just get tossed.
|
|
|
|
if (ochans < mNumAudioOut)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-03 06:48:54 +00:00
|
|
|
for (int i = 0; i < mNumAudioOut; i++)
|
|
|
|
{
|
|
|
|
if (i < ochans)
|
|
|
|
{
|
|
|
|
clientOut[i] = outbuf[i];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
clientOut[i] = dummybuf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// All output channels have been consumed
|
|
|
|
ochans = 0;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
2014-11-03 06:48:54 +00:00
|
|
|
// Otherwise fullfil the client's needs with as many output channels as possible.
|
|
|
|
// After calling the client with this set, we will loop back up to process more
|
|
|
|
// of the input/output channels.
|
|
|
|
else if (ochans >= mNumAudioOut)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-03 06:48:54 +00:00
|
|
|
for (int i = 0; i < mNumAudioOut; i++, ochans--)
|
|
|
|
{
|
|
|
|
clientOut[i] = outbuf[ondx++];
|
|
|
|
}
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
2014-11-03 06:48:54 +00:00
|
|
|
|
|
|
|
// If the current group hasn't yet been seen, then we must
|
|
|
|
// add a new processor to handle this channel (sub)group
|
2014-11-05 07:06:38 +00:00
|
|
|
if (mCurrentGroup > mHighGroup)
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
{
|
2014-11-03 06:48:54 +00:00
|
|
|
mClient->RealtimeAddProcessor(gchans, rate);
|
2014-11-05 07:06:38 +00:00
|
|
|
mHighGroup = mCurrentGroup;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
2014-11-03 06:48:54 +00:00
|
|
|
|
|
|
|
// Finally call the plugin to process the block
|
2014-11-25 08:08:15 +00:00
|
|
|
len = 0;
|
|
|
|
sampleCount maxBlock = mClient->GetBlockSize(numSamples);
|
|
|
|
for (sampleCount block = 0; block < numSamples; block += maxBlock)
|
|
|
|
{
|
|
|
|
sampleCount cnt = (block + maxBlock > numSamples ? numSamples - block : maxBlock);
|
|
|
|
len += mClient->RealtimeProcess(mCurrentGroup, clientIn, clientOut, cnt);
|
|
|
|
|
|
|
|
for (int i = 0 ; i < mNumAudioIn; i++)
|
|
|
|
{
|
|
|
|
clientIn[i] += cnt;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0 ; i < mNumAudioOut; i++)
|
|
|
|
{
|
|
|
|
clientOut[i] += cnt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mCurrentGroup++;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
}
|
|
|
|
|
2014-11-03 06:48:54 +00:00
|
|
|
return len;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-12-13 18:24:11 +00:00
|
|
|
bool Effect::IsRealtimeActive()
|
|
|
|
{
|
|
|
|
return mRealtimeSuspendCount == 0;
|
|
|
|
}
|
|
|
|
|
2013-05-02 23:41:27 +00:00
|
|
|
void Effect::Preview(bool dryOnly)
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
2013-05-19 05:56:42 +00:00
|
|
|
if (mNumTracks==0) // nothing to preview
|
|
|
|
return;
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
wxWindow* FocusDialog = wxWindow::FindFocus();
|
|
|
|
if (gAudioIO->IsBusy())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Mix a few seconds of audio from all of the tracks
|
2012-01-25 02:21:08 +00:00
|
|
|
double previewLen = 6.0;
|
2010-01-23 19:44:49 +00:00
|
|
|
gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &previewLen);
|
2013-02-15 00:24:43 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
WaveTrack *mixLeft = NULL;
|
|
|
|
WaveTrack *mixRight = NULL;
|
|
|
|
double rate = mProjectRate;
|
|
|
|
double t0 = mT0;
|
2013-02-15 00:24:43 +00:00
|
|
|
double t1 = t0 + CalcPreviewInputLength(previewLen);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
if (t1 > mT1)
|
|
|
|
t1 = mT1;
|
|
|
|
|
2014-10-26 20:30:22 +00:00
|
|
|
// Generators can run without a selection.
|
|
|
|
if (!GeneratorPreview() && (t1 <= t0))
|
2010-01-23 19:44:49 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
bool success = ::MixAndRender(mTracks, mFactory, rate, floatSample, t0, t1,
|
|
|
|
&mixLeft, &mixRight);
|
|
|
|
|
|
|
|
if (!success) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Save the original track list
|
|
|
|
TrackList *saveTracks = mTracks;
|
|
|
|
|
|
|
|
// Build new tracklist from rendering tracks
|
|
|
|
mTracks = new TrackList();
|
2014-06-03 20:30:19 +00:00
|
|
|
mixLeft->SetSelected(true);
|
2014-11-20 15:48:25 +00:00
|
|
|
mixLeft->SetDisplay(WaveTrack::NoDisplay);
|
2010-01-23 19:44:49 +00:00
|
|
|
mTracks->Add(mixLeft);
|
|
|
|
if (mixRight) {
|
2014-06-03 20:30:19 +00:00
|
|
|
mixRight->SetSelected(true);
|
2010-01-23 19:44:49 +00:00
|
|
|
mTracks->Add(mixRight);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update track/group counts
|
|
|
|
CountWaveTracks();
|
|
|
|
|
|
|
|
// Reset times
|
2012-03-03 21:14:31 +00:00
|
|
|
t0 = mixLeft->GetStartTime();
|
2010-01-23 19:44:49 +00:00
|
|
|
t1 = mixLeft->GetEndTime();
|
|
|
|
|
|
|
|
double t0save = mT0;
|
|
|
|
double t1save = mT1;
|
|
|
|
mT0 = t0;
|
|
|
|
mT1 = t1;
|
|
|
|
|
|
|
|
// Apply effect
|
|
|
|
|
2013-05-02 23:41:27 +00:00
|
|
|
bool bSuccess(true);
|
|
|
|
if (!dryOnly) {
|
|
|
|
// Effect is already inited; we call Process, End, and then Init
|
|
|
|
// again, so the state is exactly the way it was before Preview
|
|
|
|
// was called.
|
|
|
|
mProgress = new ProgressDialog(StripAmpersand(GetEffectName()),
|
2014-06-03 20:30:19 +00:00
|
|
|
_("Preparing preview"),
|
2013-05-02 23:41:27 +00:00
|
|
|
pdlgHideCancelButton); // Have only "Stop" button.
|
|
|
|
bSuccess = Process();
|
|
|
|
delete mProgress;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
mProgress = NULL;
|
2013-05-02 23:41:27 +00:00
|
|
|
End();
|
|
|
|
Init();
|
|
|
|
}
|
2014-10-06 21:53:58 +00:00
|
|
|
|
|
|
|
// Restore original selection
|
|
|
|
mT0 = t0save;
|
|
|
|
mT1 = t1save;
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
if (bSuccess)
|
|
|
|
{
|
|
|
|
WaveTrackArray playbackTracks;
|
|
|
|
WaveTrackArray recordingTracks;
|
|
|
|
// Probably not the same tracks post-processing, so can't rely on previous values of mixLeft & mixRight.
|
2014-06-03 20:30:19 +00:00
|
|
|
TrackListOfKindIterator iter(Track::Wave, mTracks);
|
2010-01-23 19:44:49 +00:00
|
|
|
mixLeft = (WaveTrack*)(iter.First());
|
|
|
|
mixRight = (WaveTrack*)(iter.Next());
|
|
|
|
playbackTracks.Add(mixLeft);
|
|
|
|
if (mixRight)
|
|
|
|
playbackTracks.Add(mixRight);
|
|
|
|
|
2013-02-15 00:24:43 +00:00
|
|
|
t1 = wxMin(mixLeft->GetEndTime(), t0 + previewLen);
|
|
|
|
|
2010-09-18 21:02:36 +00:00
|
|
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
|
|
|
NoteTrackArray empty;
|
|
|
|
#endif
|
2010-01-23 19:44:49 +00:00
|
|
|
// Start audio playing
|
|
|
|
int token =
|
2014-06-03 20:30:19 +00:00
|
|
|
gAudioIO->StartStream(playbackTracks, recordingTracks,
|
2010-01-23 19:44:49 +00:00
|
|
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
2010-09-18 21:02:36 +00:00
|
|
|
empty,
|
2010-01-23 19:44:49 +00:00
|
|
|
#endif
|
2010-09-18 21:02:36 +00:00
|
|
|
NULL, rate, t0, t1, NULL);
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
if (token) {
|
|
|
|
int previewing = eProgressSuccess;
|
|
|
|
|
|
|
|
mProgress = new ProgressDialog(StripAmpersand(GetEffectName()),
|
|
|
|
_("Previewing"), pdlgHideCancelButton);
|
|
|
|
|
|
|
|
while (gAudioIO->IsStreamActive(token) && previewing == eProgressSuccess) {
|
|
|
|
::wxMilliSleep(100);
|
2012-03-03 21:14:31 +00:00
|
|
|
previewing = mProgress->Update(gAudioIO->GetStreamTime() - t0, t1 - t0);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
gAudioIO->StopStream();
|
|
|
|
|
|
|
|
while (gAudioIO->IsBusy()) {
|
|
|
|
::wxMilliSleep(100);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete mProgress;
|
The fabled realtime effects...
I've made it where you can enable and disable via experimentals:
EXPERIMENTAL_REALTIME_EFFECTS
EXPERIMENTAL_EFFECTS_RACK
You will notice that, as of now, the only effects currently set up for
realtime are VSTs. Now that this is in, I will start converting the
rest.
As I start to convert the effects, the astute of you may notice that
they no longer directly access tracks or any "internal" Audacity
objects. This isolates the effects from changes in Audacity and makes
it much easier to add new ones.
Anyway, all 3 platforms can now display VST effects in graphical mode.
Yes, that means Linux too. There are quite a few VSTs for Linux if
you search for them.
The so-called "rack" definitely needs some discussion, work, and attention
from someone much better at graphics than me. I'm not really sure it should
stay in as-is. I'd originally planned for it to be simply a utility window
where you can store your (preconfigured) favorite effects. It should probably
revert back to that idea.
You may notice that this DOES include the API work I did. The realtime effects
were too tied to it and I didn't want to redo the whole thing. As I mentioned
elsewhere, the API stuff may or may not be very future proof.
So, let the critter complaints commence. I absolute KNOW there will be some.
(I know I'll be hearing from the Linux peeps pretty darn quickly. ;-))
2014-10-26 03:24:10 +00:00
|
|
|
mProgress = NULL;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
else {
|
2014-07-21 21:37:53 +00:00
|
|
|
wxMessageBox(_("Error while opening sound device. Please check the playback device settings and the project sample rate."),
|
2010-01-23 19:44:49 +00:00
|
|
|
_("Error"), wxOK | wxICON_EXCLAMATION, FocusDialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FocusDialog) {
|
|
|
|
FocusDialog->SetFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
delete mOutputTracks;
|
|
|
|
mOutputTracks = NULL;
|
|
|
|
|
|
|
|
mTracks->Clear(true); // true => delete the tracks
|
|
|
|
delete mTracks;
|
|
|
|
|
|
|
|
mTracks = saveTracks;
|
|
|
|
}
|
|
|
|
|
2014-11-03 06:48:54 +00:00
|
|
|
int Effect::GetAudioInCount()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetAudioInCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Effect::GetAudioOutCount()
|
|
|
|
{
|
|
|
|
if (mClient)
|
|
|
|
{
|
|
|
|
return mClient->GetAudioInCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-12-12 08:53:28 +00:00
|
|
|
BEGIN_EVENT_TABLE(EffectDialog, wxDialog)
|
|
|
|
EVT_BUTTON(wxID_OK, EffectDialog::OnOk)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
EffectDialog::EffectDialog(wxWindow * parent,
|
|
|
|
const wxString & title,
|
|
|
|
int type,
|
2013-05-02 23:41:27 +00:00
|
|
|
int flags,
|
|
|
|
int additionalButtons)
|
2010-01-23 19:44:49 +00:00
|
|
|
: wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, flags)
|
|
|
|
{
|
|
|
|
mType = type;
|
2013-05-02 23:41:27 +00:00
|
|
|
mAdditionalButtons = additionalButtons;
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EffectDialog::Init()
|
|
|
|
{
|
|
|
|
ShuttleGui S(this, eIsCreating);
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
S.SetBorder(5);
|
|
|
|
S.StartVerticalLay(true);
|
|
|
|
{
|
|
|
|
PopulateOrExchange(S);
|
|
|
|
|
|
|
|
long buttons = eOkButton;
|
|
|
|
|
|
|
|
if (mType == PROCESS_EFFECT || mType == INSERT_EFFECT)
|
|
|
|
{
|
|
|
|
buttons |= eCancelButton;
|
|
|
|
if (mType == PROCESS_EFFECT)
|
|
|
|
{
|
|
|
|
buttons |= ePreviewButton;
|
|
|
|
}
|
|
|
|
}
|
2013-05-02 23:41:27 +00:00
|
|
|
S.AddStandardButtons(buttons|mAdditionalButtons);
|
2010-01-23 19:44:49 +00:00
|
|
|
}
|
|
|
|
S.EndVerticalLay();
|
|
|
|
|
|
|
|
Layout();
|
|
|
|
Fit();
|
|
|
|
SetMinSize(GetSize());
|
|
|
|
Center();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// This is a virtual function which will be overridden to
|
|
|
|
/// provide the actual parameters that we want for each
|
|
|
|
/// kind of dialog.
|
2013-08-25 21:51:26 +00:00
|
|
|
void EffectDialog::PopulateOrExchange(ShuttleGui & WXUNUSED(S))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EffectDialog::TransferDataToWindow()
|
|
|
|
{
|
|
|
|
ShuttleGui S(this, eIsSettingToDialog);
|
|
|
|
PopulateOrExchange(S);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EffectDialog::TransferDataFromWindow()
|
|
|
|
{
|
|
|
|
ShuttleGui S(this, eIsGettingFromDialog);
|
|
|
|
PopulateOrExchange(S);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EffectDialog::Validate()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-08-25 21:51:26 +00:00
|
|
|
void EffectDialog::OnPreview(wxCommandEvent & WXUNUSED(event))
|
2010-01-23 19:44:49 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-12 08:53:28 +00:00
|
|
|
void EffectDialog::OnOk(wxCommandEvent & WXUNUSED(event))
|
|
|
|
{
|
|
|
|
// On wxGTK (wx2.8.12), the default action is still executed even if
|
|
|
|
// the button is disabled. This appears to affect all wxDialogs, not
|
|
|
|
// just our Effects dialogs. So, this is a only temporary workaround
|
|
|
|
// for legacy effects that disable the OK button. Hopefully this has
|
|
|
|
// been corrected in wx3.
|
|
|
|
if (FindWindowById(wxID_OK)->IsEnabled() && Validate() && TransferDataFromWindow())
|
|
|
|
{
|
|
|
|
EndModal(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-16 06:52:36 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// EffectPanel
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class EffectPanel : public wxScrolledWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EffectPanel(wxWindow *parent)
|
|
|
|
: wxScrolledWindow(parent,
|
|
|
|
wxID_ANY,
|
|
|
|
wxDefaultPosition,
|
|
|
|
wxDefaultSize,
|
|
|
|
wxVSCROLL | wxTAB_TRAVERSAL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~EffectPanel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// wxWindow implementation
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
virtual bool AcceptsFocus() const
|
|
|
|
{
|
|
|
|
// Only accept focus if we're not a GUI host.
|
|
|
|
//
|
|
|
|
// This assumes that any effect will have more than one control in its
|
|
|
|
// interface unless it is a GUI interface. It's a fairly safe assumption.
|
|
|
|
#if defined(__WXMAC__)
|
|
|
|
return GetChildren().GetCount() > 2;
|
|
|
|
#else
|
|
|
|
return GetChildren().GetCount() > 1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// EffectUIHost
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2014-12-12 14:44:50 +00:00
|
|
|
#include <wx/arrimpl.cpp>
|
|
|
|
WX_DEFINE_OBJARRAY(AccelArray);
|
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
#include "../../images/Effect.h"
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
enum
|
|
|
|
{
|
2014-11-29 13:14:35 +00:00
|
|
|
kDummyID = 30000,
|
2014-11-14 03:03:17 +00:00
|
|
|
kSaveAsID = 30001,
|
|
|
|
kImportID = 30002,
|
|
|
|
kExportID = 30003,
|
|
|
|
kDefaultsID = 30004,
|
|
|
|
kOptionsID = 30005,
|
2014-12-04 06:10:27 +00:00
|
|
|
kUserPresetsDummyID = 30006,
|
|
|
|
kDeletePresetDummyID = 30007,
|
2014-12-02 08:55:02 +00:00
|
|
|
kMenuID = 30100,
|
2014-12-13 18:24:11 +00:00
|
|
|
kPowerID = 30101,
|
2014-12-02 08:55:02 +00:00
|
|
|
kPlayID = 30102,
|
|
|
|
kRewindID = 30103,
|
|
|
|
kFFwdID = 30104,
|
|
|
|
kPlaybackID = 30105,
|
|
|
|
kCaptureID = 30106,
|
2014-11-14 03:03:17 +00:00
|
|
|
kUserPresetsID = 31000,
|
|
|
|
kDeletePresetID = 32000,
|
|
|
|
kFactoryPresetsID = 33000,
|
|
|
|
};
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(EffectUIHost, wxDialog)
|
|
|
|
EVT_CLOSE(EffectUIHost::OnClose)
|
2014-12-02 08:55:02 +00:00
|
|
|
EVT_BUTTON(wxID_APPLY, EffectUIHost::OnApply)
|
2014-11-14 03:03:17 +00:00
|
|
|
EVT_BUTTON(wxID_CANCEL, EffectUIHost::OnCancel)
|
2014-12-02 08:55:02 +00:00
|
|
|
EVT_BUTTON(kMenuID, EffectUIHost::OnMenu)
|
2014-12-13 18:24:11 +00:00
|
|
|
EVT_BUTTON(kPowerID, EffectUIHost::OnPower)
|
2014-12-02 08:55:02 +00:00
|
|
|
EVT_BUTTON(kPlayID, EffectUIHost::OnPlay)
|
|
|
|
EVT_BUTTON(kRewindID, EffectUIHost::OnRewind)
|
|
|
|
EVT_BUTTON(kFFwdID, EffectUIHost::OnFFwd)
|
2014-11-14 03:03:17 +00:00
|
|
|
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_RANGE(kUserPresetsID, kUserPresetsID + 999, EffectUIHost::OnUserPreset)
|
|
|
|
EVT_MENU_RANGE(kDeletePresetID, kDeletePresetID + 999, EffectUIHost::OnDeletePreset)
|
|
|
|
EVT_MENU_RANGE(kFactoryPresetsID, kFactoryPresetsID + 999, EffectUIHost::OnFactoryPreset)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
EffectUIHost::EffectUIHost(wxWindow *parent,
|
2014-11-27 12:22:41 +00:00
|
|
|
Effect *effect,
|
2014-11-14 03:03:17 +00:00
|
|
|
EffectUIClientInterface *client)
|
2014-11-27 12:22:41 +00:00
|
|
|
: wxDialog(parent, wxID_ANY, effect->GetName(),
|
2014-11-25 08:08:15 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
|
2014-11-14 03:03:17 +00:00
|
|
|
{
|
2014-11-27 12:22:41 +00:00
|
|
|
SetName(effect->GetName());
|
2014-11-14 03:03:17 +00:00
|
|
|
SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
|
|
|
|
|
|
|
|
mParent = parent;
|
2014-11-27 12:22:41 +00:00
|
|
|
mEffect = effect;
|
2014-11-14 03:03:17 +00:00
|
|
|
mClient = client;
|
2014-11-27 12:22:41 +00:00
|
|
|
|
|
|
|
mInitialized = false;
|
|
|
|
|
2014-12-13 18:24:11 +00:00
|
|
|
mPowerOn = true;
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
mClient->SetUIHost(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
EffectUIHost::~EffectUIHost()
|
|
|
|
{
|
2014-11-27 12:22:41 +00:00
|
|
|
if (mInitialized)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
if (mClient)
|
|
|
|
{
|
2014-11-19 06:58:44 +00:00
|
|
|
mClient->CloseUI();
|
|
|
|
mClient = NULL;
|
2014-11-14 03:03:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-16 06:52:36 +00:00
|
|
|
// ============================================================================
|
|
|
|
// EffectUIHost implementation
|
|
|
|
// ============================================================================
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
bool EffectUIHost::Initialize()
|
|
|
|
{
|
|
|
|
wxBoxSizer *vs = new wxBoxSizer(wxVERTICAL);
|
2014-11-25 08:08:15 +00:00
|
|
|
wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL);
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-11-16 06:52:36 +00:00
|
|
|
EffectPanel *w = new EffectPanel(this);
|
2014-11-14 03:03:17 +00:00
|
|
|
|
|
|
|
// Try to give the window a sensible default/minimum size
|
|
|
|
w->SetMinSize(wxSize(wxMax(600, mParent->GetSize().GetWidth() * 2/3),
|
|
|
|
mParent->GetSize().GetHeight() / 2));
|
|
|
|
|
|
|
|
w->SetScrollRate(0, 20);
|
|
|
|
|
2014-12-02 08:55:02 +00:00
|
|
|
mPlaying = gAudioIO->IsStreamActive(); // not exactly right, but will suffice
|
|
|
|
mCapturing = gAudioIO->IsStreamActive() && gAudioIO->GetNumCaptureChannels() > 0;
|
|
|
|
|
|
|
|
wxPanel *bar = new wxPanel(this, wxID_ANY);
|
|
|
|
wxBoxSizer *bs = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
bar->SetSizer(bs);
|
|
|
|
|
|
|
|
mMenuBtn = new wxBitmapButton(bar, kMenuID, CreateBitmap(effect_menu_xpm, true, false));
|
2014-12-12 14:44:50 +00:00
|
|
|
SetLabelAndTip(mMenuBtn, _("&Manage effect"));
|
2014-12-02 08:55:02 +00:00
|
|
|
bs->Add(mMenuBtn);
|
|
|
|
|
|
|
|
mOnBM = CreateBitmap(effect_on_xpm, true, false);
|
|
|
|
mOffBM = CreateBitmap(effect_off_xpm, true, false);
|
2014-12-04 06:10:27 +00:00
|
|
|
mOffDisabledBM = CreateBitmap(effect_off_disabled_xpm, true, false);
|
2014-12-13 18:24:11 +00:00
|
|
|
mPowerBtn = new wxBitmapButton(bar, kPowerID, mOnBM);
|
|
|
|
mPowerBtn->SetBitmapDisabled(mOffDisabledBM);
|
2014-12-14 16:28:19 +00:00
|
|
|
SetLabelAndTip(mPowerBtn, _("P&ower On"));
|
2014-12-13 18:24:11 +00:00
|
|
|
bs->Add(mPowerBtn);
|
2014-12-02 08:55:02 +00:00
|
|
|
|
|
|
|
bs->Add(5, 5);
|
|
|
|
|
|
|
|
mPlayBM = CreateBitmap(effect_play_xpm, true, false);
|
|
|
|
mPlayDisabledBM = CreateBitmap(effect_play_disabled_xpm, true, false);
|
|
|
|
mStopBM = CreateBitmap(effect_stop_xpm, true, false);
|
|
|
|
mStopDisabledBM = CreateBitmap(effect_stop_disabled_xpm, true, false);
|
|
|
|
mPlayBtn = new wxBitmapButton(bar, kPlayID, mPlayBM);
|
|
|
|
mPlayBtn->SetBitmapDisabled(mPlayDisabledBM);
|
2014-12-12 14:44:50 +00:00
|
|
|
SetLabelAndTip(mPlayBtn, _("&Play/Stop"));
|
2014-12-02 08:55:02 +00:00
|
|
|
bs->Add(mPlayBtn);
|
|
|
|
|
|
|
|
mRewindBtn = new wxBitmapButton(bar, kRewindID, CreateBitmap(effect_rewind_xpm, true, true));
|
|
|
|
mRewindBtn->SetBitmapDisabled(CreateBitmap(effect_rewind_disabled_xpm, true, true));
|
2014-12-12 14:44:50 +00:00
|
|
|
SetLabelAndTip(mRewindBtn, _("Skip &backward"));
|
2014-12-02 08:55:02 +00:00
|
|
|
bs->Add(mRewindBtn);
|
|
|
|
|
|
|
|
mFFwdBtn = new wxBitmapButton(bar, kFFwdID, CreateBitmap(effect_ffwd_xpm, true, true));
|
|
|
|
mFFwdBtn->SetBitmapDisabled(CreateBitmap(effect_ffwd_disabled_xpm, true, true));
|
2014-12-12 14:44:50 +00:00
|
|
|
SetLabelAndTip(mFFwdBtn, _("Skip &forward"));
|
2014-12-02 08:55:02 +00:00
|
|
|
bs->Add(mFFwdBtn);
|
|
|
|
|
2014-12-12 14:44:50 +00:00
|
|
|
// All done...generate and set the accelerator table
|
|
|
|
SetLabelAndTip(NULL);
|
2014-12-02 08:55:02 +00:00
|
|
|
|
|
|
|
bar->SetSizerAndFit(bs);
|
|
|
|
|
|
|
|
wxSizer *s = CreateStdButtonSizer(this, eApplyButton | eCloseButton, bar);
|
|
|
|
|
|
|
|
mApplyBtn = (wxButton *) FindWindowById(wxID_APPLY);
|
|
|
|
mCloseBtn = (wxButton *) FindWindowById(wxID_CANCEL);
|
|
|
|
|
|
|
|
UpdateControls();
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-11-25 08:08:15 +00:00
|
|
|
hs->Add(w, 1, wxEXPAND);
|
|
|
|
vs->Add(hs, 1, wxEXPAND);
|
2014-11-14 03:03:17 +00:00
|
|
|
vs->Add(s, 0, wxEXPAND | wxALIGN_CENTER_VERTICAL);
|
|
|
|
SetSizer(vs);
|
|
|
|
|
|
|
|
if (!mClient->PopulateUI(w))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Layout();
|
|
|
|
Fit();
|
|
|
|
Center();
|
|
|
|
|
2014-11-16 06:52:36 +00:00
|
|
|
#if defined(__WXMAC__)
|
2014-12-02 08:55:02 +00:00
|
|
|
(w->GetChildren().GetCount() > 2 ? w : FindWindowById(wxID_APPLY))->SetFocus();
|
2014-11-16 06:52:36 +00:00
|
|
|
#else
|
2014-12-02 08:55:02 +00:00
|
|
|
(w->GetChildren().GetCount() > 1 ? w : FindWindowById(wxID_APPLY))->SetFocus();
|
2014-11-16 06:52:36 +00:00
|
|
|
#endif
|
2014-11-25 08:08:15 +00:00
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
LoadUserPresets();
|
|
|
|
|
2014-11-27 12:22:41 +00:00
|
|
|
mClient->LoadUserPreset(mEffect->GetCurrentSettingsGroup());
|
|
|
|
|
|
|
|
// Initialize the effect realtime processing
|
|
|
|
if (!mEffect->RealtimeInitialize())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
EffectManager::Get().RealtimeAddEffect(mEffect);
|
|
|
|
|
2014-12-02 08:55:02 +00:00
|
|
|
wxTheApp->Connect(EVT_AUDIOIO_PLAYBACK,
|
|
|
|
wxCommandEventHandler(EffectUIHost::OnPlayback),
|
|
|
|
NULL,
|
|
|
|
this);
|
|
|
|
|
|
|
|
wxTheApp->Connect(EVT_AUDIOIO_CAPTURE,
|
|
|
|
wxCommandEventHandler(EffectUIHost::OnCapture),
|
|
|
|
NULL,
|
|
|
|
this);
|
|
|
|
|
2014-11-27 12:22:41 +00:00
|
|
|
mInitialized = true;
|
2014-11-14 03:03:17 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::OnClose(wxCloseEvent & WXUNUSED(evt))
|
|
|
|
{
|
2014-11-27 12:22:41 +00:00
|
|
|
if (mInitialized)
|
|
|
|
{
|
2014-12-02 08:55:02 +00:00
|
|
|
mInitialized = false;
|
|
|
|
|
|
|
|
wxTheApp->Disconnect(EVT_AUDIOIO_PLAYBACK,
|
|
|
|
wxCommandEventHandler(EffectUIHost::OnPlayback),
|
|
|
|
NULL,
|
|
|
|
this);
|
|
|
|
|
|
|
|
wxTheApp->Disconnect(EVT_AUDIOIO_CAPTURE,
|
|
|
|
wxCommandEventHandler(EffectUIHost::OnCapture),
|
|
|
|
NULL,
|
|
|
|
this);
|
|
|
|
|
2014-11-27 12:22:41 +00:00
|
|
|
EffectManager::Get().RealtimeRemoveEffect(mEffect);
|
|
|
|
mEffect->RealtimeFinalize();
|
|
|
|
}
|
|
|
|
|
2014-11-16 06:52:36 +00:00
|
|
|
Hide();
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
mClient->CloseUI();
|
|
|
|
mClient = NULL;
|
|
|
|
|
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
|
2014-12-02 08:55:02 +00:00
|
|
|
void EffectUIHost::OnApply(wxCommandEvent & WXUNUSED(evt))
|
2014-11-14 03:03:17 +00:00
|
|
|
{
|
|
|
|
if (!mClient->ValidateUI())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-27 12:22:41 +00:00
|
|
|
mClient->SaveUserPreset(mEffect->GetCurrentSettingsGroup());
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
if (IsModal())
|
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
SetReturnCode(true);
|
|
|
|
|
|
|
|
Close();
|
|
|
|
|
|
|
|
#if !defined(__WXGTK__)
|
|
|
|
EndModal(true);
|
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-27 12:22:41 +00:00
|
|
|
mEffect->Apply();
|
2014-11-14 03:03:17 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::OnCancel(wxCommandEvent & WXUNUSED(evt))
|
|
|
|
{
|
2014-11-27 12:22:41 +00:00
|
|
|
if (mInitialized)
|
|
|
|
{
|
2014-12-02 08:55:02 +00:00
|
|
|
mInitialized = false;
|
|
|
|
|
|
|
|
wxTheApp->Disconnect(EVT_AUDIOIO_PLAYBACK,
|
|
|
|
wxCommandEventHandler(EffectUIHost::OnPlayback),
|
|
|
|
NULL,
|
|
|
|
this);
|
|
|
|
|
|
|
|
wxTheApp->Disconnect(EVT_AUDIOIO_CAPTURE,
|
|
|
|
wxCommandEventHandler(EffectUIHost::OnCapture),
|
|
|
|
NULL,
|
|
|
|
this);
|
|
|
|
|
2014-11-27 12:22:41 +00:00
|
|
|
EffectManager::Get().RealtimeRemoveEffect(mEffect);
|
|
|
|
mEffect->RealtimeFinalize();
|
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
if (IsModal())
|
|
|
|
{
|
2014-11-19 06:58:44 +00:00
|
|
|
SetReturnCode(false);
|
|
|
|
|
|
|
|
Close();
|
|
|
|
|
|
|
|
#if !defined(__WXGTK__)
|
2014-11-14 03:03:17 +00:00
|
|
|
EndModal(false);
|
2014-11-19 06:58:44 +00:00
|
|
|
#endif
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-11-16 06:52:36 +00:00
|
|
|
Hide();
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
Close();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-12-02 08:55:02 +00:00
|
|
|
void EffectUIHost::OnMenu(wxCommandEvent & evt)
|
|
|
|
{
|
|
|
|
wxMenu *menu = new wxMenu();
|
|
|
|
wxMenu *sub;
|
|
|
|
|
|
|
|
LoadUserPresets();
|
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
if (mUserPresets.GetCount() == 0)
|
|
|
|
{
|
|
|
|
menu->Append(kUserPresetsDummyID, _("User Presets"))->Enable(false);
|
|
|
|
}
|
|
|
|
else
|
2014-12-02 08:55:02 +00:00
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
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);
|
2014-12-02 08:55:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
if (mUserPresets.GetCount() == 0)
|
2014-12-02 08:55:02 +00:00
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
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);
|
2014-12-02 08:55:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
menu->AppendSeparator();
|
|
|
|
menu->Append(kSaveAsID, _("Save As..."));
|
|
|
|
menu->AppendSeparator();
|
2014-12-04 06:10:27 +00:00
|
|
|
menu->Append(kImportID, _("Import..."))->Enable(mClient->CanExport());
|
|
|
|
menu->Append(kExportID, _("Export..."))->Enable(mClient->CanExport());
|
2014-12-02 08:55:02 +00:00
|
|
|
menu->AppendSeparator();
|
2014-12-04 06:10:27 +00:00
|
|
|
menu->Append(kOptionsID, _("Options..."))->Enable(mClient->HasOptions());
|
2014-12-02 08:55:02 +00:00
|
|
|
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);
|
|
|
|
|
2014-12-09 02:58:09 +00:00
|
|
|
wxRect r = FindWindowById(kMenuID)->GetParent()->GetRect();
|
2014-12-02 08:55:02 +00:00
|
|
|
PopupMenu(menu, wxPoint(r.GetLeft(), r.GetBottom()));
|
|
|
|
|
|
|
|
delete menu;
|
|
|
|
}
|
|
|
|
|
2014-12-13 18:24:11 +00:00
|
|
|
void EffectUIHost::OnPower(wxCommandEvent & WXUNUSED(evt))
|
2014-12-02 08:55:02 +00:00
|
|
|
{
|
2014-12-13 18:24:11 +00:00
|
|
|
mPowerOn = !mPowerOn;
|
2014-12-02 08:55:02 +00:00
|
|
|
|
2014-12-13 18:24:11 +00:00
|
|
|
if (mPowerOn)
|
2014-12-02 08:55:02 +00:00
|
|
|
{
|
2014-12-13 18:24:11 +00:00
|
|
|
mEffect->RealtimeResume();
|
2014-12-02 08:55:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-13 18:24:11 +00:00
|
|
|
mEffect->RealtimeSuspend();
|
2014-12-02 08:55:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UpdateControls();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::OnPlay(wxCommandEvent & WXUNUSED(evt))
|
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
AudacityProject *p = GetActiveProject();
|
|
|
|
|
|
|
|
if (mPlaying)
|
2014-12-02 08:55:02 +00:00
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
mPlayPos = gAudioIO->GetStreamTime();
|
|
|
|
p->GetControlToolBar()->StopPlaying();
|
2014-12-02 08:55:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
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());
|
2014-12-02 08:55:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::OnRewind(wxCommandEvent & WXUNUSED(evt))
|
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
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();
|
|
|
|
}
|
2014-12-02 08:55:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::OnFFwd(wxCommandEvent & WXUNUSED(evt))
|
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
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();
|
|
|
|
}
|
2014-12-02 08:55:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::OnPlayback(wxCommandEvent & evt)
|
|
|
|
{
|
|
|
|
mPlaying = evt.GetInt() != 0;
|
2014-12-04 06:10:27 +00:00
|
|
|
|
|
|
|
if (mPlaying)
|
|
|
|
{
|
|
|
|
mRegion = GetActiveProject()->mViewInfo.selectedRegion;
|
|
|
|
mPlayPos = mRegion.t0();
|
|
|
|
}
|
|
|
|
|
2014-12-02 08:55:02 +00:00
|
|
|
UpdateControls();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::OnCapture(wxCommandEvent & evt)
|
|
|
|
{
|
|
|
|
mCapturing = evt.GetInt() != 0;
|
|
|
|
mCloseBtn->SetFocus();
|
|
|
|
UpdateControls();
|
|
|
|
}
|
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
void EffectUIHost::OnUserPreset(wxCommandEvent & evt)
|
2014-12-02 08:55:02 +00:00
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
int preset = evt.GetId() - kUserPresetsID;
|
2014-12-02 08:55:02 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
mClient->LoadUserPreset(mEffect->GetUserPresetsGroup(mUserPresets[preset]));
|
2014-12-02 08:55:02 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
return;
|
2014-12-02 08:55:02 +00:00
|
|
|
}
|
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
void EffectUIHost::OnFactoryPreset(wxCommandEvent & evt)
|
2014-11-14 03:03:17 +00:00
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
mClient->LoadFactoryPreset(evt.GetId() - kFactoryPresetsID);
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
void EffectUIHost::OnDeletePreset(wxCommandEvent & evt)
|
|
|
|
{
|
|
|
|
wxString preset = mUserPresets[evt.GetId() - kDeletePresetID];
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
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)
|
2014-11-14 03:03:17 +00:00
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
mEffect->RemovePrivateConfigSubgroup(mEffect->GetUserPresetsGroup(preset));
|
2014-11-14 03:03:17 +00:00
|
|
|
}
|
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
LoadUserPresets();
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
return;
|
2014-11-14 03:03:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::OnSaveAs(wxCommandEvent & WXUNUSED(evt))
|
|
|
|
{
|
|
|
|
wxTextCtrl *text;
|
|
|
|
wxString name;
|
|
|
|
wxDialog dlg(this, wxID_ANY, wxString(_("Save Preset")));
|
2014-11-29 01:22:41 +00:00
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
ShuttleGui S(&dlg, eIsCreating);
|
|
|
|
|
|
|
|
S.StartPanel();
|
|
|
|
{
|
|
|
|
S.StartVerticalLay(0);
|
|
|
|
{
|
|
|
|
S.StartHorizontalLay(wxALIGN_LEFT, 0);
|
|
|
|
{
|
|
|
|
text = S.AddTextBox(_("Preset name:"), name, 30);
|
|
|
|
}
|
|
|
|
S.EndHorizontalLay();
|
|
|
|
S.AddStandardButtons();
|
|
|
|
}
|
|
|
|
S.EndVerticalLay();
|
|
|
|
}
|
|
|
|
S.EndPanel();
|
|
|
|
dlg.SetSize(dlg.GetSizer()->GetMinSize());
|
|
|
|
dlg.Center();
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
int rc = dlg.ShowModal();
|
|
|
|
|
|
|
|
if (rc != wxID_OK)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
name = text->GetValue();
|
|
|
|
if (mUserPresets.Index(name) == wxNOT_FOUND)
|
|
|
|
{
|
2014-11-27 12:22:41 +00:00
|
|
|
mClient->SaveUserPreset(mEffect->GetUserPresetsGroup(name));
|
2014-11-14 03:03:17 +00:00
|
|
|
LoadUserPresets();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxMessageBox(_("Preset already exists"),
|
|
|
|
_("Save Preset"),
|
|
|
|
wxICON_EXCLAMATION);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::OnImport(wxCommandEvent & WXUNUSED(evt))
|
|
|
|
{
|
|
|
|
mClient->ImportPresets();
|
|
|
|
|
|
|
|
LoadUserPresets();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::OnExport(wxCommandEvent & WXUNUSED(evt))
|
|
|
|
{
|
|
|
|
mClient->ExportPresets();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
void EffectUIHost::OnOptions(wxCommandEvent & WXUNUSED(evt))
|
2014-11-14 03:03:17 +00:00
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
mClient->ShowOptions();
|
2014-11-14 03:03:17 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
void EffectUIHost::OnDefaults(wxCommandEvent & WXUNUSED(evt))
|
2014-11-14 03:03:17 +00:00
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
mClient->LoadFactoryDefaults();
|
2014-11-14 03:03:17 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
wxBitmap EffectUIHost::CreateBitmap(const char *xpm[], bool up, bool pusher)
|
2014-11-14 03:03:17 +00:00
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
wxMemoryDC dc;
|
|
|
|
wxBitmap pic(xpm);
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
wxBitmap mod(pic.GetWidth() + 6, pic.GetHeight() + 6);
|
|
|
|
dc.SelectObject(mod);
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
#if !defined(__WXMAC__)
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
#if defined(__WXGTK__)
|
|
|
|
wxColour newColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND);
|
|
|
|
#elif defined(__WXMSW__)
|
|
|
|
wxColour newColour = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
|
|
|
|
#endif
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
dc.SetBackground(wxBrush(newColour));
|
|
|
|
dc.Clear();
|
|
|
|
#endif
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
int offset = 3;
|
|
|
|
if (pusher)
|
|
|
|
{
|
|
|
|
if (!up)
|
|
|
|
{
|
|
|
|
offset += 1;
|
|
|
|
}
|
|
|
|
}
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
dc.DrawBitmap(pic, offset, offset, true);
|
2014-11-14 03:03:17 +00:00
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
dc.SelectObject(wxNullBitmap);
|
|
|
|
|
|
|
|
return mod;
|
2014-11-14 03:03:17 +00:00
|
|
|
}
|
|
|
|
|
2014-12-12 14:44:50 +00:00
|
|
|
// We use an accelerator table in addition to the normal "&" mnemonic
|
|
|
|
// so that they work on Windows and GTK...no accelerators on OSX and
|
|
|
|
// the wxBitmapButton under GTK didn't seem to like the mnemonics.
|
|
|
|
//
|
|
|
|
// On Windows, this also keeps the focus from jumping to the associated
|
|
|
|
// button, forcing keyboard users to have to constantly TAB back to the
|
|
|
|
// control they were on. This problem appears to be related to the use
|
|
|
|
// of wxBitmapButton and how it is currently implemented in wx2.8.12.
|
|
|
|
//
|
|
|
|
// I'm hoping that when we transition to wx3 all of this can go away.
|
2014-12-14 16:28:19 +00:00
|
|
|
void EffectUIHost::SetLabelAndTip(wxBitmapButton *btn, const wxString & label, bool setAccel)
|
2014-12-12 14:44:50 +00:00
|
|
|
{
|
|
|
|
if (btn != NULL)
|
|
|
|
{
|
|
|
|
int pos = label.Find(wxT('&'));
|
|
|
|
if (pos != wxNOT_FOUND && pos < label.Length() - 1)
|
|
|
|
{
|
|
|
|
wxChar c = wxToupper(label[pos + 1]);
|
2014-12-14 16:28:19 +00:00
|
|
|
if (setAccel)
|
|
|
|
{
|
|
|
|
mAccels.Add(wxAcceleratorEntry(wxACCEL_ALT, c, btn->GetId()));
|
|
|
|
}
|
2014-12-12 14:44:50 +00:00
|
|
|
#if defined(__WXMAC__)
|
|
|
|
btn->SetName(label);
|
|
|
|
#else
|
|
|
|
btn->SetLabel(label);
|
|
|
|
#endif
|
|
|
|
btn->SetToolTip(wxStripMenuCodes(label) + wxT(" (ALT+") + c + wxT(")"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxAcceleratorEntry *entries = new wxAcceleratorEntry[mAccels.GetCount()];
|
|
|
|
for (size_t i = 0, cnt = mAccels.GetCount(); i < cnt; i++)
|
|
|
|
{
|
|
|
|
entries[i] = mAccels[i];
|
|
|
|
}
|
|
|
|
SetAcceleratorTable(wxAcceleratorTable(mAccels.GetCount(), entries));
|
|
|
|
delete [] entries;
|
|
|
|
mAccels.Empty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-04 06:10:27 +00:00
|
|
|
void EffectUIHost::UpdateControls()
|
2014-11-14 03:03:17 +00:00
|
|
|
{
|
2014-12-04 06:10:27 +00:00
|
|
|
mApplyBtn->Enable(!mCapturing);
|
2014-12-13 18:24:11 +00:00
|
|
|
mPowerBtn->Enable(!mCapturing);
|
2014-12-04 06:10:27 +00:00
|
|
|
mPlayBtn->Enable(!mCapturing);
|
|
|
|
mRewindBtn->Enable(!mCapturing);
|
|
|
|
mFFwdBtn->Enable(!mCapturing);
|
|
|
|
|
|
|
|
mPlayBtn->SetBitmapLabel(mPlaying ? mStopBM : mPlayBM);
|
2014-12-14 16:28:19 +00:00
|
|
|
mPlayBtn->SetBitmapDisabled(mPlaying ? mStopDisabledBM : mPlayDisabledBM);
|
|
|
|
|
|
|
|
if (mPowerOn)
|
|
|
|
{
|
|
|
|
mPowerBtn->SetBitmapLabel(mOnBM);
|
|
|
|
SetLabelAndTip(mPowerBtn, _("P&ower Off"), false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mPowerBtn->SetBitmapLabel(mOffBM);
|
|
|
|
SetLabelAndTip(mPowerBtn, _("P&ower On"), false);
|
|
|
|
}
|
|
|
|
|
2014-11-14 03:03:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EffectUIHost::LoadUserPresets()
|
|
|
|
{
|
|
|
|
mUserPresets.Clear();
|
|
|
|
|
2014-11-27 12:22:41 +00:00
|
|
|
mEffect->GetPrivateConfigSubgroups(mEffect->GetUserPresetsGroup(wxEmptyString), mUserPresets);
|
2014-11-14 03:03:17 +00:00
|
|
|
|
|
|
|
mUserPresets.Sort();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|