Here is the code of the two main classes:
inputAudio.m where the init of the audio and the callback are done
inMemoryAudioFile.m taken from the example code of Aran Mulholland
I tried in fact to avoid obj-c in the callback.
I was wondering to have a callback different for each bus. I wonder if I can add as many bus as I want or if two (0 and 1) are the max number possible.
I changed the order of the sample to check wether the sample wasn't of good quality… No result.
If the mixer is additive, I would have clipped or bad result for the overall output. Instead, I get the problem only on busses 2 and 3…
Honestly, I do not know where/what to check…
Patrick
While true that one should avoid heavy objective-c messaging in a render callback, in my experience using too much objective-c will result in no audio at all rather than clipping. A simple example is to add one or two NSLogs in a render callback... silence...
Agreed though, without more info about the class that's providing the packets we can only really guess here. My guess is that if everything after bus 2 is coming out of one channel, then you're probably overloading that channel. Maybe try making your code mono first, see if you can get rid of the clipping by keeping all of the busses below a certain amplitude, and then re-code to do stereo? On Tue, Aug 24, 2010 at 7:24 AM, Kyle Sluder <email@hidden> wrote: On Aug 24, 2010, at 2:55 AM, Patrick Muringer < email@hidden> wrote:
>
> if(inBusNumber == 0) {
> if(input.isPlayingTrack1) {
> [input fillBufferWithSampleForBus0:inNumberFrames :frameBuffer]; General wisdom is not to use ObjC in a render callback. In certain cases, method dispatch can lock, leading to missed realtime thread deadlines and corrupted audio.
>
> //loop through the buffer and fill the frames
> packetCount = (int)[self.sample1 getPacketCount];
> packetIndex = (int)[self.sample1 getIndex];
ObjC style note: the "get" prefix is reserved for returning values by reference. Regular accessors do not begin with "get." Using "get" breaks KVC. See -[NSString getCharacters:] for an appropriate use of "get."
>
> So I guess I'm filling the buffer for each bus.
Guessing isn't helpful, and since we don't have the source to whatever class you're using to get your sample data, that's all we can do too. Have you stepped through your code in the debugger and proven that your buffers are indeed being filled with the appropriate sample data?
--Kyle Sluder _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list ( email@hidden)
This email sent to email@hidden
|