a Slider to control volume of mp3 music in livecode

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
Lina
Posts: 11
Joined: Fri May 01, 2020 12:52 pm

a Slider to control volume of mp3 music in livecode

Post by Lina » Fri May 01, 2020 12:55 pm

I was wondering is there was a way to control the volume of something with a
slider so that if the slider was one the value 0 there would be no sound, and
if it was on 100, the sounds was as high as it could go

For the script, I tried something like "set the playLoudness of player 1 to
value" Which obviously didn't work, and so yeah, I'm asking for your help..

Klaus
Posts: 12090
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: a Slider to control volume of mp3 music in livecode

Post by Klaus » Fri May 01, 2020 1:03 pm

Hi Lina,

welcome to the forum!

Well, almost! :-)
OK, create a slider, set its STARTVALUE to 0 and its ENDVALUE to 100 in the inspector.
Then add this script to the slider:

Code: Select all

on scrollbardrag tValue
   set the playLoudness of player 1 to tValue
end scrollbardrag
The SCROLLBARDRAG message is sent continuously to the scrollbar/slider while dragging and
the paramter tValue is the current value of the slider.

Best

Klaus

P.S.
Personal note:
A little "Hello" or something would not have hurt for the very first posting.

Lina
Posts: 11
Joined: Fri May 01, 2020 12:52 pm

Re: a Slider to control volume of mp3 music in livecode

Post by Lina » Fri May 01, 2020 8:21 pm

LOL
Sorry for that
Hi everyone my name is lina
Thank you for your help Klaus

Klaus
Posts: 12090
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: a Slider to control volume of mp3 music in livecode

Post by Klaus » Fri May 01, 2020 10:10 pm

You're welcome!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”