I am trying and failing at getting the PlayFile.cpp example to work Nested Inside an audio Unit. I have a few problems that i would really appriciate some help on since the documentation for the fileplayerAU and the AUmixer seems non existant (i have searched around ALOT without finding anything). This is my first problem but i get my mails bounced whenever there is any code in them so i hope this one gets through. When trying to set the number of input channels for my mixer au what am i doing wrong ?
This is how i create my mixer
ComponentDescription cd;
Component comp;
Mixer = new CAAudioUnit();
//Create the mixer------------------------------------
cd.componentType = kAudioUnitType_Mixer;
cd.componentSubType = kAudioUnitSubType_Mixer;
cd.componentManufacturer = kAudioUnitManufacturer_Apple;
cd.componentFlags = 0;
cd.componentFlagsMask = 0;
compMixer = FindNextComponent(NULL, &cd);
CAComponent* thecomponentmixer = new CAComponent(comp);
if (compMixer == NULL) exit (-1);
err = CAAudioUnit::Open(*thecomponentmixer,*Mixer);
/*The first one of these calls succedes the other one fails which i find very illogical and contrary to the small ammount of documentation i have found*/
XThrowIfError (Mixer->SetNumberChannels(kAudioUnitScope_Output,0,4),"SetNumberChannels");//how can this sucede? is a mixer not N number of inputs to exaclty 2 outputs?
XThrowIfError (Mixer->SetNumberChannels(kAudioUnitScope_Input,0,2),"SetNumberChannels");//fails why?
What i want to do is set 3 inputs to 2 outputs.
should i use some Mixer->SetProperty call instead ? how would that look ?