summaryrefslogtreecommitdiff
path: root/libs/appleutility
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-09-10 15:03:30 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-09-10 15:03:30 +0000
commit68e943265edf04e63a8e8b8f62bab20f99d9c637 (patch)
treeff8941a59662fc0c4622944b65f7b2d5e3bdd0c3 /libs/appleutility
parente4372df05b7d74a6b80dbbf4b6c00cc2b31c4723 (diff)
merge from 2.0-ongoing @ 3581
git-svn-id: svn://localhost/ardour2/branches/3.0@3711 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/appleutility')
-rw-r--r--libs/appleutility/CAAudioUnit.cpp40
-rw-r--r--libs/appleutility/CAAudioUnit.h1
-rw-r--r--libs/appleutility/SConscript2
3 files changed, 42 insertions, 1 deletions
diff --git a/libs/appleutility/CAAudioUnit.cpp b/libs/appleutility/CAAudioUnit.cpp
index 9244877d29..aaf57f233d 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& 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,
diff --git a/libs/appleutility/CAAudioUnit.h b/libs/appleutility/CAAudioUnit.h
index 6bc31bf30b..810b81be2f 100644
--- a/libs/appleutility/CAAudioUnit.h
+++ b/libs/appleutility/CAAudioUnit.h
@@ -218,6 +218,7 @@ public:
bool HasChannelLayouts (AudioUnitScope inScope,
AudioUnitElement inEl) const;
+ int GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt);
bool GetChannelLayouts (AudioUnitScope inScope,
AudioUnitElement inEl,
ChannelTagVector &outChannelVector) const;
diff --git a/libs/appleutility/SConscript b/libs/appleutility/SConscript
index bddca04032..c4f65ec81e 100644
--- a/libs/appleutility/SConscript
+++ b/libs/appleutility/SConscript
@@ -7,7 +7,7 @@ import glob
appleutility_files = glob.glob('*.cpp')
Import('env install_prefix')
-appleutility = env.Copy()
+appleutility = env.Clone()
appleutility.Append(LINKFLAGS='-framework AudioToolbox')
appleutility.Append(LINKFLAGS='-framework AudioUnit')