Re: MatrixMixer info
Re: MatrixMixer info
- Subject: Re: MatrixMixer info
- From: Robert Grant <email@hidden>
- Date: Tue, 18 Nov 2003 14:21:27 -0500
Here's a function I just wrote to dump the crosspoints of a MatrixMixer:
void dumpMatrixMixer(AudioUnit mixer, int inputChannels, int
outputChannels)
{
int x = 0;
int y = 0;
for (y = -1; y < outputChannels; y++) {
for (x = 0; x < inputChannels + 1; x++) {
UInt32 element = 0;
Float32 level = 0;
if (y == -1 && x == inputChannels) {
element = 0xFFFFFFFF;
} else if (y == -1) {
element = x << 16 | 0xFFFF;
} else if (x == inputChannels) {
element = 0xFFFF << 16 | y;
} else {
element = x << 16 | y;
}
OSStatus err = AudioUnitGetParameter(mixer,
kMatrixMixerParam_Volume, kAudioUnitScope_Global, element, &level);
printf("X %.02f ", element, level);
}
printf("\n");
}
}
The first row is your input channel levels (and the global level as the
last column on the first row).
The next rows are your cross point levels and the last column is the
output channel level. Each point in the matrix tells you the crosspoint
element and it's level.
For example a 2 channel input x 2 channel output looks like this:
0000FFFF 1.00 0001FFFF 1.00 FFFFFFFF 0.80
00000000 1.00 00010000 0.00 FFFF0000 1.00
00000001 0.00 00010001 1.00 FFFF0001 1.00
It's a little overwhelming and I'm sure someone could beautify it but
it works :-)
Robert.
On Nov 18, 2003, at 1:16 PM, Stefan Werner wrote:
From: Stefan Werner <email@hidden>
Subject: Re: MatrixMixer info
Date: 18. November 2003 19:12:52 MEZ
To: Robert Grant <email@hidden>, email@hidden
Hi,
On 18.11.2003, at 18:54, Robert Grant wrote:
Haven't used the ConverterUnit but you should ensure that the number
of channels and the
channel layout (OK Bill? ;-)
of the ConverterUnit match the input bus it's connected to otherwise
it won't work. Also make sure
you disable any unused input buses.
Well, I think I am doing all this. Here are some pieces of my code.
At setup time:
UInt32 num= kMatrixChannels;
AudioUnitSetProperty( mMixerUnit,
kAudioUnitProperty_BusCount,
kAudioUnitScope_Input,
0,
&num,
sizeof(UInt32) );
num = 1;
AudioUnitSetProperty( mMixerUnit,
kAudioUnitProperty_BusCount,
kAudioUnitScope_Output,
0,
&num,
sizeof(UInt32) );
AudioUnitSetParameter( mMixerUnit,
kMatrixMixerParam_Volume,
kAudioUnitScope_Global,
0xFFFFFFFF, 1.0, 0);
AudioUnitInitialize(mMixerUnit);
for (i = 0; i < kMatrixChannels; i++) {
AudioUnitSetParameter(mMixerUnit, kMatrixMixerParam_Enable,
kAudioUnitScope_Input, i, 0, 0);
AudioUnitSetParameter(mMixerUnit, kMatrixMixerParam_Volume,
kAudioUnitScope_Global, (i<<16)+0xffff, 1.0, 0);
AudioUnitSetParameter(mMixerUnit, kMatrixMixerParam_Volume,
kAudioUnitScope_Global, (i<<16), 1.0, 0);
}
AudioUnitSetParameter(mMixerUnit, kMatrixMixerParam_Volume,
kAudioUnitScope_Global,
0xffff0000, 1.0, 0);
Then, when I add a Converter Unit (iUnit in this case) I match formats
and connect the nodes, finally
I enable the input of the mixer:
AudioUnitGetProperty( iUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
0,
&desc,
&size );
AudioUnitSetProperty( mMixerUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
destInputNumber,
&desc,
size );
AudioUnitSetProperty(mMixerUnit,
kAudioUnitProperty_MakeConnection,
kAudioUnitScope_Input,
mNumClients,
&connection,
sizeof(AudioUnitConnection));
AudioUnitSetParameter(mMixerUnit,
kMatrixMixerParam_Enable,
kAudioUnitScope_Input,
destInputNumber, 1, 0);
None of the functions returns an error (I left away the error checking
here for easier reading), and my
IOProc on the other side of the ConverterUnit gets called. Still, no
sound. Am I doing something wrong
in mixing or in enabling the channel?
thanks,
Stefan
_______________________________________________________________________
_______
WEB.DE FreeMail wird 5 Jahre jung! Feiern Sie mit uns und
nutzen Sie die neuen Funktionen http://f.web.de/features/?mc=021130
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.