Question on Audio play an Requested Channel

Hi Everyone…

I have a Warning on Console…

Audio error: Requested Channel (29) is in use…

Is there a way to avoid that?


The app works fine… but I don’t hear the sound effect on that channel…

If I don;t use the channel, like [   audio.play ( sound  )

Then the sound is too lound…

1.- Should I re Record the sound at a lower volume…?

2.- or is there another way to do this in Corona?

Thanks for your time…

Victor

Hi Victor,

When you use audio.play(), it returns the number of the channel that it plays on. So, if you don’t specify a channel, this is very useful to gather the channel number, then immediately after, you can set the volume on that specific channel:

[lua]

local thisSound = audio.play( mySoundHandle )

– Variable ‘thisSound’ now represents the channel it’s playing on, so adjust the channel’s volume

audio.setVolume( 0.5, { channel=thisSound } )

[/lua]

Hope this helps,

Brent

Thank you Brent, this works really well…

Let me ask you a question… this sets the volume for each channel

if I want to set the master volume , like the final output

should I do that in the main.lua?

and if yes…

what do I do?

Hi Victor,

You can set the master volume by not specifying a channel table. Just like this:

[lua]

audio.setVolume( 0.2 )

[/lua]

Brent

Thanks a lot…this is great!

Hi Victor,

When you use audio.play(), it returns the number of the channel that it plays on. So, if you don’t specify a channel, this is very useful to gather the channel number, then immediately after, you can set the volume on that specific channel:

[lua]

local thisSound = audio.play( mySoundHandle )

– Variable ‘thisSound’ now represents the channel it’s playing on, so adjust the channel’s volume

audio.setVolume( 0.5, { channel=thisSound } )

[/lua]

Hope this helps,

Brent

Thank you Brent, this works really well…

Let me ask you a question… this sets the volume for each channel

if I want to set the master volume , like the final output

should I do that in the main.lua?

and if yes…

what do I do?

Hi Victor,

You can set the master volume by not specifying a channel table. Just like this:

[lua]

audio.setVolume( 0.2 )

[/lua]

Brent

Thanks a lot…this is great!