remove recently added, but bogus, property listener stuff from appleutility libs
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@9322 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
73b4506d2b
commit
04b3f11979
|
@ -114,7 +114,6 @@ public:
|
|||
// or the file's sample rate is 0 (unknown)
|
||||
|
||||
#if CAAF_USE_EXTAUDIOFILE
|
||||
#warning HERE WE ARE
|
||||
public:
|
||||
CAAudioFile() : mExtAF(NULL) { std::cerr << "Constructing CAAudioFile\n"; }
|
||||
virtual ~CAAudioFile() { std::cerr << "Destroying CAAudiofile @ " << this << std::endl; if (mExtAF) Close(); }
|
||||
|
|
|
@ -223,102 +223,24 @@ CAAudioUnit::CAAudioUnit (const AudioUnit& inUnit)
|
|||
}
|
||||
|
||||
CAAudioUnit::CAAudioUnit (const CAComponent& inComp)
|
||||
: mComp (inComp), mDataPtr (0), mPropertyCallback (0)
|
||||
: mComp (inComp), mDataPtr (0)
|
||||
{
|
||||
mDataPtr = new AUState (mComp.Comp());
|
||||
}
|
||||
|
||||
CAAudioUnit::CAAudioUnit (const AUNode &inNode, const AudioUnit& inUnit)
|
||||
: mComp (inUnit), mDataPtr(new AUState (inNode, inUnit)), mPropertyCallback (0)
|
||||
: mComp (inUnit), mDataPtr(new AUState (inNode, inUnit))
|
||||
{
|
||||
}
|
||||
|
||||
CAAudioUnit::~CAAudioUnit ()
|
||||
{
|
||||
dropPropertyListens ();
|
||||
|
||||
if (mDataPtr) {
|
||||
mDataPtr->release();
|
||||
mDataPtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CAAudioUnit::addPropertyListen (AudioUnitPropertyID id)
|
||||
{
|
||||
if (mPropertyCallback == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mWatching.find (id) != mWatching.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (AudioUnitAddPropertyListener (AU(), id, PropertyCallback, this) == noErr) {
|
||||
mWatching.insert (id);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CAAudioUnit::removePropertyListen (AudioUnitPropertyID id)
|
||||
{
|
||||
if (!mPropertyCallback) {
|
||||
return;
|
||||
}
|
||||
std::set<AudioUnitPropertyID>::iterator i = mWatching.find (id);
|
||||
if (i != mWatching.end()) {
|
||||
mWatching.erase (i);
|
||||
}
|
||||
/* this is for 10.6 and above ...
|
||||
AudioUnitRemovePropertyListenerWithUserData (AU(), id, PropertyCallback, this);
|
||||
*/
|
||||
AudioUnitRemovePropertyListener (AU(), id, PropertyCallback);
|
||||
}
|
||||
|
||||
void
|
||||
CAAudioUnit::dropPropertyListens ()
|
||||
{
|
||||
for (std::set<AudioUnitPropertyID>::iterator i = mWatching.begin(); i != mWatching.end(); ++i) {
|
||||
/* this is for 10.6 and above ...
|
||||
AudioUnitRemovePropertyListenerWithUserData (AU(), *i, PropertyCallback, this);
|
||||
*/
|
||||
AudioUnitRemovePropertyListener (AU(), *i, PropertyCallback);
|
||||
}
|
||||
mWatching.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
CAAudioUnit::SetPropertyCallback (void (*prop_callback)(void*, int32_t, float, void*), void* arg)
|
||||
{
|
||||
dropPropertyListens ();
|
||||
mPropertyCallback = prop_callback;
|
||||
mPropertyCallbackArg = arg;
|
||||
}
|
||||
|
||||
void
|
||||
CAAudioUnit::PropertyCallback (void *inRefCon,
|
||||
AudioUnit inUnit,
|
||||
AudioUnitPropertyID inID,
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement)
|
||||
{
|
||||
static_cast<CAAudioUnit*>(inRefCon)->
|
||||
DoPropertyCallback (inUnit, inID, inScope, inElement);
|
||||
}
|
||||
|
||||
void
|
||||
CAAudioUnit::DoPropertyCallback (AudioUnit inUnit,
|
||||
AudioUnitPropertyID inID,
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement)
|
||||
{
|
||||
if (mPropertyCallback) {
|
||||
float value;
|
||||
AudioUnitGetParameter (inUnit, inID, inScope, inElement, &value);
|
||||
mPropertyCallback (this, inID, value, mPropertyCallbackArg);
|
||||
}
|
||||
}
|
||||
|
||||
CAAudioUnit& CAAudioUnit::operator= (const CAAudioUnit &a)
|
||||
{
|
||||
if (mDataPtr != a.mDataPtr) {
|
||||
|
|
|
@ -330,31 +330,12 @@ public:
|
|||
void Print () const { Print (stdout); }
|
||||
void Print (FILE* file) const;
|
||||
|
||||
void SetPropertyCallback (void (*param_callback)(void*, int32_t, float, void*), void* arg);
|
||||
void addPropertyListen (AudioUnitPropertyID);
|
||||
void removePropertyListen (AudioUnitPropertyID);
|
||||
|
||||
private:
|
||||
CAComponent mComp;
|
||||
|
||||
class AUState;
|
||||
AUState* mDataPtr;
|
||||
|
||||
void (*mPropertyCallback)(void* Unit, int32_t which, float val, void*);
|
||||
void* mPropertyCallbackArg;
|
||||
std::set<AudioUnitPropertyID> mWatching;
|
||||
void dropPropertyListens ();
|
||||
static void PropertyCallback (
|
||||
void *inRefCon,
|
||||
AudioUnit inUnit,
|
||||
AudioUnitPropertyID inID,
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement);
|
||||
void DoPropertyCallback (AudioUnit inUnit,
|
||||
AudioUnitPropertyID inID,
|
||||
AudioUnitScope inScope,
|
||||
AudioUnitElement inElement);
|
||||
|
||||
// this can throw - so wrap this up in a static that returns a result code...
|
||||
CAAudioUnit (const CAComponent& inComp);
|
||||
|
||||
|
|
Loading…
Reference in New Issue