2 registered members (AndrewAMD, Quad),
755
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: ambience sounds fade in/out
[Re: CodeMaster]
#413676
12/16/12 10:58
12/16/12 10:58
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
This looks so awful, when people ask something simple as this without even reading the fucking manual by themselves (or doing tutorials). And I hate to realize, that once upon a time, I was doing this myself.. There is nothing have to deal with master volume! (as it is master, it will decrease the volume of the whole game!), all you need to use is "ent_playsound" (and probably "ent_playloop"), read the manual for such simple stuff please, if you want to learn anything: ent_playsound ( ENTITY*, SOUND*, var volume): handleAs if this isn't what you want (for example you need rain sound, which will fade in slowly, and then play with constant volume), you need to do something like this:
var rain_handle_snd = 0; // pointer to the rain sound
var rain_volume_snd = 0; // volume of the rain sound
SOUND* rain_wav = "rain.wav"; // rain sound file itself
function handle_rain(){
// play rain sound in a loop:
rain_handle_snd = snd_loop(rain_wav, 0, 0);
// endless while loop:
while(1){
// if we need to increase it:
if(rain_volume_snd < 50){
// then increase it:
rain_volume_snd += 2 * time_step;
}
// tune the volume of the rain:
snd_tune(rain_handle_snd, rain_volume_snd, 0, 0);
// wait one frame:
wait(1);
}
}
|
|
|
Re: ambience sounds fade in/out
[Re: CodeMaster]
#413684
12/16/12 12:15
12/16/12 12:15
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
CodeMaster@ would you please stop trolling and take a look at ent_playloop already?? All you need to do is simple this!
action fucking_river(){
ent_playloop(my, river_fucking_sound, 500); // play with 500
}
Attach this action to your RIVER (or whatever) and you are good to go.
|
|
|
Re: ambience sounds fade in/out
[Re: MasterQ32]
#413688
12/16/12 12:35
12/16/12 12:35
|
Joined: Dec 2002
Posts: 3,363 Vindobona (Ostarichi)
Harry Potter
Expert
|
Expert
Joined: Dec 2002
Posts: 3,363
Vindobona (Ostarichi)
|
i don't understand your problem the code 3run posted does exactly what you want to hear I think the problem is that he wants to use ent_playloop or ent_playsound for a VERY LONG entity (e.g. a river). He could place some dummy entities along the river - each of them playing an ambient sound. But then the sound will not be constant when walking along the riverside. I think the problem is: When using ent_playsound or ent_playloop the audio source is point-like, and can not be a whole surface.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|