Page 1 of 1

Setting volume of a mobileControlCreate "player"

Posted: Tue Apr 08, 2025 11:08 pm
by Aduro91
Hey folks,

I've created a slider in my app that sets the playloudness, but this doesn't seem to change the sound of the audio played in a mobilecontrol player, i.e. mobileControlCreate "player"...

Is there any way to control the volume in this kind of player or ALL sound at once?

Thanks!

Re: Setting volume of a mobileControlCreate "player"

Posted: Wed Apr 09, 2025 1:08 am
by jacque
See mobileSetSoundChannelVolume. You'll have to set a sound channel first.

Re: Setting volume of a mobileControlCreate "player"

Posted: Wed Apr 09, 2025 11:46 am
by Aduro91
jacque wrote:
Wed Apr 09, 2025 1:08 am
See mobileSetSoundChannelVolume. You'll have to set a sound channel first.
Thanks for the reply.

I've looked at info for mobilecontrolcreate and the mobileSetSoundChannelVolume, and I can't see how to set a channel that wll apply to my mobilecontrolcreate player.

https://livecode.fandom.com/wiki/MobileControlCreate

https://livecode.fandom.com/wiki/Mobile ... nelVolume

To clarify what I'm looking to do, I am playing audio through the play [audiofile.mp3] command whilst playing music at the same time using a mobilecontrolcreate player in iOS. From my research it looks like its impossible to control the volume on the mobilecontrolcreate player and only on the sounds being played through the direct 'play' command, unfortunately.
http://lists.runrev.com/pipermail/use- ... 87563.html

But just checking if any developments have been made,

Re: Setting volume of a mobileControlCreate "player"

Posted: Wed Apr 09, 2025 6:27 pm
by jacque
The built-in LC docs give a little more info than the wiki page. By using the mobileSetSoundChannelVolume without an existing named channel, LC will create the channel for you. So:

Code: Select all

mobileSetSoundChannelVolume "myChannel", 50
mobilePlaySoundOnChannel <sound>, "myChannel" , "now"
 
Once the channel exists you can adjust the volume at any time using the mobileSetSoundChannelVolume command.

I don't think you can mix the play command with the mobile ones. But I believe you can create two different mobile channels to play simultaneously and adjust the volume separately for each. I never tried it and I'm not at my Mac right now, but if that doesn't work then create two different players with differently named channels each.

Re: Setting volume of a mobileControlCreate "player"

Posted: Thu Apr 10, 2025 9:11 pm
by Aduro91
Thanks for the help guys! It is now sorted