1

I'm trying to mix SuperpoweredAdvancedAudioPlayers and write to a wav file. I called recorder->start(path) and recorder->stop(), but nothing gets written to disk. I have correct storage permissions in my manifest. I googled other people's code and came up with this:

My process:

bool SuperpoweredExample::process(short int *output, unsigned int numberOfSamples) {
    double masterBpm = players[0]->currentBpm;
    double msElapsedSinceLastBeat = players[0]->msElapsedSinceLastBeat;

    uint16_t i;
    bool silence = true;
    for (i=rs=0; i<NUMPLAYERS; i++) {

        if (players[i]->process(stereoBuffer, !silence, numberOfSamples, volume[i] * 0.25, masterBpm, msElapsedSinceLastBeat))
            silence = false;

    }

    if (!silence) {
        recorder->process(stereoBuffer, 0, buffersize);
    }

    if (!silence) {
        SuperpoweredFloatToShortInt(stereoBuffer, output, numberOfSamples);
    }

    return !silence;
}

Initialization:

recorder = new SuperpoweredRecorder(tempPath, samplerate, 1);

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

Any ideas?

1 Answers1

0

This can happen on a path problem. Please check if the paths you submit are actually correct and writeable.

Gabor Szanto
  • 1,329
  • 8
  • 12
  • For example, /sdcard/emulated/0/Music/ is not a valid C filesystem path. The correct path in C is /mnt/sdcard/emulated/0/Music/ – Gabor Szanto May 03 '17 at 00:02
  • 1
    path given is correct of cache memory & its writable too. this happens randomly. any suggestions to check – Nishant Bijani A Dec 07 '18 at 17:29
  • @NishantBijaniA did you get any solution for this as i am also getting this randomly – Muhammad Haroon Aug 27 '20 at 10:28
  • @MuhammadHaroon check file writing permission in app, get latest version of superpowered sdk. also check recorder example given in SDK itself. Superpowered Recorder is working perfect. – Nishant Bijani A Aug 27 '20 at 12:41
  • @NishantBijaniA when i record for first time the file is perfect when i go back and started again now this time file is corrupted and of 44bytes if i kill app and start recording its working fine again i am using latest sdk. – Muhammad Haroon Aug 28 '20 at 05:09