make copy-n-paste of AudioUnits work

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3181 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-03-25 15:01:38 +00:00
parent 97ade208b0
commit 39e6afb582
4 changed files with 47 additions and 26 deletions

View file

@ -60,6 +60,7 @@ class AUPlugin : public ARDOUR::Plugin
{
public:
AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> comp);
AUPlugin (const AUPlugin& other);
virtual ~AUPlugin ();
std::string unique_id () const;
@ -105,7 +106,7 @@ class AUPlugin : public ARDOUR::Plugin
uint32_t input_streams() const;
boost::shared_ptr<CAAudioUnit> get_au () { return unit; }
boost::shared_ptr<CAComponent> get_comp () { return comp; }
boost::shared_ptr<CAComponent> get_comp () const { return comp; }
OSStatus render_callback(AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
@ -139,6 +140,7 @@ class AUPlugin : public ARDOUR::Plugin
nframes_t frames_processed;
std::vector<AUParameterDescriptor> descriptors;
void init ();
};
typedef boost::shared_ptr<AUPlugin> AUPluginPtr;

View file

@ -55,17 +55,49 @@ _render_callback(void *userData,
}
AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> _comp)
:
Plugin (engine, session),
comp (_comp),
unit (new CAAudioUnit),
initialized (false),
buffers (0),
current_maxbuf (0),
current_offset (0),
current_buffers (0),
: Plugin (engine, session),
comp (_comp),
unit (new CAAudioUnit),
initialized (false),
buffers (0),
current_maxbuf (0),
current_offset (0),
current_buffers (0),
frames_processed (0)
{
init ();
}
AUPlugin::AUPlugin (const AUPlugin& other)
: Plugin (other)
, comp (other.get_comp())
, unit (new CAAudioUnit)
, initialized (false)
, buffers (0)
, current_maxbuf (0)
, current_offset (0)
, current_buffers (0)
, frames_processed (0)
{
init ();
}
AUPlugin::~AUPlugin ()
{
if (unit) {
unit->Uninitialize ();
}
if (buffers) {
free (buffers);
}
}
void
AUPlugin::init ()
{
OSErr err = CAAudioUnit::Open (*(comp.get()), *unit);
if (err != noErr) {
@ -90,7 +122,7 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAC
// set up the basic stream format. these fields do not change
streamFormat.mSampleRate = session.frame_rate();
streamFormat.mSampleRate = _session.frame_rate();
streamFormat.mFormatID = kAudioFormatLinearPCM;
streamFormat.mFormatFlags = kAudioFormatFlagIsFloat|kAudioFormatFlagIsPacked|kAudioFormatFlagIsNonInterleaved;
@ -121,17 +153,6 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAC
Plugin::setup_controls ();
}
AUPlugin::~AUPlugin ()
{
if (unit) {
unit->Uninitialize ();
}
if (buffers) {
free (buffers);
}
}
void
AUPlugin::discover_parameters ()
{

View file

@ -77,9 +77,7 @@ Plugin::setup_controls ()
we'll fill this in on an as-needed basis.
*/
for (uint32_t i = 0; i < port_cnt; ++i) {
controls.push_back (0);
}
controls.assign (port_cnt, (PortControllable*) 0);
}
Plugin::~Plugin ()

View file

@ -1,4 +1,4 @@
#ifndef __ardour_svn_revision_h__
#define __ardour_svn_revision_h__
static const char* ardour_svn_revision = "3142";
static const char* ardour_svn_revision = "3144";
#endif