I have coded some games for Windows (MonoGame Windows Project) that my brother has tested on Linux through Lutris. All work except one. The problem seems to be a music file (.mp3) which is converted to .wma during compilation and which Lutris does not seem to accept. Is there the possibility to convert a music file into .ogg format instead of .wma?
I’d use Audacity to edit and save/convert to ogg - works for most format types. Then if the file processor in Content is set to ogg, I’d imagine it should work fine. Unless there’s something I’m missing.
I have already done exactly what you say but the .ogg file is still converted to .wma (with its .xnb 1 KB long).
Strange. Maybe worth looking into using a c#.net ogg vorbis streamer like NVorbis?
I just thought of something - I remember someone saying it may create a file type most compatible with the target platform for the content build. You could maybe make a second content configuration just for ogg files and left click on content, go down to properties, and set target platform to another platform where ogg is more ideal and then build it and build other game content in your regular target platform so you don’t accidentally rebuild the ogg’s to wma’s again.
I don’t like the idea of having to use an external library like NVorbis, also because I have looked around the internet and it doesn’t seem easy to use. Likewise, I’m not going to keep two different builds for two different targets. At the moment it is my intention to code games for Windows only, but it is interesting to know that with Lutris you can also play Windows games on Linux, the problem is that .wma files are not accepted. The question remains: is there the possibility to keep the .ogg files (without converting them to .wma) or to load and play .ogg files with MonoGame? If the answer is no, no matter. I do without it.
Did you try out the trick I mentioned? I probably didn’t explain it well - but you should be able to force “Content” to keep the specification of ogg format by changing the platform it thinks it’s targeting (it’ll automatically switch to wma if it thinks you’re targeting a windows based os since it picks the best format for the target platform when converting to xnb). If you click on Content and go down to properties - change platform so it will keep the ogg form in the xnb (probably change to: linux). Once it’s built correctly, you’d need to keep a copy of the new xnb in your local Content folder of your project and specify - no processor and copy only. This way when you change the platform target back to desktopgl or windows or whatever it is, you won’t accidentally overwrite the proper xnb file since it’ll always be copying the ogg version from the local content folder.
I did the following:
- In the properties of Content, changed the platform to DesktopGL (Linux doesn’t exist)
- Built the project (I had to temporarily remove an effect not compatible with DesktoGL before): the “mySong.ogg” and “mySong.xnb” files have been created
- Changed the platform of Content back to Windows
- Set the Build Action of “mySong” to Copy and Processor to No Processing Required
- Built again: the “mySong.ogg” file has been kept but the “mySong.xnb” file has been removed
As a result, when running the project I get the error “The content file was not found”
By the way, when switching to DesktopGL, you can just right click on the new ogg file and click rebuild and it will only build that file.
4/5) Remove mySong.ogg from project (maybe in a backup folder) and add the ogg version of “mySong.xnb” and set it to Copy and No Processing Required. Now you build again and it will copy the mySong xnb to the binary Content folder. If you look in the folder inside bin it should be there after.
Not sure if that’s what you did but that’s what I had in mind. I’ve done that sort of thing before and it worked so I thought it should work.
No, the file isn’t there. And if I copy it manually, when I run the project I get the error “The byte stream type of the specified URL is not supported”.
Oh, I suppose it’s expecting a windows media since the main platform is windows. You’d need to target DesktopGL - in which case it’ll work for both and you probably don’t need to use the trick I mentioned. In that case maybe could start a new project as cross-platform desktop and copy all the files into the new project and build it.
Yes, I suppose that’s the only way, but right now that’s not the priority. Thanks anyway for trying.