Stereo Sound
Author: | Pete Nattress
|
Submitted: | 24th November, 2002
|
Views: | 5534
| Rated: |
|
|
I discovered this nifty little trick last night and I haven't seen it in any Klick Games. It probably has been, but hey, who cares?
Using the Mixer object (available in TGF and MMF I believe), you can create pretty cool stereo sound effects. Obviously the user must have a two speaker setup, but most people do.
There are two commands which I used, the simple 'Change Wave Left Volume' and 'Change Wave Right Volume'. You change these two, either together or seperately. Using the "Every..." condition, you can fade in and out on one speaker, both at the same time (in opposite ways), or seperately. You can also mute one speaker and have the other full blast, instantly, so if you have a cut scene with two charcters on either side of a room, one could speak on the left and the other on the right.
The values for the change l/r wave volume range from 0-100. Take this brief example:
+ Start of frame
- Play sample whatever 100000 times
- Set wave volume left and right 0
+ Always
- Set value A to "Wave vol left (Mixer)"
- Set value B to "Wave vol right (Mixer)"
+ Every 0.03 secs
+ Value A < 100
+ Value B < 100
- Change wave vol left to "Wave vol left (Mixer) + 1"
+ Every 0.03 secs
+ Value A >= 100
+ Value B < 100
- Change wave vol right to "Wave vol right (Mixer) + 1"
+ Every 0.03 secs
+ Value A > 0
+ Value B >= 100
- Change wave vol left to "Wave vol left (Mixer) - 1"
+ Every 0.03 secs
+ Value A = 0
+ Value B > 0
- Change wave vol right to "Wave vol right (Mixer) - 1"
+ End of frame
- Change wave vol right and left to 100
This creates a cool effect that fades in from the left and then out to the right. Adjust the +1/-1 to make the effect faster.
|
|
Pete NattressCheesy Bits img src/uploads/sccheesegif Registered 23/09/2002
Points 4811
|