diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-03-25 15:01:38 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-03-25 15:01:38 +0000 |
commit | 39e6afb58230610e4b2df60668ff226ebd9374b1 (patch) | |
tree | fb2888941655535a2d9990c2dd08dd4bc62dfc4e | |
parent | 97ade208b0a9c0d639a7a4dffa219b8b606de4da (diff) |
make copy-n-paste of AudioUnits work
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3181 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/ardour/audio_unit.h | 4 | ||||
-rw-r--r-- | libs/ardour/audio_unit.cc | 63 | ||||
-rw-r--r-- | libs/ardour/plugin.cc | 4 | ||||
-rw-r--r-- | svn_revision.h | 2 |
4 files changed, 47 insertions, 26 deletions
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index c3b99bd1a9..e5f6053c5b 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -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; diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 93cab504f6..deb40136db 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -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 () { diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index d8616eabde..1160a0015b 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -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 () diff --git a/svn_revision.h b/svn_revision.h index b7d9af4dc7..a254f0c75c 100644 --- a/svn_revision.h +++ b/svn_revision.h @@ -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 |