how to repeat a sound using audio.play without using another channel number?

How can you repeat at will the same sound effect, but WITHOUT having to use a specific channel number?  

I note that when you use “clickSoundChannel = audio.play(mySoundEffect)” to play a particular sound effect that everytime you use this “play” that a NEW channel number is allocated.  Is there a way to be able to play a sound effect again on the exiting channel number (BUT I don’t want to have to pick/specify a channel number in an audio.play())

You can set the channel in the audio.play options: http://docs.coronalabs.com/api/library/audio/play.html

Hope that helps.

EDIT: Sorry didn’t notice “(BUT I don’t want to have to pick/specify a channel number in an audio.play())” 

BTW while trying GGSound the other day it had your requirements as a default behaviour, might save you some time: https://github.com/GlitchGames/GGSound

Are you wanting to loop your effect?  There is a loop parameter on audio.play() that tells how many times to play the sound and one value says repeat indefinitely.  See:

http://docs.coronalabs.com/api/library/audio/play.html

Hi Rob. No to loop. Just to replay whenever I need to. Eg for a click sound if a button is pushed. Was hoping to have a way to do without having to manually set a channel, but not chew up multiple different channels either

I’ve handled this in three different ways depending on the game.  For one game, I had my background looping on channel 1, my ambient effects playing on 2, my UI effects on 3 and my voice overs on 4.  There shouldn’t be any situation in this game where I would try to play more than one sound on one channel at a time.  Then in another game, there could be multiple sounds playing at once.  In that case, I used the audio.findFreeChannel() API call to get a channel number.   I usually reserve 1-2 channels for things like the background music.

Ok. Tks Rob

You can set the channel in the audio.play options: http://docs.coronalabs.com/api/library/audio/play.html

Hope that helps.

EDIT: Sorry didn’t notice “(BUT I don’t want to have to pick/specify a channel number in an audio.play())” 

BTW while trying GGSound the other day it had your requirements as a default behaviour, might save you some time: https://github.com/GlitchGames/GGSound

Are you wanting to loop your effect?  There is a loop parameter on audio.play() that tells how many times to play the sound and one value says repeat indefinitely.  See:

http://docs.coronalabs.com/api/library/audio/play.html

Hi Rob. No to loop. Just to replay whenever I need to. Eg for a click sound if a button is pushed. Was hoping to have a way to do without having to manually set a channel, but not chew up multiple different channels either

I’ve handled this in three different ways depending on the game.  For one game, I had my background looping on channel 1, my ambient effects playing on 2, my UI effects on 3 and my voice overs on 4.  There shouldn’t be any situation in this game where I would try to play more than one sound on one channel at a time.  Then in another game, there could be multiple sounds playing at once.  In that case, I used the audio.findFreeChannel() API call to get a channel number.   I usually reserve 1-2 channels for things like the background music.

Ok. Tks Rob