-
-
Notifications
You must be signed in to change notification settings - Fork 279
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 Mud Sound Protocol (MSP) Support #3132
Conversation
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
I like the sound of this. |
Coming soon! I will make something nice and simple to test and present the various scenarios. |
I created some tests and have a couple things to resolve. |
Where at? |
This pull request is ready for review after reading the specification here: https://www.zuggsoft.com/zmud/msp.htm. Use the PR version of Mudlet, login to StickMUD, create a character, move two rooms to escape the newbie area, then go up into the tree. Use "pull lever A", "pull lever B" through "pull lever I" to do the testing. The only trouble this is having on Mac at least is that the first time the sound is downloaded it makes no sound, until you pull the lever again. Does anyone have ideas on how we could add some delay in the |
Please review the wiki links:
Please test Client.Media (GMCP) and MSP by logging into StickMUD at telnet://stickmud.com:7680 with a new character, going east, 2 up and trying out this test plan:
delete your media folder under the StickMUD profile
delete your media folder under the StickMUD profile
|
I am not hearing any sound, using the testing version for 211f7d2 commit. lever B and C with telopt download cow.wav but I do not hear it. lever D crashes Mudlet with a segfault. Ubuntu 18.04.3 LTS
|
I found a Windows 10 machine to test on an also had issues playing the cow, lightning and death sounds. The city and water sounds played fine. This could be due to differences in how memory is managed on the other OS's - so I am going to try to harden the code with some more checks. If I could get Windows working 100% perhaps the odds will be in my favor that Linux will be healthy again too. |
tested the latest version, it downloads the files as it should for all three options, but I'm still not hearing any sounds playing with any of them. no longer crashes. |
I removed a lot of unnecessary pointers to make direct references. The only pointers needed were for external resources like QMediaPlayer. I am not sure if that will help this play on more OS yet or not. There is still one known bug where something with a lower priority than what is already playing is being allowed to play (which should not because it is a lower priority). There is a List of TMediaPlayer, which is a wrapper class holding TMediaData and the QMediaPlayer. It looks like the references are getting wiped out after something plays, so it is not possible to compare things right. More troubleshooting needed. |
I resolved the issue with priority and now everything tests out with MSP on Mac. The issue was that I was storing TMediaPlayer objects in the (session) List that were low priority and were never played. By moving that code back to not save the playing TMediaPlayer until the time it was used to start playing something the problem was resolved and now GMCP, lua and telopt MSP are working fine on Mac. I am going to try a Windows run as soon as the build is ready. |
Client.Media, lua and telopt MSP are working now as intended on Mac and Windows! Linux still needs some help, but I believe that is a platform problem and not this PR. |
Latest (hopefully last) changes are good on MacOS and Windows |
I have checked this on Windows 10 as well and it all functions as described. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't finished review and there's a few coding improvements I'd like to see, but it works and has been tested, and that is enough for the experimental preview in Mudlet!
@@ -6678,6 +6678,30 @@ int TLuaInterpreter::sendATCP(lua_State* L) | |||
return 1; | |||
} | |||
|
|||
// Documentation: https://wiki.mudlet.org/w/Manual:Lua_Functions#receiveMSP | |||
int TLuaInterpreter::receiveMSP(lua_State* L) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would handleMSP
be better name for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is sendGMCP, so I made receiveMSP - if we have a handleXXX example elsewhere, then for consistency perhaps yes.
return fileUrl; | ||
} | ||
|
||
bool TMedia::processUrl(TMediaData& mediaData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name is pretty generic and on my first read through, I had no clue what it did except modify state of the host (and for some reason this is done on every MSP call) - confusing :O
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handling could be reconsidered after the dust settles. A couple other functions have Url in the name, and most are bound inside processUrl, so there is a good bit going on within its scope. For the MSP protocol, every call, when combined with "Off" as a fileName, could need some handling. It's not the end of the world, but what we'll see here for games that advertise MSP as a TELOPT, and the player has not downloaded the files manually from their game that only supports zip files, there could be some output in the error log about not being to download a file from www.<thegame.com>/media. Like was done with map downloads, we're suggesting a default Url (undocumented) where one was not set, to try and download the file from.
* Add Mud Sound Protocol (MSP) Support * Adjust URL to http, remove extra return * Resolving code compliance checks * Resolving code compliance checks * Resolving code compliance checks * Resolving code compliance checks * Resolving code compliance checks * Wildcards, CLAZY, slashes, break, nullptr and paths * Resolved directory creation issue, downloads working * Enhanced MSP with QAudio::CustomRole * Backed out QAudio, Possible final revisions * Updated Protocol Preferences in Settings * Code compliance * Code compliance * Code compliance * Trigger Windows & Linux builds * Updated download methodology * Code compliance * Code compliance * Resolving conflict * Code compliance * Introducing TMedia * Code Compliance * Code Compliance * Sets .wav and .mid correctly * Typo resolved * Security checks * GMCP Support * Code compliance * Added lua receiveMSP() * Code compliance * Resolving conflict * Updated CMakeLists.txt * Updated CMakeLists.txt * Updated CMakeLists.txt * Code compliance * Registered receiveMSP * Code compliance * Undo missing GNU * Refined code * Enhance GMCP Support * Enhance GMCP Support * Enhance GMCP Support * Code compliance * Added Suppression * Code compliance * Enhanced suppression * Implemented Priority * Added Validation * Code compliance * Resolved bug * Introducing GMCP.Media * Code compliance * Code compliance * GMCP volume bug resolved * mediaLocation by protocol * List fix * MediaKey constraints * matchMediaKeyAndStopMediaVariants * Code dedupe * Code dedupe * Resolving priority bug * Bug fixes * bool mediaContinue * Trialing Video * Untrialed video * Untrialed video * Removed target (no video) * Minor update * Documentation links * Code compliance * Wiki reference update * Resolve bug in XMLImport.cpp * Fix unintialised TMediaPlayer * Removed pointers * Fixed priority * Removed folder making from tag * Changed sub-directory generation * Adjust label names in preferences
Brief overview of PR changes/additions
Please see the wiki for the best description of what is delivered:
Mud Sound Protocol (MSP) support leveraging QMediaPlayer and QMediaPlayerList for MSP for Lua, MSP via GMCP (Client.Media) and across TELOPT 90.
This MSP implementation is nearly identical to the specification found at the ZMud site.
Mudlet will parse the triggers, download a corresponding sound, store it in the profile for the game in a
media
folder and categorized subfolders, then play it. This has the capability to use wildcards/randomize, repeat sounds, and continue music as mentioned in the specification.Motivation for adding to Mudlet
I am rewriting the world for StickMUD and plan to enhance the experience with more sound, such as changing music files per area / terrain / map as an example.
In a similar way that servers could push UIs and maps, this PR will push sounds and let the server guide how those sounds are orchestrated.
Other info (issues closed, discussion etc)
media
.Please test Client.Media (GMCP) and MSP by logging into StickMUD at telnet://stickmud.com:7680 with a new character, going east, 2 up and trying out this test plan:
delete your media folder under the StickMUD profile
delete your media folder under the StickMUD profile