Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Another sound issue.....

Author
Message
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 14th Mar 2011 16:29
I am making a space game and the ship makes a "thruster" sound when it moves. The volume varies in volume with respect to speed of the ship. The problem is that it's not consistant. Sometimes I can get the variation to work and sometimes it just cuts out and I hear nothing. Sometimes it doesn't change volume.... blah, blah, blah....
Here's part of my HUGE program that deals with that sound:

Any thoughts?

The fastest code is the code never written.
TerryRussell
13
Years of Service
User Offline
Joined: 11th Dec 2010
Location: Chichester, UK
Posted: 14th Mar 2011 20:08 Edited at: 14th Mar 2011 20:11
So, you want the sound to get louder as your mouse cursor gets towards the bottom right of the screen. And less loud as the cursor goes upwards or to the left.

Is that correct? (Because that's what your code says).

As an example, my screen is 1920 x 1200 pixels wide. Using your calculation method, if my cursor is at the bottom right, then

mx*mx=3,686,400. (2920 x 1920)
my*my= 1,440,000 (1200 x 1200)
Adding them gives 3,830,400
The square root gives 1,957 (as an integer). You cap this to 100.

But as you go to the left or upwards, the sound level will drop below 85, which seems to be the quietest that I can hear on my system.

Mathematics is the answer!

Amazing Simulation
www.amazing-forum.com
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 15th Mar 2011 05:15
I figured it out.

Apperantly if the sound goes above 100, it becomes unreliable.... I put better code in my post than I had in my game.
Speed is a float of 0.0-1.0

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-09-28 12:44:07
Your offset time is: 2024-09-28 12:44:07