Vurv78 / WebAudio

A safe, efficient and powerful replacement for Streamcore that adds playing & manipulating URL streams through IGmodAudioChannel/BASS
https://steamcommunity.com/sharedfiles/filedetails/?id=2466875474
MIT License
18 stars 3 forks source link

Non-E2 support via integration with Sound Emitter, SPU. #54

Closed chexo3 closed 1 year ago

chexo3 commented 2 years ago

Is your feature request related to a problem? Please describe. Some servers don't let new users use E2. This is reasonable. On the server I play on, cool people who the current users like get the User role with E2 perms. I am not yet Cool.

Describe the solution you'd like I've always really liked chip/gate solutions a bit more than E2, E2 is great, but it's a bit overkill for some things, and I like wiring things together. I also really like the ZCPU/ZGPU/ZSPU chips and have been trying to learn more about them. I'd like to see a "WebAudio" tab added to the Sound Picker for the Sound Emitter, and similar for the SPU (not sure how the Z SPU works yet, have not got a chance to try anything with it) so that I can add URLs. There should be some sort of validation, coloring the input green when a valid URL is input, yellow when an invalid input is there, and red when a non-whitelisted but otherwise valid URL is there. There should be text boxes explaining this also so new users don't get confused.

Describe alternatives you've considered I can stick to sounds that are part of Garry's Mod itself, and have access to those via Sound Emitter or SPU. Or I can write E2 glue code, maybe? But it'd be much easier to be able to do it without those. Could also have a WebAudio gate as an alternative to adding a tab to the existing Sound Emitter and SPU. That would probably be easier to code.

Additional context Apparently the SPU is good at sampled audio. If I could load a file from a URL with a bunch of samples, I could then play those samples by seeking through the audio file! It'd be nice especially if this integration was good at playing specific sections from a loaded file, without playing past a certain section or skipping, although you may have to change from thinking of the audio URL as a stream to thinking of it as a discrete file. So for a live stream you'd probably have to record and cut parts of it to put in memory. It'd be nice if this kind of functionality showed up on the E2 side too of course, so this would probably help E2 users too.

chexo3 commented 2 years ago

It may also be useful to have a non-wiremod option, even. Not sure how that would work but could be useful for complete noobs. I probably wouldn't use it though.

Vurv78 commented 2 years ago

The cpu/gpu/spu have no support for modding or extensions which is why none exist right now. And as far as I know the gpu and spu run clientside, so it should be pretty easy to add bass / url playing functionality, but this would need to be done in the wiremod repo.

WebAudio was made because E2 is entirely serverside, so you need a way to manage a clientside object on every single player at once on the server. There's kind of no point if the spu is already clientside (Not sure if this is true need to look into it)

Now making an emitter sort of object separate from wiremod could work. Since WebAudio is based off an internal (g)lua library I could make a separate addon for webaudio entities, since I'm not sure if adding them to this addon would be a good idea as it's presented as an e2 extension.

So tldr I will look into these suggestions but most likely can't do much about the cpu and there's not really a point, (same reason why I haven't added a starfallex extension, because it already supports bass streams clientside which webaudio uses internally)

chexo3 commented 2 years ago

ah. I'm not very familiar, bass is that audio library binary module, right? I mainly just want a way to play URLs from my SPU or the wiremod Sound Emitter, like you can already do with E2s. Would it make sense to ask for this feature over there instead?

Vurv78 commented 2 years ago

I'm not very familiar, bass is that audio library binary module, right?

BASS is what gmod uses for (advanced) audio with the IGmodAudioChannel class, which is what the sound.PlayURL function gives

Would it make sense to ask for this feature over there instead?

Considering the SPU doesn't support extensions yeah.

I mainly just want a way to play URLs from my SPU or the wiremod Sound Emitter, like you can already do with E2s

But with the answer from before, the SPU was never meant for this kind of stuff. It's for making sounds itself not playing sound files, which it doesn't support. If it did that'd defeat the purpose since anyone could just play random music. Also that'd make server owners look for a way to disable the SPU.

I say to play a server that doesn't lock E2 because it adds 500 exploitable extensions they're scared of users having, or tries to sell access to it. Or tell the owner this..