I found another audio related bug.
The following code to play a note one second in the future using PDSynth
works as expected:
AudioSample *sample = pd->sound->sample->load("audio/something.wav");
PDSynth *synth = pd->sound->synth->newSynth();
pd->sound->synth->setSample(synth, sample, 0, 0);
pd->sound->channel->addSource(pd->sound->getDefaultChannel(), (SoundSource *)synth);
pd->sound->synth->playMIDINote(synth, NOTE_C4, 0.5, 1.0, pd->sound->getCurrentTime() + 44100);
(Replace the path to the sample with whatever you want. I don't think it matters what it is.)
However attempting the same with PDSynthInstrument doesn't play anything:
AudioSample *sample = pd->sound->sample->load("audio/something.wav");
PDSynth *synth = pd->sound->synth->newSynth();
pd->sound->synth->setSample(synth, sample, 0, 0);
PDSynthInstrument *inst = pd->sound->instrument->newInstrument();
pd->sound->instrument->addVoice(inst, synth, 0, 128, 0);
pd->sound->channel->addSource(pd->sound->getDefaultChannel(), (SoundSource *)inst);
pd->sound->instrument->playMIDINote(inst, NOTE_C4, 0.5, 1.0, pd->sound->getCurrentTime() + 44100);
It does play something if you pass 0
as the final parameter to playMIDINote
, though.