Callback in android native for Superpowered audio SDK

198 views Asked by At

I'm having trouble implementing the SuperpoweredRecorderStoppedCallback in the superpowered sdk for android. I was trying to set it up just like the player callbacks in the CrossedExample, but I must be missing something.

static void recordCallback(void *clientData) {
    __android_log_print(ANDROID_LOG_DEBUG, "LOG_callback record", "text:%i ", 
clientData);
};

Then I try to set up the recorder like the players - I have it recording audio just fine, but I receive no callback.

SuperpoweredExample::SuperpoweredExample(unsigned int samplerate, unsigned int buffersize, const char *path, int fileAoffset, int fileAlength, int fileBoffset, int fileBlength, const char *testPath[]) : activeFx(0), crossValue(0.0f), volB(0.0f), volA(1.0f * headroom) {
stereoBuffer = (float *)memalign(16, (buffersize + 16) * sizeof(float) * 2);
stereoBufferRecording = (float *)memalign(16, (buffersize + 16) * sizeof(float) * 2);
this->sampleRate = sampleRate;

playerA = new SuperpoweredAdvancedAudioPlayer(&playerA , playerEventCallbackA, samplerate, 0);
playerA->open(path, fileAoffset, (fileAlength));
playerB = new SuperpoweredAdvancedAudioPlayer(&playerB, playerEventCallbackB, samplerate, 0);
//playerB->open(path, fileBoffset, (fileBlength));
playerB->open(testPath[1],0,0);

playerA->syncMode = playerB->syncMode = SuperpoweredAdvancedAudioPlayerSyncMode_TempoAndBeat;

roll = new SuperpoweredRoll(samplerate);
filter = new SuperpoweredFilter(SuperpoweredFilter_Resonant_Lowpass, samplerate);
flanger = new SuperpoweredFlanger(samplerate);

recorder = new SuperpoweredRecorder(temp, samplerate,1,2,false, recordCallback, __null);

audioSystem = new SuperpoweredAndroidAudioIO(samplerate, buffersize, false, true, audioProcessing, this, -1, SL_ANDROID_STREAM_MEDIA, buffersize * 2);
audioSystemRecording = new SuperpoweredAndroidAudioIO(sampleRate, buffersize, true, false, audioProcessingRecording, this, buffersize * 2);
}

Thanks for any thoughts!

1

There are 1 answers

2
Gabor Szanto On

The callback is called a little bit after you call recorder->stop(). Please note, you're passing NULL for the clientData, which then you try to print.