[C API] What is the correct way to use `playdate->sound->synth->playMIDINote`?

Hi all,

I'm working with the C API on the simulator for windows, and when calling the afforementioned function on a single PDSynth voice, I get an illegal memory access crash. Since the function exists in the public API, I'm assuming there is some way to put a PDSynth voice into a state where this function works, and I'm just not doing things right.

I've tried a few things: I tried adding it to a PDSynthInstrument first, and then tried adding the voice directly to a channel first, but to no avail. The only way I've been able to get a synth voice to play a note without crashing is through a PDSynthInstrument and the playdate->sound->instrument->playMIDINote interface instead of the playdate->sound->synth one.

I haven't tried it on the hardware yet, since I didn't want to build around something I couldn't quickly test, but if that would help anyone point me in the right direction let me know I'll go test it and report back.


Somehow, I sorted this out. I must have been being a right clot, I started on a fresh project to try and come up with a minimum reproducible, case and it all started working as I had expected it to initially.

My apologies to anyone who comes here afterwards with similar problems seeking the wisdom of the ancients, I can only suggest taking a step back and simplifying.