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

[E2 addon] Suggestion - bass error flags and webaudio_maxfilesize sv convar #65

Open Zylenxx opened 1 year ago

Zylenxx commented 1 year ago

The current addon seems to lack any bass error flags when all the other webaudio flags pass. Been trying to test it for about 2 to 3 hours now and none of the files properly open and always return BASS_ERROR_FILEOPEN. Other addons off-e2 that utilize webaudio aswell have no issues whatsoever, so i am asking for additional flags , namely:

wa_max_filesize client replicated server_can_execute

to have a maximum filesize the server can set , and for the functions internally for e2: Number=webAudioErrorType(webaudio) which would fetch BASS_ErrorGetCode and return the number that it has gotten (see this link for info) and Number=webAudioDidError(webaudio) which returns 1 incase any of the errors were raised and 0 if not.

Vurv78 commented 1 year ago

I'm not sure what you mean by "bass error flags" vs "webaudio flags"

wa_max_filesize wouldn't be possible unless you did an http request before sending bass to get the sound, which is pretty awkward. And your issue with BASS_ERROR_FILEOPEN is likely from malformed urls pointing to non-audio sources. For example, dropbox urls are often incorrect, and addons like starfall fix them automatically for you, but webaudio currently does not, which might be why you get this error on webaudio, but it works fine on other addons.

As for webAudioDidError, webaudio already automatically detects if it errored on your client, and sends it to the server, in order to mark the webaudio object as invalid. So you could just periodically check if xwa:isValid(), or wrap your code in a try catch for whenever it isn't valid.

It's not elegant by any means, since WebAudio is all done asynchronously through communication between clients and the server through the net library, the only maybe improvement that could be done would be adding events like waErrored(Obj:webaudio, Msg:string) and waReady(Obj:webaudio). Although 90% of webaudio behavior would already work just fine before waReady (currently the only thing that wouldn't is getting the length, since only the client would know that.)

For webAudioErrorType, maybe number webaudio:getErrorCode() could be a thing.