I encounter a strange problem with using the findFreeChannel function. Here is a sample from my code…
local gotchannel1 = audio.findFreeChannel(4) print ("Channel X is "..gotchannel1) if sounds.door~=nil and gotchannel1~=0 then local options = { duration = 1400, channel=gotchannel1, } soundplay.door=audio.play(sounds.door,options) end local gotchannel2= audio.findFreeChannel(4) print ("Channel Y is "..gotchannel2) if sounds.door~=nil and gotchannel2~=0 then local options = { duration = 1400, channel=gotchannel2, } soundplay.door=audio.play(sounds.door,options) end local gotchanne3= audio.findFreeChannel(4) print ("Channel Z is "..gotchannel3) if sounds.door~=nil and gotchannel3~=0 then local options = { duration = 1400, channel=gotchannel3, } soundplay.door=audio.play(sounds.door,options) end
This is the error message I get…
Channel X is 4
Channel Y is 4
Warning: audio error: Requested channel (3) is in use
Now I have two questions about this:
-
Why is the channel 4 in use two times?
-
How can it be channel 3 is accessed when I only search for free channels from 4 up?
Thank you for your help!
Best,
Daniela