Linear Volume control

Get help using Construct 2

Post » Tue Dec 17, 2013 5:52 pm

I have a control bar that return a value between 0 and 1 (0 = lowest volume (aka : mute), and 1 = highest volume; We'll call this value V), but C2 uses decibels (we'll call it G);

I did the formula:

G = x*10*log(V)

I found out that x ~= 10/3 ; but I don't understand if this is normal that x is different from 1, is that normal that there is a coefficient?

EDIT: of course, if V = 0, the action will not occur, I don't want a math error because of -infinityAphrodite2013-12-17 17:53:36
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Tue Dec 17, 2013 6:20 pm

Would this formula help to calculate your output based on your input?

(x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 17, 2013 6:43 pm

[QUOTE=LittleStain] Would this formula help to calculate your output based on your input?

(x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min[/QUOTE]

@LittleStain : I already have a working bar that returns an output in a workable value (from 0 to 1)

And the formula between output in dB and input in % is not linear (so it is not as simple), I found the result as I said, the problem is I don't fully understand it (I found it because I know how it works, which is not really simple to know I must say)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123


Return to How do I....?

Who is online

Users browsing this forum: Christmas, dop2000, Hyune and 15 guests