Indicate whether headphone jack or internal speaker is active

As a Developer
I want to know what the current audio output device is
so that I can play back audio files mixed for the specific device to improve audio quality.

Play date has two audio output options: bass-less, internal, mono speaker, or (potentially) full-featured audio device via the headphones jack.
Producing audio data to sound good on one device will make it sound bad on the other device, because they have mutually exclusive output restrictions.

A simple API to return current output device would allow dynamic selection of proper audio data:

— play bright and wide mono mix
— play music at full freq spectrum 

Other optimization and features that would be enabled by this:

  • dynamic mixing of Spatial Audio sources can be adapted to number of output channels, eg skip panning and other logic for mono playback
  • dynamic composition of number of sounds played based on output device playback capabilities, eg. most prominent audio only if on speaker and more nuanced if on external device
1 Like

Hello, I believe the playdate.sound.getHeadphoneState(changeCallback) will get you the result you want, according to docs:

Returns a pair of booleans (headphone, mic) indicating whether headphones are plugged in, and if so whether they have a microphone attached

1 Like

Thanks a lot, I somehow missed that when scanning the SDK docs.