Setting volume of a mobileControlCreate "player"

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Aduro91
Posts: 56
Joined: Sat Jul 22, 2023 8:49 pm

Setting volume of a mobileControlCreate "player"

Post by Aduro91 » Tue Apr 08, 2025 11:08 pm

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!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Setting volume of a mobileControlCreate "player"

Post by jacque » Wed Apr 09, 2025 1:08 am

See mobileSetSoundChannelVolume. You'll have to set a sound channel first.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Aduro91
Posts: 56
Joined: Sat Jul 22, 2023 8:49 pm

Re: Setting volume of a mobileControlCreate "player"

Post by Aduro91 » Wed Apr 09, 2025 11:46 am

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,

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Setting volume of a mobileControlCreate "player"

Post by jacque » Wed Apr 09, 2025 6:27 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Aduro91
Posts: 56
Joined: Sat Jul 22, 2023 8:49 pm

Re: Setting volume of a mobileControlCreate "player"

Post by Aduro91 » Thu Apr 10, 2025 9:11 pm

Thanks for the help guys! It is now sorted

Post Reply