diff options
author | Robin Gareus <robin@gareus.org> | 2015-02-22 23:37:18 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-02-22 23:37:18 +0100 |
commit | e070701f14e9b705f7477d6e6718ee759caa1c46 (patch) | |
tree | a70f2db0c71952ed101364557f2613fa140612ba /libs | |
parent | 10e183f518f1a26c081afa191f30968f40211b0f (diff) |
support AudioUnit Generators without global Channel Info
Diffstat (limited to 'libs')
-rw-r--r-- | libs/appleutility/CAAudioUnit.cpp | 36 | ||||
-rw-r--r-- | libs/ardour/audio_unit.cc | 6 |
2 files changed, 41 insertions, 1 deletions
diff --git a/libs/appleutility/CAAudioUnit.cpp b/libs/appleutility/CAAudioUnit.cpp index 131969b66c..c1ab13454e 100644 --- a/libs/appleutility/CAAudioUnit.cpp +++ b/libs/appleutility/CAAudioUnit.cpp @@ -348,6 +348,42 @@ int CAAudioUnit::GetChannelInfo (AUChannelInfo** chaninfo, UInt32& cnt) { return 1; } + else if (Comp().Desc().IsGenerator() || Comp().Desc().IsMusicDevice()) { + // directly query Bus Formats + // Note that that these may refer to different subBusses + // (eg. Kick, Snare,.. on a Drummachine) + // eventually the Bus-Name for each configuration should be exposed + // for the User to select.. + + UInt32 elCountIn, elCountOut, elCount; + + if (GetElementCount (kAudioUnitScope_Input, elCountIn)) return 1; + if (GetElementCount (kAudioUnitScope_Output, elCountOut)) return 1; + + elCount = std::max(elCountIn, elCountOut); + + *chaninfo = (AUChannelInfo*) malloc (sizeof (AUChannelInfo) * elCount); + + for (unsigned int i = 0; i < elCountIn; ++i) { + UInt32 numChans; + if (NumberChannels (kAudioUnitScope_Input, i, numChans)) return 1; + (*chaninfo)[i].inChannels = numChans; + } + for (unsigned int i = elCountIn; i < elCount; ++i) { + (*chaninfo)[i].inChannels = 0; + } + + + for (unsigned int i = 0; i < elCountOut; ++i) { + UInt32 numChans; + if (NumberChannels (kAudioUnitScope_Output, i, numChans)) return 1; + (*chaninfo)[i].outChannels = numChans; + } + for (unsigned int i = elCountOut; i < elCount; ++i) { + (*chaninfo)[i].outChannels = 0; + } + return 0; + } else { // the au should either really tell us about this diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 680960bbff..aeb91e6848 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -1037,7 +1037,11 @@ AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out) //configurations in most cases. so first lets see //if there's a configuration that keeps out==in - audio_out = audio_in; + if (in.n_midi() > 0 && audio_in == 0) { + audio_out = -1; + } else { + audio_out = audio_in; + } for (vector<pair<int,int> >::iterator i = io_configs.begin(); i != io_configs.end(); ++i) { |