diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-04-11 14:06:50 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-04-11 14:06:50 +0000 |
commit | cb413146428ce5db5e281d70f2b3b7df27c1aaab (patch) | |
tree | 4961e9dcb107f2ca1f0a4298faf5135ba8611d92 /libs/ardour/audio_unit.cc | |
parent | 9aa8af5a28abbb86c9ae86c6991838eb6828d0a9 (diff) |
merge 3.0 from 2.0-ongoing@3243
git-svn-id: svn://localhost/ardour2/branches/3.0@3248 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_unit.cc')
-rw-r--r-- | libs/ardour/audio_unit.cc | 65 |
1 files changed, 43 insertions, 22 deletions
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index e517964024..b941bc10bb 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 () { @@ -281,7 +302,7 @@ AUPlugin::signal_latency () const return _user_latency; } - return unit->Latency (); + return unit->Latency() * _session.frame_rate(); } void |