ID:273475
Jun 2 2010, 1:49 am (Edited on Jun 2 2010, 7:07 am)
|
|
Apparently the main problem was in other modules of my project so the code written here is removed to avoid confusion it could give to other users. I still didn't figure out how to make real 3d music or determine a music file's length, but I've learned how to make sound zones and use it for now to start/stop sounds. Thank you :). | |
Leur wrote:
Taken from the Reference: Sorry, I must be doing it wrong... Doesn't default value of 1 cause it already to fade? But I don't see this behavior, I tried to change S.falloff but it defines nothing. I think the key phrase is "a 3d sound". Does it mean that mine is not 3d? How should I set it up properly? | |
That's what I try to do:
<code> proc playit() set src in view() var/sound/S = new/sound('midnightride.wav',1) if(b_broken) return else src.sd_SetLuminosity(1) icon_state = "on" S.x = src.x S.y = src.y S.z = src.z S.falloff = 10 view() << S </code> But it doesn't work so it looks like I forget something. The falloff here only changes the loudness of the sound. When I move nothing changes, and I can move away a few screens and still hear it at the same volume. | |
Actually, I'm lost, sorry ^^;
Look through here: http://www.byond.com/members/ DreamMakers?command=top_search&text=Sound&type=resources | |
Thanks, I will check it out.
It looks like there's no easy way to make a 3d music. Heh, I will see what can I do. Btw is there a way to check the length of the audio file? I want the jukebox to stop flickering when the audio ends. | |
Okay, I've decided to go with a simple route: assign a room where the music is played, doh.
How to check if the user is still in area? I want to call Exit() . = ..() if(.) if(<usr in area>) usr.client.sound_system.SetMusicVolume(0, 3, 50) What should be the "usr in area" check? It's not usr.loc. | |
Used an /area Entered() and Exited():
| ||
GhostAnime wrote:
Used an /area Entered() and Exited():
This one prodices errors unless I specify M :P. The problem is that whenever I move WITHIN the area, it still thinks that I move out of a tile with the area so it switches the sound off. I think I should check each step if I am STILL in the same area, and I can't figure out how to make it. P.S. Apparently the Dynamic Lightning system by Whenever I move inside darker/brighter areas it triggers some strange thing. Right now I have two zones - bar and exit, and it triggers volume 100 on bar entering and volume 0 on exit entering. Still while I move between differently lit areas in the bar, it triggers the Enter() code for exit(!) which is not even close, so it toggles the music. I guess I have to withdraw and postpone my idea of musical jukebox for a while. I wonder why does dynamic lightning system do it :P. | ||
Sorry for the wall of text, I am a bit uncertain in my words because I haven't slept for a long time.
The problem with the weirdness came from a Dynamic Lighting system which caused really weird zone behavior (i.e. triggered entered()/exited() processes for wrong zones). For now I find it right to get rid of the lighting system which I can'd find errors in (there're definitely some errors which cause some errors when you move with multiple light sources etc.) until I can write my own which should (hopefully) work :P. Thank you very much to all who replied. Because of you I've managed to find a few good sound systems and learned from the sources you provided a lot. I hope in the future I will provide better questions and maybe some answers. Kudos. | |
The dynamic lighting system was almost certainly splitting a single instance of an area into multiple instances, and giving each one a different "darkness" icon to achieve the lighting effect. The workaround would be to use istype() to only perform an action if the areas are different, so:
| ||
Garthor wrote:
The dynamic lighting system was almost certainly splitting a single instance of an area into multiple instances, and giving each one a different "darkness" icon to achieve the lighting effect. The workaround would be to use istype() to only perform an action if the areas are different, so: I forgot to add the check for "null" so it was spitting out errors when I tried to make such things. With such a simple check it works :). Thank you very much. | ||
falloff var (sound)
See also:
vars (sound)
x, y, z vars (sound)
Default value:
1
Within the falloff distance a 3D sound stays at the constant loudest volume possible. Outside of this distance it attenuates at a rate determined by the falloff.
Higher values will make sounds fade out more slowly as they get farther away. The distance of a sound is set by x, y, and z.