iPlug2 - C++ Audio Plug-in Framework
IPlugAU_ioconfig.h
1 /*
2  ==============================================================================
3 
4  This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5 
6  See LICENSE.txt for more info.
7 
8  ==============================================================================
9 */
10 
11 #ifndef CUSTOM_BUSTYPE_FUNC
12 
13 BEGIN_IPLUG_NAMESPACE
14 
15 static uint64_t GetAPIBusTypeForChannelIOConfig(int configIdx, ERoute dir, int busIdx, const IOConfig* pConfig, WDL_TypedBuf<uint64_t>* APIBusTypes)
16 {
17  assert(pConfig != nullptr);
18  assert(busIdx >= 0 && busIdx < pConfig->NBuses(dir));
19 
20  int numChans = pConfig->GetBusInfo(dir, busIdx)->NChans();
21 
22  switch (numChans)
23  {
24  case 0:
25  APIBusTypes->Add(kAudioChannelLayoutTag_UseChannelDescriptions | 0);
26  break;
27  case 1:
28  APIBusTypes->Add(kAudioChannelLayoutTag_Mono);
29  break;
30  case 2:
31 // APIBusTypes->Add(kAudioChannelLayoutTag_Binaural);
32  APIBusTypes->Add(kAudioChannelLayoutTag_Stereo);
33  break;
34  case 3:
35  APIBusTypes->Add(kAudioChannelLayoutTag_ITU_3_0 | 3);
36  break;
37  case 4:
38  // by default support any 4 channel layout
39  APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_4);
40  APIBusTypes->Add(kAudioChannelLayoutTag_Ambisonic_B_Format);
41  APIBusTypes->Add(kAudioChannelLayoutTag_HOA_ACN_SN3D | 4);
42  break;
43  case 5:
44  APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_5_0);
45  break;
46  case 6:
47  // by default support any 6 channel layout
48  APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_5_1);
49  APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_6_0);
50  break;
51  case 7:
52  // by default support any 7 channel layout
53  APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_6_1);
54  APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_7_0);
55  APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_7_1_Front);
56  break;
57  case 8:
58  // by default support any 8 channel layout
59  APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_7_1);
60  APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_7_1_Front);
61  break;
62  case 9:
63  case 16: // 2nd and 3rd order ambisonics
64  APIBusTypes->Add(kAudioChannelLayoutTag_HOA_ACN_SN3D | numChans);
65  break;
66  default:
67  APIBusTypes->Add(kAudioChannelLayoutTag_DiscreteInOrder | numChans);
68  break;
69  }
70  return 0; // AU can return multiple types
71 }
72 
73 END_IPLUG_NAMESPACE
74 
75 #else
76 extern uint64_t GetAPIBusTypeForChannelIOConfig(int configIdx, iplug::ERoute dir, int busIdx, const iplug::IOConfig* pConfig, WDL_TypedBuf<uint64_t>* APIBusTypes);
77 #endif //CUSTOM_BUSTYPE_FUNC
78 
An IOConfig is used to store bus info for each input/output configuration defined in the channel io s...
Definition: IPlugStructs.h:500
const IBusInfo * GetBusInfo(ERoute direction, int index) const
Definition: IPlugStructs.h:523
ERoute
Used to identify whether a bus/channel connection is an input or an output.