Matrix Mixer problem (second posting)
Matrix Mixer problem (second posting)
- Subject: Matrix Mixer problem (second posting)
- From: Ethan Funk <email@hidden>
- Date: Thu, 14 Oct 2004 12:12:56 -0700
I am posting this question a second time, in hopes that some one can
help.
For some reason, I am only able to set the MatrixMixer matrix volume
for
the cross point corrisponding to 0,0. This leads me to beleive I have
formated the data incorrectly, since zero is zero in almost any format,
lending to that case working. I have included my code below. If
nothing
else, can some one direct me to some documentation for the Matrix Mixer
AU. What I do know, I figured out from examle code only.
Any help at all will be appreciated,
Ethan...
Here is are the results from the procedure call below when I set up the
first player.
Inputs 0 and 1 on matrix mixer bus #0, pNum = 0, player->bus_assignment
= 5 (output channels 0,1,4,5), player->balance = 0, inChNum = 2,
outChNum
= 8:
IN=0 OUT=0 CROSS=00000000 VOL=1
IN=1 OUT=0 CROSS=00010000 VOL=0
IN=0 OUT=1 CROSS=00000001 VOL=0
IN=1 OUT=1 CROSS=00010001 VOL=1
IN=0 OUT=2 CROSS=00000002 VOL=0
IN=1 OUT=2 CROSS=00010002 VOL=0
IN=0 OUT=3 CROSS=00000003 VOL=0
IN=1 OUT=3 CROSS=00010003 VOL=0
IN=0 OUT=4 CROSS=00000004 VOL=1
IN=1 OUT=4 CROSS=00010004 VOL=0
IN=0 OUT=5 CROSS=00000005 VOL=0
IN=1 OUT=5 CROSS=00010005 VOL=1
IN=0 OUT=6 CROSS=00000006 VOL=0
IN=1 OUT=6 CROSS=00010006 VOL=0
IN=0 OUT=7 CROSS=00000007 VOL=0
IN=1 OUT=7 CROSS=00010007 VOL=0
void UpdateMatrix(UInt32 pNum)
{
int ic, oc, ob;
float bal[4]; // {inLoutL, inRoutL, inLoutR, inRoutR} balance
matrix
float level;
ARPlayer *player;
UInt32 buses, crosspoint, mIn, mOut;
float balance, L, R;
pthread_mutex_lock( &pMutex );
if (player = pList[pNum]){
buses = player->bus_assignment;
balance = player->balance;
pthread_mutex_unlock( &pMutex );
}else{
pthread_mutex_unlock( &pMutex );
return;
}
L = sqrt(1.0 + balance);
R = sqrt(1.0 - balance);
bal[0] = L;
bal[1] = 0.0;
bal[2] = 0.0;
bal[3] = R;
if (buses < 0){
//we are in cue mode!
buses = 2L; // bus 1 (cue) only
}
for(ob=0; ob < outChNum/inChNum; ob++){
for(oc=0; oc < inChNum; oc++){
for(ic=0; ic < inChNum; ic++){
level = (float)(1L & (buses >> ob)) * bal[(oc *
inChNum) + ic];
mIn = (inChNum * pNum) + ic;
mOut = (inChNum * ob) + oc;
crosspoint = (mIn << 16) | (mOut & 0x0000FFFF);
fprintf(stdout, "IN=%lu OUT=%lu CROSS=X VOL=%g\n",
mIn, mOut, crosspoint, level);
AudioUnitSetParameter( mixer,
kMatrixMixerParam_Volume,
kAudioUnitScope_Global,
crosspoint,
level,
0);
}
}
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden