-
Notifications
You must be signed in to change notification settings - Fork 5
iOS Sound Processors
MonoGame now supports sound compression. To get it working you will need to switch your content build process to use the new MGSongProcessor and MGSoundEffectProcessor.
Note: MGSoundEffectProcessor doesn't currently compress sounds, but passes them through. This is a work in progress. MGSongEffectProcessor will compress your game music into .mp3 format.
There are a couple of steps for generating and using compressed sounds on iOS
- Build the appropriate content processors
- Create a project with an IOS Build Configuration
- Reference the new content processors in your content project
- Build new, compressed content
Open the MonoGame.ContentPipeline/ContentProcessors/MonoGameContentProcessors.sln file in Visual Studio and build it.
There are other ways to do this, but we found that creating a separate "dummy" project was quickest and easiest.
For this method you will have your normal MonoGame/iOS solution for your game as well as a second solution solely for building iOS-appropriate content. I copied the original MyXNAGame.sln for our game and replaced the actual MyXNAGame.csproj with a new, empty C# project for a library. Add a content reference to your content project in the new dummy project so you can build content with this new solution.
After this is done, open the new, dummy.csproj in a text editor and add a new PropertyGroup with it's Configuration set to "IOS" as well as it's output path. It should look something like this.
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'IOS|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\IOS\</OutputPath>
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants> ... etc etc
Make sure that your solution has set the dummy project to use this new build configuration. Open your Configuration Manager in Visual Studio and make sure that the dummy project's configuration is set to "IOS". I found it easy to create a build configuration for the solution itself in the configuration manager, but you may choose not to.
Now you need to set up your content project to use these new content processors. First add a reference to your game's Content Project to the .dll that is built by the MonoGameContentProcessors project.
(Note, this project requires lame_enc.dll in the 3rd party folder and the yeti.mmedia.dll, yeti.mp3.dll, and yeti.wmfsdk.dll built from the MonoGameContentProcessors project.)
Close Visual Studio and open up your Content Project in a text editor. You'll want to replace any songs that use XNA's SongProcessor with the new MGTextureProcessor, as well as replace any SoundEffectProcessors with MGSoundEffectProcessor.
Reopen your new "content building" project and make sure that it's build configuration is set to IOS. (Or at the very least, that the current solution's configuration allows the dummy project to build for "IOS"). Do a full rebuild on this project. If you're working with a lot of textures this part may take a little bit.
When this is finished you should have a Content folder in your bin/IOS/ folder with PVR compressed textures. Copy these to the appropriate place in your iOS application's package.