Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Quad), 755 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
ambience sounds fade in/out #413673
12/16/12 10:49
12/16/12 10:49
Joined: Oct 2010
Posts: 73
0110111
C
CodeMaster Offline OP
Junior Member
CodeMaster  Offline OP
Junior Member
C

Joined: Oct 2010
Posts: 73
0110111
i need idea how create a code that will play ambience sounds when the player approaches, such as rivers, burning fire, waterfalls, and of course, when a player is moving away then the volume decreases. All this i have connect later with the master volume variable

Re: ambience sounds fade in/out [Re: CodeMaster] #413675
12/16/12 10:51
12/16/12 10:51
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
just take a look at ent_playsounnd and ent_playloop


Visit my site: www.masterq32.de
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 Offline
Senior Expert
3run  Offline
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): handle
As 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:
Code:
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);
	}
}



Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: ambience sounds fade in/out [Re: 3run] #413679
12/16/12 11:38
12/16/12 11:38
Joined: Oct 2010
Posts: 73
0110111
C
CodeMaster Offline OP
Junior Member
CodeMaster  Offline OP
Junior Member
C

Joined: Oct 2010
Posts: 73
0110111
3run i think you not understand me, code you gave me is really simple but this is not what i need. Just imagine that we have a river in level and when the player gets closer to the river, volume begin increases, but only for the value of what a player is away from the river. The same thing happens when we turn away from the river. I was trying to find the right formula something like 100 - distance_player_of river = river_current_sound, and later this current sound i need to change in game/volume options.
I don't know how other peoples solve this problem, i know there are a wed sounds, but i think this can't help?

Re: ambience sounds fade in/out [Re: CodeMaster] #413680
12/16/12 12:01
12/16/12 12:01
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
i don't understand your problem
the code 3run posted does exactly what you want to hear


Visit my site: www.masterq32.de
Re: ambience sounds fade in/out [Re: MasterQ32] #413682
12/16/12 12:10
12/16/12 12:10
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
CodeMaster@ you don't need to recreate bicycle once again, as it already exist. Use "ent_playloop", with the pointer to your river.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: ambience sounds fade in/out [Re: MasterQ32] #413683
12/16/12 12:11
12/16/12 12:11
Joined: Oct 2010
Posts: 73
0110111
C
CodeMaster Offline OP
Junior Member
CodeMaster  Offline OP
Junior Member
C

Joined: Oct 2010
Posts: 73
0110111
did you see in 3run code that rain_volume_snd all time goes up if is above 50? when player stop moving, volume decrease/increase must stop

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 Offline
Senior Expert
3run  Offline
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!
Code:
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.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
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 Offline
Expert
Harry Potter  Offline
Expert

Joined: Dec 2002
Posts: 3,363
Vindobona (Ostarichi)
Originally Posted By: MasterQ32
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.


Re: ambience sounds fade in/out [Re: 3run] #413690
12/16/12 12:42
12/16/12 12:42
Joined: Oct 2010
Posts: 73
0110111
C
CodeMaster Offline OP
Junior Member
CodeMaster  Offline OP
Junior Member
C

Joined: Oct 2010
Posts: 73
0110111
yes right!

Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1