struct CallbackRefConStruct {
SoundEngine* soundEngine;
int trackIndex;
};
for (UInt16 trackIndex = 0; trackIndex < (MAX_TRACKS+1); trackIndex++) {
struct CallbackRefConStruct *refCon;
refCon = new( CallbackRefConStruct );
refCon->soundEngine = self;
refCon->trackIndex = (int)trackIndex;
AURenderCallbackStruct callbackMixer = {.inputProc = mixerCallback,.inputProcRefCon = (__bridge CallbackRefConStruct *)(refCon)};
checkRes(AudioUnitSetProperty(auMixer,kAudioUnitProperty_SetRenderCallback,kAG,trackIndex,&callbackMixer,sizeof(callbackMixer)),"setting callbackMixer");
}
The audio is still saturated on iso7.
I have also made a test with some “manual” mixing. A mixer with only track and a callback that does the mixing. It works well with xcode6/ios7. My actual app has actually a more complex audio path (with master effects and auxiliary effects on separate tracks) and implementing that solution will take me some time.But at least I have now at least an exit plan ;^)
I am going to leave my problem aside and wait for the GM of xcode6/ios8.
Thanks for your support Dave.
Pascal
Nice one. I’ll try passing a refCon instead of self.
Thanks.
Pascal
On 2 sept. 2014, at 15:33, Dave O'Neill <
email@hidden> wrote:
Pascal
Maybe somewhere else in your code you are having a 64 bit problem. Casting pointers can go wrong with 64 bit and some other things as well. I've had great success with the built in mixer and it is very efficient. Try passing pointers to separate structs for your inRefCon instead of self. It forces you to separate your playback logic and might help you find your bug.
Dave
On Tuesday, September 2, 2014, Pascal <email@hidden> wrote:
This is exactly what I have been doing for the last 3 years, having callbacks callings various data structures, depending on the inBusNumber value. It is has been working just fine with xcode3, xcode4, xcode 5, iOS 4, iOS 5, OS 6 and iOS 7. Now it is only with my app built with xcode6 running on ios7 that I get the saturation, as if the MultipleChannelMixer wasn’t properly doing its “mixing” job like it used. And again it works well with xcode6/ios8. What the hell?
This is most confusing. I have been researching today about issues with MultipleChannelMixers or any unusual parameters that I may have skipped. But no luck.
My solution is going to to forget about MultipleChannel and to do my own mixing in one callback using vDSP functions.
Best,
Pascal
On 1 sept. 2014, at 19:30, Dave O'Neill <
email@hidden> wrote:
I'm not sure what changed this version of Xcode to break your old code, maybe some channels of the mixer weren't enabled (you could try panning them to test). On the mixer, each channel can be stereo or mono and will call it's callback once per cycle. So if you have one data structure that is supposed to be advanced once each cycle, it ends up getting advanced multiple times per cycle because each channel calls the same callback advancing the same data structure.