summaryrefslogtreecommitdiff
path: root/libs/appleutility
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-05-13 18:54:21 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-05-13 18:54:21 +0000
commit49f73b561b4117131e2d2da001d9dd133846ef62 (patch)
treefee231c7b72c7c2a8a2637140c118115961862d4 /libs/appleutility
parent65ddc52f4975179054902b3df8ea2b8b043d1513 (diff)
initial code for AU I/O config discovery (i hate you apple!)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3346 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/appleutility')
-rw-r--r--libs/appleutility/CAAudioUnit.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/libs/appleutility/CAAudioUnit.cpp b/libs/appleutility/CAAudioUnit.cpp
index 9244877d29..3d8a98476a 100644
--- a/libs/appleutility/CAAudioUnit.cpp
+++ b/libs/appleutility/CAAudioUnit.cpp
@@ -328,6 +328,46 @@ bool CAAudioUnit::CanDo ( int inChannelsIn,
return ValidateChannelPair (inChannelsIn, inChannelsOut, info.mChanInfo, (dataSize / sizeof (AUChannelInfo)));
}
+int CAAudioUnit::GetChannelInfo (AUChannelInfo** chaninfo, uint32_t& cnt)
+{
+ // this is the default assumption of an audio effect unit
+ Boolean* isWritable = 0;
+ UInt32 dataSize = 0;
+ // lets see if the unit has any channel restrictions
+ OSStatus result = AudioUnitGetPropertyInfo (AU(),
+ kAudioUnitProperty_SupportedNumChannels,
+ kAudioUnitScope_Global, 0,
+ &dataSize, isWritable); //don't care if this is writable
+
+ // if this property is NOT implemented an FX unit
+ // is expected to deal with same channel valance in and out
+
+ if (result)
+ {
+ if (Comp().Desc().IsEffect())
+ {
+ return 1;
+ }
+ else
+ {
+ // the au should either really tell us about this
+ // or we will assume the worst
+ return -1;
+ }
+ }
+
+ *chaninfo = (AUChannelInfo*) malloc (dataSize);
+ cnt = dataSize / sizeof (AUChannelInfo);
+
+ result = GetProperty (kAudioUnitProperty_SupportedNumChannels,
+ kAudioUnitScope_Global, 0,
+ *chaninfo, &dataSize);
+
+ if (result) { return -1; }
+ return 0;
+}
+
+
bool CAAudioUnit::ValidateChannelPair (int inChannelsIn,
int inChannelsOut,
const AUChannelInfo * info,