-
Notifications
You must be signed in to change notification settings - Fork 13
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
Playing a MOD file #2
Comments
Hey there. You should be able to get this done as of 8e0db73. In GDScript you would do: var my_sound = FMOD.sound_load(UUID.new(), "<your-file-name>.mod", Fmod.FMOD_DEFAULT)
FMOD.sound_play(my_sound) I've also updated the documentation with some more code snippets. The Godot integration mainly focuses on Studio functions (for now at least) so not many low level functions are exposed as of yet :) |
That's amazing, thank you. MOD playback is literally the one thing I personally miss in Godot, I'm looking forward to making use of this. So I notice usually we have 2 separate functions, generally in sound libraries, one for quick sound effects, and another for ongoing background music. The example you have there, looks like it's used for sound effects (as per your documentation) AND music (as per your example above), I assume there's no issue with this? |
You can use the example code for quick sounds. For music you can set the mode to Also, for quick sounds there are |
Ah, I assume we wouldn't do "FMOD_CREATESTREAM" unless the file was actually big, and MOD files are usually very small? I'm getting an error with the above code snippit, it doesn't recognise the FMOD_DEFAULT enum I think. I'm a little new to using git, so just to be sure I've updated correctly, below I've pasted the terminal output of how I updated your module and recompiled, that way you can make sure I did it correctly. (Path name is a bit long, so I shortened it before pasting)
And here's my code:
|
It seems Git didn't merge some of the changes because of conflicts. You can stash your local changes using Also I should mention that I've upgraded the FMOD version of the integration to 2.00.00. So you need to download this version of the API from FMOD's website. Just follow the instructions as described here. |
Thanks :) Ok that's weird because I never changed anything - it's possible I saved over the demo project files when experimenting, but certainly not the .cpp and .h files... Ok I restarted and got the latest Godot and godot-fmod. Now compiling gives me this error, any idea what this could mean?
That error occurs about 4 times in different places but I figured it was redundant to paste all of them since they seem to all be the same problem. As far as getting the latest FMOD 2.00.00, I have downloaded it and copied it into the modiles/fmod/api folder again as well. Though the first instruction "You must download FMOD and install it" worries me every time, because I don't know what it means by "installing it". In Windows I'd expect an .exe or .msi to install with, and in Linux (Ubuntu), I'd expect one of those package files you can install with the Software Installer. Is this instruction to "install it" just referring to the copying of the api folder in the later instruction? |
That's quite interesting. I'm not getting this error on MSVC. Using different compilers can sometimes result in compiler errors so I'm guessing this is one of those cases. Can you try updating the module again (make sure it includes 4daf9cb) and see if it successfully compiles now?
They essentially mean the same thing. The installation section describes this in two steps, first to install the API (on Windows it's an installer and on Linux it's just a gzip that you can extract somewhere). The second step is to copy the files to the module's /api directory. |
Ok, I started from scratch, deleted the entire godot source folder and got the latest godot and your fmod module - and I still have compile errors :( Since you mentioned different compilers, it's worth mentioning I'm on Ubuntu and using the relevant compile command for that from the Godot docs - Here is the complete output of the terminal of me doing all this, at this pastebin link https://pastebin.com/FVyPpkAq Here's the start, where I downloaded everything then kicked off the build
And here's the end, where it failed the compile;
Oh and I have definitely copied the fmod "api" folder in. I've downloaded the appropriate linux fmod api "fmodstudioapi20000linux.tar.gz" and copied the contents of its api folder into godot/modules/fmod/api |
Hey there. It seems you have no compiler errors this time. What you got there is a bunch of linker errors. Are you 100% positive you removed any existing files in /api before copying over the FMOD files? because all of those linker errors are associated with functions that were changed on the 2.00.00 update. |
Ah yes, they are linker errors. But no matter how sure I am that I've got the latest files in the api folder, I still get them. I made a 3 minute video showing me flushing out the folder, re-downloading the latest api, putting it in and re-compiling, and still getting the linker errors :( |
I'll have a closer look at this on Linux. It's probably a libpath config issue. In the meantime you can simply revert to a previous commit before the 2.00.00 changes were applied. This commit should play MOD files and it won't have the 2.00.00 changes. Use the FMOD version and API libs that worked for you before. |
Thanks man. Ok did the git checkout you suggested, and downgraded to fmod 1.10.12, and I'm back to the previous "cannot bind non-const lvalue reference" error. Is this something that will be fixed by walking back through fmod versions? Here's me using the git checkout you gave me, then re-compiling, and the error. I've pasted in fmod api 1.10.12 in the api folder.
|
Haha. Yeah I guess going back also reverts "fixes". I should have split those two into separate commits, my bad. In your line 76: FMOD_3D_ATTRIBUTES get3DAttributes(FMOD_VECTOR pos, FMOD_VECTOR up, FMOD_VECTOR forward, FMOD_VECTOR vel);
line 77: FMOD_VECTOR toFmodVector(Vector3 vec); And in your line 458: FMOD_VECTOR Fmod::toFmodVector(Vector3 vec) {
...
line 466: FMOD_3D_ATTRIBUTES Fmod::get3DAttributes(FMOD_VECTOR pos, FMOD_VECTOR up, FMOD_VECTOR forward, FMOD_VECTOR vel) { You should be able to play your MOD file now 🤞 |
Success! My games can have MOD music in them now! Thanks man :) I'm curious to know what happens from here with the Linux linker errors, because I'd like to get your updates in the future. |
I'll have to test it out for myself on Linux when I have the time. If you want notifications for future updates you can add the repository to your Github watch list. |
Just a heads up - I have a suspicion I may have previously put the fmod library files in a system location, and it may be referring to those. I'm thinking this is the case because I'm now trying out a different install of linux and it's complaining it can't find the library files at all, even though I'm using the same folder as previously. So it was probably ignoring that fmod/api folder entirely and using older library files that I'd previously placed in the linux system folder for libraries. (usr/lib or something) |
Ahah - I remember what I did - that's the issue with the instructions that I was mentioning earlier. In step 1, where it says "Download the FMOD Studio API (You need to create an account) and install it on your system.", I took this to mean I had to put the library files somewhere. So I looked up where to put them in a Linux system and did that! If "installing it" is already covered in step 4 when you copy the api folder, I would suggest removing "and install it on your system" from step 1. |
Hey there! Thanks for letting me know. I noticed that there is a slight issue in the build config file and it is not specifying the correct libpath for Linux. It worked for you earlier because the linker searches for the libs firstly in the LIBRARY_PATH env variable and if it does not find them it will then proceed to check the usr/lib folder which in your case was where it eventually found them. I pushed a fix e6f0293 that should hopefully solve all the linking errors.
On Windows (and on macOS as well I believe) it's an installation package that you need to run. On Linux though it is just an archive with the lib files. I guess I'll update the docs to reflect this to prevent any sort of confusion. |
Awesome! I'll try updating soon. Heh, I guess I'm your Linux QA for the moment. So after the update, it should look in godot/modules/fmod/api? |
Yeah, it should look in that directory now. Let me know how you go. |
Sorry, this is the only way I can see to ask this kind of question. Godot is compiled, and the demo project works!
But none of the examples show me how to just play a simple file from the hard drive - all the examples use "banks".
In C++ it's pretty straight forward; system->createSound("path to sound", &sound) gives you a pointer to the sound, which you play with system->playSound(sound). But I can't see any equivalent functions available from the Fmod Godot object.
Specifically I have those old MOD "tracker" songs and I want my games to be able to play them. S3M, MOD, IT, XM etc. It's the sole reason I'm using your module :)
The text was updated successfully, but these errors were encountered: