Re: More than 1 bus in a Node creating distorded audio?
Re: More than 1 bus in a Node creating distorded audio?
- Subject: Re: More than 1 bus in a Node creating distorded audio?
- From: Patrick Muringer <email@hidden>
- Date: Tue, 24 Aug 2010 08:55:47 +0200
- Thread-topic: More than 1 bus in a Node creating distorded audio?
Thanks Bill for your reply,
You are right, my writing was not clear enough.
I add the callbacks for each bus manually:
AUGraphSetNodeInputCallback(graph, MixerNode, 0, &callback);
.
.
.
AUGraphSetNodeInputCallback(graph, MixerNode, N, &callback); should I use
the loop instead?
In the call back, I have a series of IF statements for each bus number
were I either fill with data or with 0:
if(inBusNumber == 0) {
if(input.isPlayingTrack1) {
[input fillBufferWithSampleForBus0:inNumberFrames :frameBuffer];
}
else {
[input fillBufferWith0:inNumberFrames :frameBuffer];
}
}
.
.
if(inBusNumber == N) {
...
}
The fillBufferWithSampleForBus (0 to N) does this:
-(void) fillBufferWithSampleForBus0:(UInt32)inNumberFrames :(UInt32 *)
frameBuffer {
int packetCount;
int packetIndex; //Current position in sample
//loop through the buffer and fill the frames
packetCount = (int)[self.sample1 getPacketCount];
packetIndex = (int)[self.sample1 getIndex];
self.nbSampleToPlayTrack1 = ((packetCount - packetIndex) <
inNumberFrames)? (packetCount - packetIndex):inNumberFrames;
for (int j = 0; j < inNumberFrames; j++){
if(self.nbSampleToPlayTrack1 > 0) {
frameBuffer[j] = [self.sample1 getNextPacket];
self.nbSampleToPlayTrack1--;
}
else {
self.isPlayingTrack1=FALSE;
[self.sample1 reset];
frameBuffer[j] = 0;
}
}
}
So I guess I'm filling the buffer for each bus.
Everything that I "play" on bus 2 and on (correct behavior for busses 0
and 1) is sent clipped only to the left of my headset.
I taught it was the sample so I used the same sample for each bus and I
had the same strange behavior. Anything that I do wrong?
Pat
_______________________________________________
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