error when trying to control the volume of default audio channel
Sound sources not added to a custom channel are added to the global channel.
playdate.sound.channel:addSource(source)
We're able to add effects to the global channel
sfx.addEffect(delay)
however i get an error when trying to access or control the volume using a similar method.
sfx.getVolume()
sfx.setVolume(0.5)
Advice?
Thanks!
PS - really appreciate anyone who has the time and patience to review this
unexpected behavior when trying to use custom channels.
I think that my instrument is not being removed from the global/default channel when I add it to a custom channel. Just aurally, it sound like the volume is nearly doubled and the tone is different, almost like an FM synth playing unison notes.
local lead_track = crescent_mill_sequence:getTrackAtIndex(1)
local lead_synth = sfx.synth.new(sfx.kWavePOVosim)
local lead_inst = sfx.instrument.new()
local lead_channel = sfx.channel.new()
lead_inst:addVoice(lead_synth)
lead_track:setInstrument(lead_inst)
lead_channel:addSource(lead_inst)
And even stranger it sounds when I add effects to the custom channel (in addition to the default/global)
local delay = effect_library.delay
sfx.addEffect(delay)
lead_channel:addEffect(delay)
local bandpass = effect_library.bandpass
sfx.addEffect(bandpass)
lead_channel:addEffect(bandpass)
whole project zip
here's a zip of the current state if you'd like to hear the music -
scapia-main-2.zip (283.4 KB)
you'll find the offending line at source/audio_engine/intsruments.lua
line 24
comment it in and out to reproduce what I'm describing