mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 13:46:30 +01:00
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:
parent
97ade208b0
commit
39e6afb582
4 changed files with 47 additions and 26 deletions
|
|
@ -60,6 +60,7 @@ class AUPlugin : public ARDOUR::Plugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> comp);
|
AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> comp);
|
||||||
|
AUPlugin (const AUPlugin& other);
|
||||||
virtual ~AUPlugin ();
|
virtual ~AUPlugin ();
|
||||||
|
|
||||||
std::string unique_id () const;
|
std::string unique_id () const;
|
||||||
|
|
@ -105,7 +106,7 @@ class AUPlugin : public ARDOUR::Plugin
|
||||||
uint32_t input_streams() const;
|
uint32_t input_streams() const;
|
||||||
|
|
||||||
boost::shared_ptr<CAAudioUnit> get_au () { return unit; }
|
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,
|
OSStatus render_callback(AudioUnitRenderActionFlags *ioActionFlags,
|
||||||
const AudioTimeStamp *inTimeStamp,
|
const AudioTimeStamp *inTimeStamp,
|
||||||
|
|
@ -139,6 +140,7 @@ class AUPlugin : public ARDOUR::Plugin
|
||||||
nframes_t frames_processed;
|
nframes_t frames_processed;
|
||||||
|
|
||||||
std::vector<AUParameterDescriptor> descriptors;
|
std::vector<AUParameterDescriptor> descriptors;
|
||||||
|
void init ();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::shared_ptr<AUPlugin> AUPluginPtr;
|
typedef boost::shared_ptr<AUPlugin> AUPluginPtr;
|
||||||
|
|
|
||||||
|
|
@ -55,16 +55,48 @@ _render_callback(void *userData,
|
||||||
}
|
}
|
||||||
|
|
||||||
AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> _comp)
|
AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> _comp)
|
||||||
:
|
: Plugin (engine, session),
|
||||||
Plugin (engine, session),
|
comp (_comp),
|
||||||
comp (_comp),
|
unit (new CAAudioUnit),
|
||||||
unit (new CAAudioUnit),
|
initialized (false),
|
||||||
initialized (false),
|
buffers (0),
|
||||||
buffers (0),
|
current_maxbuf (0),
|
||||||
current_maxbuf (0),
|
current_offset (0),
|
||||||
current_offset (0),
|
current_buffers (0),
|
||||||
current_buffers (0),
|
|
||||||
frames_processed (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);
|
OSErr err = CAAudioUnit::Open (*(comp.get()), *unit);
|
||||||
|
|
||||||
|
|
@ -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
|
// 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.mFormatID = kAudioFormatLinearPCM;
|
||||||
streamFormat.mFormatFlags = kAudioFormatFlagIsFloat|kAudioFormatFlagIsPacked|kAudioFormatFlagIsNonInterleaved;
|
streamFormat.mFormatFlags = kAudioFormatFlagIsFloat|kAudioFormatFlagIsPacked|kAudioFormatFlagIsNonInterleaved;
|
||||||
|
|
||||||
|
|
@ -121,17 +153,6 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAC
|
||||||
Plugin::setup_controls ();
|
Plugin::setup_controls ();
|
||||||
}
|
}
|
||||||
|
|
||||||
AUPlugin::~AUPlugin ()
|
|
||||||
{
|
|
||||||
if (unit) {
|
|
||||||
unit->Uninitialize ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buffers) {
|
|
||||||
free (buffers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AUPlugin::discover_parameters ()
|
AUPlugin::discover_parameters ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,7 @@ Plugin::setup_controls ()
|
||||||
we'll fill this in on an as-needed basis.
|
we'll fill this in on an as-needed basis.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (uint32_t i = 0; i < port_cnt; ++i) {
|
controls.assign (port_cnt, (PortControllable*) 0);
|
||||||
controls.push_back (0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin::~Plugin ()
|
Plugin::~Plugin ()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __ardour_svn_revision_h__
|
#ifndef __ardour_svn_revision_h__
|
||||||
#define __ardour_svn_revision_h__
|
#define __ardour_svn_revision_h__
|
||||||
static const char* ardour_svn_revision = "3142";
|
static const char* ardour_svn_revision = "3144";
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue