How do I custom vol slider. GET VOLUME X

Get help using Construct 2

Post » Thu Oct 22, 2015 7:30 pm

I want to set slider X to volume, but can only set to master volume but I want music volume, and volume to be 2 different things, and I think master volume will turn off music as well.
How do I get volume.X to put my slider at?
B
10
S
4
G
3
Posts: 223
Reputation: 3,458

Post » Fri Oct 23, 2015 12:46 am

=/
B
10
S
4
G
3
Posts: 223
Reputation: 3,458

Post » Fri Oct 23, 2015 4:04 am

I'm not sure I understand correctly. You want for example the sound fx and music play at different levels?
If so, then keep the master volume at db 0 and don't use a slider for that.
Instead, create 2 sliders that each one will control one of the 2 categories (fx or music). Whenever you trigger a new sound, pass the corresponding slider value into its "Volume" parameter.

ex:

Play "MyMusic" looping at volume Slidermusic.Value
Play "MyFX" not looping at volume Sliderfx.Value
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Sat Oct 24, 2015 2:10 am

Thats no good, i dont want to use slider bar, i want to make my own custom slider bar that looks good :P. I cannot retrieve volume to get the X coordinates to put slider at, when i set X to audio.volume it says i need another parameter.
B
10
S
4
G
3
Posts: 223
Reputation: 3,458

Post » Sat Oct 24, 2015 7:07 am

Ah, now I get it. You can't just put the X value as the volume though. You have to convert it first

I did an example
https://dl.dropboxusercontent.com/u/14855413/volumeslider.capx

There's probably a better formula, but basically what it does is to translate the X position of the slider sprite to db.
Substitute 525 to the maximum X your slider sprite can travel and 250 to the difference between max X and min X.
-50 is the volume at which I hear no sound. Put it to a lower value if you still hear some sound (I'm 41 so I already started having hearing difficulty :lol: )
Last edited by immortalx on Mon Oct 26, 2015 7:46 pm, edited 1 time in total.
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Mon Oct 26, 2015 5:07 pm

I have my slider graphics, and the slider button slides with it, but when I make the default sliderbar invisible it does not work anymore even when it is enabled. Has ANYONE made custom volume slider bar? or are you all content with using the ugly construct one?

Howcome every time I ask a question it's like I am the only one trying to do that particular thing?
B
10
S
4
G
3
Posts: 223
Reputation: 3,458

Post » Mon Oct 26, 2015 7:54 pm

If I understand right, you made a custom sliderbar that slides together with a default sliderbar, right?

In my example above there's no need for a default sliderbar, you just put your custom graphics and that's it. Were you able to download the capx?
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Tue Oct 27, 2015 3:17 pm

You are setting the volume with the Square but not vice versa. I will need to display the box AT the current volume.
Also doesn't master volume control sounds, and music? I think I just want volume.
B
10
S
4
G
3
Posts: 223
Reputation: 3,458


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], mikehive, tinhofiel and 35 guests