Platform: Mac (Simulator)
I've been exploring the audio APIs the last few days and for the life of me I can't seem to get control signals to do anything. I've created a control signal and added a bunch of random events to it. I also added it to an otherwise functioning track in a sequence, and also tried setting it as a parameter mod for various things: a delay line's mix amount on the main channel, parameters for various waveforms in synths playing on that track, etc. But no matter what I do there's no automation. All connected parameter mods act as though they're just receiving zeroes.
Here's some minimal sample code illustrating the problem
local snd = playdate.sound math.randomseed(playdate.getSecondsSinceEpoch()) local control = snd.controlsignal.new() for i = 1,256 do control:addEvent(i, math.random()) end local lfo = snd.lfo.new() lfo:setRate(0.2) lfo:setDepth(1) local synth = snd.synth.new(snd.kWavePODigital) synth:setVolume(0.2) synth:setAttack(0.01) synth:setDecay(0.1) synth:setSustain(0.1) synth:setRelease(0) -- This doesn't work (lfos seem fine, though) synth:setParameterMod(1, control) local instrument = snd.instrument.new() instrument:addVoice(synth) local track = snd.track.new() track:setInstrument(instrument) for i = 1, 16 do track:addNote(i, math.random(60, 71), 4) end -- Note: This crashes if you try to add a control without any events! track:addControlSignal(control) local sequence = snd.sequence.new() sequence:setTempo(4) sequence:setLoops(1, 16) sequence:addTrack(track) local delay = snd.delayline.new(0.275) delay:setFeedback(0.7) delay:setMix(0.0) snd.addEffect(delay) -- This doesn't work either delay:setMixMod(control) sequence:play()
Is this a known problem/bug, or does anyone have an example of some code that shows control signals working as expected? Or maybe a simulator issue? I don't yet have a real device to test on.