PDA

View Full Version : Uhm...


KuJi
01-15-2006, 07:37 PM
Is their a way to make it so if your close to an npc that is streaming a song you will hear it louder, and if you walk away it will go lower. :O

Yen
01-15-2006, 08:56 PM
setmusicvolume(left,right); changes the volume. I haven't used it, though, so I don't know how left and right work. I'm assuming left brings it down, right puts it up?

Rick
01-15-2006, 10:42 PM
No... left/right as in left/right speakers.

Values are most likely 0-100.

ZeLpH_MyStiK
01-15-2006, 10:50 PM
Then use the distance formula! =D

ApothiX
01-16-2006, 03:47 PM
play2 filename,x,y,volume; plays a sound/music at x,y with the specified volume
(1=default volume)
I believe this function changes the volume depending on how far away from x,y the player is.

ZeLpH_MyStiK
01-16-2006, 04:39 PM
I think if you ran that function more than once, it would just play the file over again. Not sure.

KuJi
01-16-2006, 07:52 PM
Right, so which answers correct? :O

jake13jake
01-16-2006, 09:49 PM
Then use the distance formula! =D
Well... partially the distance value. If you want it to be realistic... gotta use 1/d^2.

Yen
01-16-2006, 10:04 PM
$pref::graal::midivolume
$pref::graal::mp3volume
$pref::graal::sfxvolume
$pref::graal::radiovolume

You could try modifying these, but they effect all sounds, not just that one sound. I was playing the option variables, but I found that some of them didn't apply until I restarted Graal.
If you don't want to modify the volume of all sounds, I suggest using the setvolume function.

adam
01-16-2006, 10:09 PM
play2 filename,x,y,volume; plays a sound/music at x,y with the specified volume
(1=default volume)
I believe this function changes the volume depending on how far away from x,y the player is.

That plays it as if it were coming from x,y. If you are further away it will be softer, if you are at x,y it will be quite loud.

I used it for fireworks once. I wish I could find those. :( They were on DD a long time ago.

ZeLpH_MyStiK
01-17-2006, 04:31 AM
Well... partially the distance value. If you want it to be realistic... gotta use 1/d^2.
Since you put it that way, why not include the npcs, and certain tiles that block the sound into the equation as well ;)

jake13jake
01-17-2006, 05:08 AM
Since you put it that way, why not include the npcs, and certain tiles that block the sound into the equation as well ;)
because there's no way of knowing the density or height of a tile :P.

ZeLpH_MyStiK
01-17-2006, 06:22 AM
because there's no way of knowing the density or height of a tile :P.
Estimate?
density = mass / volume

jake13jake
01-17-2006, 06:48 AM
Estimate?
density = mass / volume
uhh, what I'm saying is that it makes more sense to go by the distance of the focus rather than where the player is.

KuJi
01-17-2006, 06:56 AM
O.o, wait wait.

So now you guys are making it not go through walls, but find a lil crack somewhere to get to me? lol.

ApothiX
01-17-2006, 03:41 PM
That plays it as if it were coming from x,y. If you are further away it will be softer, if you are at x,y it will be quite loud.

I used it for fireworks once. I wish I could find those. :( They were on DD a long time ago.
That's what this thread is about, and what's why I suggested it ;)

adam
01-19-2006, 07:10 AM
That's what this thread is about, and what's why I suggested it ;)
I must have been tired when i said that. :/

Anywho, I dont' think it will work for songs.

Admins
01-20-2006, 04:18 PM
Is their a way to make it so if your close to an npc that is streaming a song you will hear it louder, and if you walk away it will go lower. :O

For looping wavs: call playlooped all few moments to update the position of the sound, the volume will automatically be adjusted depending on the position of the npc on the screen

For music: eventually save the position where the music should be loudest (position of the radio npc or so) and then change the music volume with setmusicvolume all few moments (0.05 seconds) depending on the distance of the player to the distance of the music source / radio npc.
This kind of system is also good for environmental sound effects, we are using that for the ocean sound on Era and the shephard melody on Kingdoms (xmas quest), changing the volume depending on the distance to the source (with play2).