-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change handling of webaudio radius & volume #14
Conversation
Fixes #13, also made the maximum radius and volume settings much more relaxed at 3x volume and 10,000 source units distance radius. If you want it lower, just set your server or client's convars.
smh
Can you test if this works fine for you? @RanchTheDeer |
For me, these changes cause the stream to play with no volume whatsoever
As I get further away from the stream, the
And I am now able to hear the sound, and it fades away correctly with distance from the origin. Edit 2: If (what is set to be) the stream's parent moves, the sound does move relative to the parent, though is still at a weird position in the sky. Edit 3: Here's the output of a few of the used positional parameters:
The Edit 4: I have resolved the problem. In |
You're most likely using |
Either don't set the position of the stream at all before parenting it or set it to the parent's position in the same tick if you want that normal behavior |
I'm not using |
Could you give a code snippet or something? And are you on singleplayer? Cause I still haven't debugged any behaviors for that.. |
if(webAudioCanCreate(S))
{
TimeIncrement = 1000
PlaybackRate = 1
WebAudio = webAudio(S)
WebAudio:setParent(TargetEntity)
WebAudio:setRadius(2000)
WebAudio:play()
WebAudio:setVolume(Volume)
WebAudio:setPlaybackRate(PlaybackRate)
WebAudio:update()
timer("playNext_1", 100)
} I'm running on singleplayer, yes. |
It's not required, I said |
Ok it's meant to not be required but apparently the code wasn't working my bad, didn't notice I had a setPos in there that basically set it to the same position at the prop to parent to. brilliant |
Ugh, it was because at some point I made self.pos initialize as Vector() instead of nil as it initially was meant to be. Documented it so I don't make the mistake again |
|
Don't set parent_pos if we want to be at the parent prop's position. Avoids constant matrix math.
Current revision of code now behaves as expected; parenting the stream now works correctly and without issue. |
Fixes #13, also made the maximum radius and volume settings much more relaxed at 3x volume and 10,000 source units distance radius. If you want it lower, just set your server or client's convars.