Newbie Question:
I’ve gotten a sound associated with an image object to not restart playing every time a new touch event begins (which happens as it’s dragged or tapped on).
If I add more sounds, how do I know what channel a sound has - I only knew because I tested the number “1”. But I want the program to figure it out itself so I don’t have to manually code in the number of every channel. I Looked through the audio API at http://developer.anscamobile.com/reference/audio
but nothing seems to tell you what channel a sound is playing in?
Here’s the section in question:
function myImage.touch(self, event)
if event.phase == "began" then
self.storeX = self.x
self.storeY = self.y
--if audio.isChannelPlaying(1) ~= false then print("audio channel 1 playing" ) end --TEST CHANNEL
if audio.isChannelPlaying(1) ~= true then audio.play( mySound ) end -- PLAY SOUND
elseif event.phase == "moved" then
local x = (event.x - event.xStart) + self.storeX
local y = (event.y - event.yStart) + self.storeY
self.x, self.y = x, y
elseif event.phase == "ended" then print( "ended" ) -- for testing
end
return true
end
Thanks
Eric [import]uid: 128346 topic_id: 23774 reply_id: 323774[/import]