Microphone: simulator/device behave differently after screen lock

SDK 2.4.1 (windows) / Playdate OS 2.4.1 / using C API

Hi everyone, if I register a callback for the microphone ( e.g. during event = kEventInit )

If I lock the screen and then unlock it,

  • on the device the callback is not called anymore (i.e. the recording is stopped)
  • on the simulator the callback continues to be called

I don't know which one is the best behavior (maybe the device one is the one to keep), but I believe it would be better to get same behaviour on both sides for testing purposes.

Best Regards

1 Like

Thanks for the report, this wouldn't surprise me at all. The lock behavior in the Sim is more of a "simulated lock" vs the actual hardware suspend like the device does. I'll get it into our bug tracker!

Thank you, Will.

In addition, since I am just starting to discover the environment of the Playdate, I am not sure of the implications yet (and so I am not sure if it should be considered as a bug or not...), but just to mention that by running the previously attached code, it also seems that the frame duration or the audio handling speed may be different between the simulator and the device.

On the device we can see that the number of audio buffers per frame looks quite constant (it alternates between 5 and 6 audio buffers per frame certainly because the sample rate is not a multiple of the 30 fps)
On the simulator, it seems to alternate between 4 and 8 audio buffers per frame. So either some frames are twice longer than others, or the audio buffers coming from the sound card are not handled at a regular speed. I did not make further tests (with timers for instance), but I guess the second option is more probable and may also depend on the audio card and drivers....


Sorry, I forgot I was not able not attach the source code because I was a new user...
What the code did is just increasing a global counter within the audio callback (mic input), an registering the size of the audio buffers.
In the update callback it display the size of each counted audio buffer (so, always 256 for each) and the number of recorded buffers, and it resets the variable to 0.

It does also the same for a stereo audio source, and also displays frame rate.

For both audio source and mic callback the behavior is the same.

see two capture examples on the simulator: