Josh Laird
Josh Laird

Reputation: 7224

SuperpoweredRecorder: not creating temp file or recording any audio

I think I'm passing the SuperpoweredAndroidAudioIO to the SuperpoweredRecorder's process() method incorrectly.

My process callback looks like below:

bool SuperpoweredExample::process(short int *audioIO, unsigned int numberOfSamples) {
    if (recording) {
        recordProcess(audioIO, numberOfSamples);
    }
    return true;

recordProcess:

void SuperpoweredExample::recordProcess(short *input, unsigned int numberOfSamples) {

    SuperpoweredShortIntToFloat(input, stereoBuffer, numberOfSamples);

    __android_log_print(ANDROID_LOG_VERBOSE, "SuperpoweredExample", "%i",
                        recorder->process(stereoBuffer, NULL, numberOfSamples));
}

SuperpoweredRecorder's process() always returns 0 so it has not yet started recording. I assume this is because I'm not passing it the input correctly.

Further relevant code:

stereoBuffer = (float *) memalign(16, (buffersize + 16) * sizeof(float) * 2);
audioSystem = new SuperpoweredAndroidAudioIO(samplerate, buffersize, true, true,
                                                 audioProcessing, this, -1, SL_ANDROID_STREAM_MEDIA,
                                                 buffersize * 2);

My onRecord():

void SuperpoweredExample::onRecord(bool record) {
    if (!record) {
        recording = false;
        recorder->stop();
    } else {
        recording = true;
        __android_log_print(ANDROID_LOG_VERBOSE, "SuperpoweredExample", "%s", tempPath.c_str());
        recorder->start((tempPath + "_TEMP").c_str());
    };
}

How do I get SuperpoweredRecorder to create files?

I have tried creating another buffer just for recording but I'm having the same problem. Should I be using createWav()? It says to only use that for offline processing.

Upvotes: 2

Views: 243

Answers (1)

Josh Laird
Josh Laird

Reputation: 7224

I added a separate buffer for recording and that seemed to work.

Upvotes: 1

Related Questions