-
Notifications
You must be signed in to change notification settings - Fork 162
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
Add ability to play sounds via Lua for party mode plug-ins. #856
Conversation
For example, "Hold the line" wants to play the "dismissed" sound. Warning: Was tested only with Linux and Lua 5.3.
Still crashes the game, though.
I finally had time to give this a first quick review; I'll do a more thorough one later on where I'm also going to read all the documentation comments etc. I'll admit seeing 51 files modified scared me a bit at first, but the majority of them is just trivial music references. I don't really like the I also can't quite figure out if Lua's Alternatively maybe Lua can work with only one function, |
Thank you for your time.
Indeed, while I was messing with the other Lua stuff, I was looking for a trivial way to play a sound via Lua. Then I noticed this TODO and thought "I can do that". Then I was kind of getting carried away. 😅 I have no idea if my proposal is "good" in any fashion. I only know my use-case (casual karaoke party). I do not have a broader overview of the likings of the user-base. If it is just about the log output, I can easily remove that.
That kind of… happened. I noticed the sounds are identified by their file-name (or more exactly the file-path). I do not really like introducing arbitrary numerical IDs – we already have the string to identify a sound. After I implemented that, I noticed that the lookup-method is also able to load the requested file on the fly. This gives some resilience when someone forgot to explicitly load a sound before trying to use it. But it can be regarded as bloat, I see that.
Yes, putting them in line is a good idea. I was unsure on how to proceed and getting some feed-back by an experienced maintainer seemed to be in order.
I can do that. Then we would have the core sounds in the public fields of
This may sound daft and is an unrelated question, but… how to use plug-ins outside of party mode? I have read it in comments, but I never saw an option for that (neither in the GUI, nor in the code). |
I think if you want to not have loading delays when playing sounds from Lua, you'll probably need to have the load/play/unload functions all available to Lua. If we can give every plugin its own There might need to be an extra layer created somewhere.
That said, more/working hooks would also be a solution, but I'd need to think about which way this should eventually go. I use this for things like a song log, showing the most recently played x songs, sending information about the current song and progress to an external script (that 'happens' to then send stuff to a lighting console). During 2020/2021 I was able to reliably 'share' the singing screen over the internet with stupidly little delay (think 80ms of which 50-60ms was just ping). It places more responsibility on the plugin developer this way; Party Mode relies on magic stuff ( |
That would probably be commit f61bc1c, however I would need to to is move the array declaration from UMusic's TSoundLib to ULuaCore's TLuaPlugin. No other parts of the code would be changed (and this TODO remains unresolved, but I can live with that). I will close this pull request and come up with another one. Thank you for sharing your insights about plug-ins. I want to look into the hooks a bit to form a more sophisticated opinion. This pull-request comment does not seem to be the right place for brain-storming/discussions. What is the best place to reach you? |
For example, "Hold the line" wants to play the "dismissed" sound.
I do not know if the restructuring I did appeals the devs here. I am up for a code-review and discussion.
Warning: Was tested only with Linux and Lua 5.3. If some developer on Windows could check compatibility, that would be great.