My goal is to be able to play multiple sounds (in order to do a Drum kit), using the Superpowered API since I need very low latency.
I can't find the overall architecture in the .mm file.
For now, I have in my .mm file :
- 1 SuperpoweredIOSAudioIO* output
- 10 SuperpoweredAdvancedAudioPlayer* (players[10]), since I have 10 drums
But I can't find how to implement the rest of the .mm file, in particular the audioProcessing
loop.
I have this currently:
static bool audioProcessing(Superpowered *clientdata, float **buffers, unsigned int inputChannels, unsigned int outputChannels, unsigned int numberOfSamples, unsigned int samplerate, uint64_t hostTime) {
Superpowered *self = clientdata;
bool overallSilence = true;
for(int i = 0; i < 10; i++) {
SuperpoweredAdvancedAudioPlayer *player = self->players[i];
bool silence = !player->process(self->stereoBuffer, false, numberOfSamples);
if (silence == false) {
overallSilence = false;
}
}
if (!overallSilence) SuperpoweredDeInterleave(self->stereoBuffer, buffers[0], buffers[1], numberOfSamples); // The stereoBuffer is ready now, let's put the finished audio into the requested buffers.
return !overallSilence;
}
and when I want to play a sound:
- (void)playWithPlayerAtIndex:(int) index {
SuperpoweredAdvancedAudioPlayer* player = players[index];
player->seek(0);
player->play(false);
}
But with this, I can only play hear one sound at a time.
Does anyone know the Superpowered API?