Control Volume

Get help using Construct 2

Post » Sun Sep 23, 2012 6:27 pm

Hello,

I have a huge difficult to figure out how implement a Volume System.

My research pointed for this:



But |>sound ""| is suppose to edit the sound volume of the last sound, right? and how I can setup the volume for the entire project?

This code is working fine, but it don't update the volume while it's playing, I need to re-play it to update the volume =\
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276

Post » Sun Sep 23, 2012 10:27 pm

Have you included it in the other event sheets?
B
18
S
9
G
5
Posts: 77
Reputation: 4,946

Post » Sun Sep 23, 2012 10:31 pm

For sure @lonehangman, you can test it alive to see how it's not updating the currently running sounds, only new triggered sounds update the volume =\

http://goo.gl/TCWPp

I'll rework the entire sound system to make it simpler, because it's becoming a headache ~~

After deleting the Stop tag, still the same result.

But thanks anyway.TELLES08082012-09-23 22:36:47
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276

Post » Sun Sep 23, 2012 10:36 pm

Hi TELLES0808 :-)

I can't help you with your sound problem.. But I just want to tell you that the game is great, fun to play, some nice effects and cool art - Good job! :-)
B
10
S
1
G
1
Posts: 30
Reputation: 1,339

Post » Sun Sep 23, 2012 10:54 pm

Is there a reason why you put them all as a sub event for "every tick" ?

And you can put "System: Set "" volume to master_volume db" to every tick event. There is no point to duplicate that event.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Sun Sep 23, 2012 11:10 pm

[QUOTE=shinkan] Is there a reason why you put them all as a sub event for "every tick" ?

And you can put "System: Set "" volume to master_volume db" to every tick event. There is no point to duplicate that event.[/QUOTE]

No reason @shinkan, I just like to update the code every tick. But the code as main events give the same result.

There are different frames, which one represent +, -, etc, that's not duplicated or double checking events, the set there is to set the "Volume" text percentage on the screen.

Frame 0: +
Frame 1: -
Frame 2: Sound activated
Frame 3: Sound deactivated
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276

Post » Sun Sep 23, 2012 11:29 pm

[quote]There are different frames, which one represent +, -, etc[/quote]
It doesn't matter. "master_volume" is a global variable so "System: Set "" volume to master_volume db" refers to global variable.

Every tick -> System: Set "" volume to master_volume db

means
if you set master_volume do 1 then volume will always be 1
if you set master_volume do 5 then volume will always be 5


You only need to specify when to add or subtract values from that variable.


It's like for example opacity for a sprite

gv "spr_op = 50"

button up -> add 20 to spr_op
          -> set sprite.opacity to spr_op

button down -> subtract 20 from spr_op
          -> set sprite.opacity to spr_op

this is equal to

gv "spr_op = 50"

every tick -> set sprite.opacity to spr_op

button up -> add 20 to spr_op
button down -> subtract 20 from spr_op
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Sun Sep 23, 2012 11:38 pm

[QUOTE=shinkan] [quote]There are different frames, which one represent +, -, etc[/quote]
It doesn't matter. "master_volume" is a global variable so "System: Set "" volume to master_volume db" refers to global variable.

Every tick -> System: Set "" volume to master_volume db

means
if you set master_volume do 1 then volume will always be 1
if you set master_volume do 5 then volume will always be 5


You only need to specify when to add or subtract values from that variable.


It's like for example opacity for a sprite

gv "spr_op = 50"

button up -> add 20 to spr_op
          -> set sprite.opacity to spr_op

button down -> subtract 20 from spr_op
          -> set sprite.opacity to spr_op

this is equal to

gv "spr_op = 50"

every tick -> set sprite.opacity to spr_op

button up -> add 20 to spr_op
button down -> subtract 20 from spr_op [/QUOTE]

Oh, you're talking about the trigger method. It's vestige of a bug already solved by @Ashley on R104 (click here), but I didn't changed the code because I recently updated to the R104.

But changing it have no effect on the sound volume of playing sounds in this project, so I'll start again from scratch and search for any mistake I did on the code, also, organize the triggers again, because that bug did a lot of troubles with double checking, as I said here: http://www.scirra.com/forum/forum_posts.asp?TID=56907&PID=356424&title=pick-in-subevent-bug#356424
ImageImageImageImageImageImage
B
92
S
19
G
12
Posts: 1,192
Reputation: 18,276


Return to How do I....?

Who is online

Users browsing this forum: Magistross and 1 guest