How to route channels from SynthUnit to a multi-channel device?
How to route channels from SynthUnit to a multi-channel device?
- Subject: How to route channels from SynthUnit to a multi-channel device?
- From: michael markert <email@hidden>
- Date: Mon, 19 Sep 2005 21:32:22 +0200
Hello list!
I'm sorry, if I am asking something obvious, but I'm stuck.
I have a graph with a SynthNode, one effectNode and one outputNode
which represents my 10-Channel-Output-Device (DELTA 1010LT).
Now I'd like to be able to route the stereo-output of the effectNode
to another pair of channels of the outputNode (that is the inputScope
of the outputUnit, right?)
Synth Node
||
||
Effect Node
||
// \\
// \\
|| or ||
Output Node (CH 0/1 -OR- CH 2/3)
For stereo-output on CH 0/1 everything works fine (so my graph and
units are set up correctly).
Now I have three possible solutions but sadly also three problems:
1. I tried the MatrixMixerExample example from the CoreAudioSDK, but
it needs "CAStreamBasicDescription.h"
...and whenever I add these two files to my project, it doesn't
compile anymore with a bunch of errors:
"error: parse error before "CAStreamBasicDescription": line 71:
class CAStreamBasicDescription :
I must have overlooked some project settings for this case, for it
compiles with the exampleProject?
Do I need dealing with formats, when there's no real I/O but only
Synth-Output?
2. Do I have to use a MatrixMixer (connected between the effectNode
and the outputNode) and "route" channels by setting the desired
channel's volume? (This seems a bit of a strange solution). If this
is the case, is there any MatrixMixer Documentation? It's really hard
to find something useful about it and whenever I plug-in-between a
matrixMixer, I don't hear anything but silence?
3. I tried channelMapping (without using a mixerUnit), but I can't
get it to change anything. It simply keeps playing on the first two
channels. Here is the code (although I'm not sure if the format is
needed?):
-(void)mapOutputToChannels:(int)pairIndex {
// pair index is the index of menuItem, (e.g.) "delta 0/1",
"delta 2/3"...
OSStatus result = noErr;
UInt32 size;
AudioUnit effectUnit;
AUGraphGetNodeInfo(graph, effectNode, NULL, NULL, NULL,
&effectUnit);
AudioUnit outputUnit;
AUGraphGetNodeInfo(graph, outputNode, NULL, NULL, NULL,
&outputUnit);
AudioStreamBasicDescription format;
size = sizeof(format);
result = AudioUnitGetProperty(outputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, 0, &format,
&size);
result = AudioUnitSetProperty(effectUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output, 0,
&format, size);
SInt32 *channelMap = NULL;
channelMap = (SInt32 *)malloc(size);
// UInt32 outChannels = 10; known since awakeFromNib
size = outChannels * sizeof(SInt32);
UInt32 ch = pairIndex * 2; // eg. 0*2=>0/1, 1*2=>2/3;
2*2=>4/5...
BOOL shownfo = NO;
UInt32 i;
for(i=0; i<outChannels; i++) {
channelMap[i] = -1;
if(i==0) { channelMap[i] = ch; shownfo = YES; }
if(i==1) { channelMap[i] = ch + 1; shownfo = YES; }
if(shownfo) { printf("Info:Input Channel (%ld): maps to
output channel %ld \n", i, channelMap[i]); shownfo = NO; }
// Info:Input Channel (0): maps to output channel 2
// Info:Input Channel (1): maps to output channel 3
}
/* // setup audioChannelLayout to "0", customLayout
result = AudioUnitSetProperty(outputUnit,
kAudioUnitProperty_AudioChannelLayout,
kAudioUnitScope_Input,
1, 0, sizeof(UInt32)); */
// set mapping
result = AudioUnitSetProperty(outputUnit,
kAudioOutputUnitProperty_ChannelMap,
kAudioUnitScope_Input,
0, channelMap, size);
NSLog(@"%d", result); // result returns "0"
}
With every document I'm reading I get more confused: I don't know if
I should use a matrixMixer, do channelMapping, using channelLayouts,
defining a channelBitmap or makeConnections in the matrixMixer.
And whereever I go, something is stopping me :(
Any hint is appreciated, for I am working over this for some weeks
now and it's slowly driving me mad!
Regards,
Michael
_______________________________________________
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