OS 2.7.1 crash when calling playdate->sound->fileplayer->stop in fadeVolume callback

Since updating to SDK 2.7.1, Poker Poker Magic version 1.6.0 crashes on device and in the simulator. In the simulator, it crashes with the following message:

com.apple.audio.IOThread.client (22)
Assertion failed: (bytes <= RingBuffer_getBytesAvailable(r)), function RingBuffer_moveOutputPointer, file ringbuffer.c, line 183.

It happens when I call playdate->sound->fileplayer->stop in the callback from playdate->sound->fileplayer->fadeVolume. If I remove the call to stop, it does not crash.

static void stopFilePlayer(SoundSource * _Nonnull source, void * _Nullable userdata);

void MusicManagerPlay(const char * _Nonnull music, int repeat, float crossFadeDuration) {
  const struct playdate_sound_fileplayer *filePlayerAPI = playdate->sound->fileplayer;
  /* ... */
  const int32_t duration = kFrequency * crossFadeDuration;
  filePlayerAPI->fadeVolume(currentPlayer, 0.0f, 0.0f, duration, stopFilePlayer, NULL);
  /* ... */
}

static void stopFilePlayer(SoundSource * _Nonnull source, void * _Nullable userdata) {
  FilePlayer *self = (FilePlayer *)source;
  // Crash here. Does not crash if the next line is removed.
  playdate->sound->fileplayer->stop(self);
}
1 Like

I'm seeing this too with a Super Splash League stable build made on 2.6.2. Crashes on 2.7.0, 2.7.1 & 2.7.2.

mild panic attack that I sent a broken build to panic two weeks ago :sweat_smile:

edit: The current live Teddison Inc pdx is crashing too. (uses the same fileplayer tooling the stops fileplayers after fading)