Latency/clicking sound when looping a player with Superpowered

238 Views Asked by At

I am using a SuperpoweredAdvancedAudioPlayer to play a wav file in a loop. The problem is, every time the track loops, there is a little hiccup with a popping sound and a very small delay. It is noticeable and makes looping totally useless

Here is the callback function I am using to loop

// Called by the playerA.
static void playerEventCallbackA (
        void * __unused clientData,
        SuperpoweredAdvancedAudioPlayerEvent event,
        void *value
) {
    switch (event) {
        case SuperpoweredAdvancedAudioPlayerEvent_LoadSuccess:
            break;
        case SuperpoweredAdvancedAudioPlayerEvent_LoadError:
            log_print(ANDROID_LOG_ERROR, "Player", "Open error: %s", (char *)value);
            break;
        case SuperpoweredAdvancedAudioPlayerEvent_EOF:
            playerA->seek(0);    // loop track
            break;
        default:;
    };
}

Considering the entire point of this SDK is to have minimal latency with recording and playback, I figure I must be doing something wrong.

Any tips?

1

There are 1 best solutions below

4
Gabor Szanto On

Sample-precise looping is possible with the SuperpoweredAdvancedAudioPlayer->loop() and loopBetween() methods.