{"id":27972990,"url":"https://github.com/martenfur/fmodforfoxes","last_synced_at":"2025-05-16T17:09:38.251Z","repository":{"id":47023841,"uuid":"182452985","full_name":"Martenfur/FmodForFoxes","owner":"Martenfur","description":"Cross-platform C# FMOD wrapper.","archived":false,"fork":false,"pushed_at":"2024-11-21T23:46:20.000Z","size":102672,"stargazers_count":123,"open_issues_count":2,"forks_count":17,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2025-05-16T17:08:56.454Z","etag":null,"topics":["audio","fmod","monogame","monogame-framework"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Martenfur.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-04-20T20:47:04.000Z","updated_at":"2025-05-12T13:22:22.000Z","dependencies_parsed_at":"2025-05-07T23:37:33.968Z","dependency_job_id":null,"html_url":"https://github.com/Martenfur/FmodForFoxes","commit_stats":null,"previous_names":["gnfur/chaifoxes.fmodaudio"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Martenfur%2FFmodForFoxes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Martenfur%2FFmodForFoxes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Martenfur%2FFmodForFoxes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Martenfur%2FFmodForFoxes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Martenfur","download_url":"https://codeload.github.com/Martenfur/FmodForFoxes/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254573589,"owners_count":22093731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","fmod","monogame","monogame-framework"],"created_at":"2025-05-07T23:21:48.862Z","updated_at":"2025-05-16T17:09:33.241Z","avatar_url":"https://github.com/Martenfur.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿\n\n![header](/pics/ebites.png)\n\n\n[![nuget](https://badgen.net/nuget/v/FmodForFoxes?icon=nuget)](https://www.nuget.org/packages/FmodForFoxes)\n\n### Current FMOD version target: 2.02.25\n\n[**Join our Discord**](https://discord.gg/EtJexdZs77)\n\n\nThe time has come. You're finally witnessing a high-level cross-platform C# library, which makes Monogame and FMOD best friends.\n\nIn case you've come here and the only thing you've understood so far was the doge meme, [FMOD](https://fmod.com) is a powerful cross-platform audio engine, which is pretty much the only hope to have any decent audio in Monogame. \n\nThe catch is - FMOD is written in C++, and unless you're using Unity, you're only getting a bare-bones C# wrapper. No tutorials, no setup guides. Only you and DllImport.\n\n![send help](/pics/help.png)\n\n\nThat's why this library exists. It does the tough part for you and provides a basic high-level interface. \n\nAlso note that even though the primary target of this library is Monogame, you can easily adapt it for any other C#-based project.\n\n## Setup\n\nThe initial setup is a little fiddly. Here's the thing - the FMOD license prohibits me from distributing their libraries in my Nuget package - so you have to download them yourself. \nBut fear not, I've put together a detailed guide. With pictures.\n\n### Preparations\n\nVisit the [FMOD Download page](https://www.fmod.com/download) (accessing it requires registration), find the FMOD Studio API downloads and get APIs for Windows, Linux and Android (in case you want all three). If you're going to set up all three, of course.\n\n**NOTE: Current version of the library was tested on FMOD v2.02.19. I really recommend getting it. Later versions will probably also work, but I have no guarantee.**\n\n\nWindows API requires installation, Linux and Android don't. You can drop them near the Windows API just to have everything in one place.\n\n![setup1](/pics/setup1.png)\n\n### Common logic\n\nIn your crossplatform project, install 2. Install [FmodForFoxes](https://www.nuget.org/packages/FmodForFoxes/) NuGet package. It contains the API.\n\n### Windows \u0026 Linux\n\n1. Open your DesktopGL or WindowsDX Monogame project.\n2. Install the NuGet package [FmodForFoxes.Desktop](https://www.nuget.org/packages/FmodForFoxes.Desktop/). Alternatively, you can plug this repo as a submodule and reference projects directly.\n3. Navigate to your FMOD Windows API installation. From there navigate to `\\api\\core\\lib`. You will see two directories: `x64` and `x86`. Each one will contain this:\n\n![setup2](/pics/setup2.png)\n\n\nOut of all the files you'll need only `fmod.dll` and `fmodL.dll` from either `x86` or `x64` directories (`x64` highly recommended). The files engine with `L` mean that the library supports logging. They are used for debugging andf shoudl not be included into the final release. Copy `fmod.dll` and `fmodL.dll` to the root of your DesktopGL or WindowsDX project. Do the same for `\\api\\studio\\lib` libs and you should end up with it looking like this:\n\n\n![setup3](/pics/setup3.png)\n\nMake sure dll files will be copied to the output directory:\n\n![setup4](/pics/setup4.png)\n\n4. Navigate to your FMOD Linux API installation. From there navigate to `\\api\\core\\lib`. This time you will see four directories: \n\n![setup5](/pics/setup5.png)\n\nYou'll need only `x64` or `x86`.\n\nEach directory contains this:\n\n![setup6](/pics/setup6.png)\n\nYou will need all `libfmod` files from here. Copy fmod files from `x86` or `x64` directory the root of your project, same as on Windows. Do the same for `\\api\\studio\\lib` libs and you'll end up with this:\n\n![setup7](/pics/setup7.png)\n\n*NOTE: DesktopGL project works on both Linux and Windows, so you need to add the dll files there too.*\n\nAgain, make sure all the files you've just added will be copied to the output directory:\n\n![setup4](/pics/setup4.png)\n\nAnd that's it - you've gotten yourself cross-platform desktop FMOD!\n\n### Android\n\n1. Open your Monogame Android project.\n2. Install NuGet package [FmodForFoxes.Android](https://www.nuget.org/packages/FmodForFoxes.Android/). Alternatively, you can plug repo as a submodule and reference projects directly.\n3. Create `libs` directory in the root of your project.\n4. Navigate to your FMOD Android API installation. From there navigate to  `\\api\\core\\lib`. You will see this:\n\n![setup8](/pics/setup8.png)\n\n5. Each folder contains `libfmod.so` and `libfmodL.so`. \nCopy everything except `.jar` file over to your `libs` directory. Don't lose this jar, tho. We'll need it later. Do the same for `\\api\\studio\\lib` libs and you should end up with this:\n\n![setup9](/pics/setup9.png)\n\n1. Select each `.so` file you've just copied, open their Properties and set their Build Action to `AndroidNativeLibrary`.\n\n![setup10](/pics/setup10.png)\n\n7. Create an **NET6 Android Bindings Project**.\n\n   ![setup12](/pics/setup12.png)\n\n   Remember that jar from earlier? Now you need to copy it into the Jars directory and make sure its Build Action is set to `AndroidLibrary`.\n\n   ![setup13](/pics/setup13.png)\n\n   Now reference Bindings project to your main Android project - and you're golden. \n\n   ![setup14](/pics/setup14.png)\n\n\n### Studio setup\n\nFMOD Studio setup process is exactly the same, but you'll need to look into `studio` instead of `core` directories. \n**It's also extremely important that ALL your binaries are the exact same version. \nFMOD doesn't like version mixup. Foxes don't like version mixup. Nobody does.** \n\nIf you still have questions, take a look at the [Samples project](/Samples) that has everything set up for all platforms.\n\n## Playing some tunes!\n\nSo, after you've set everything up, it's time to bop some pops, as kids say these days.\n\n1. Find a sound file and import it into the Content Pipeline.\n2. Select the sound file and set its Build Action to Copy. \n\n![setup11](/pics/setup11.png)\n\n3. Include the `FmodForFoxes` namespace and paste the following code into your\nInitialize() method:\n```cs\nFmodManager.Init(_nativeLibrary, FMODMode.CoreAndStudio, \"Content\");\n\nvar sound = CoreSystem.LoadStreamedSound(\"test.mp3\");\nvar channel = sound.Play();\nchannel.Looping = true;\n```\n\n`_nativeLibrary` is an instance of `INativeFmodLibrary` that you have to create separately in your platform-specific projects. [Samples project](/Samples) already has this set up.\n\nAnd lastly, do note that `FmodManager` has to be properly updated and unloaded. Your main gameloop class has to have this added:\n\n```cs\n/// \u003csummary\u003e\n/// UnloadContent will be called once per game and is the place to unload\n/// game-specific content.\n/// \u003c/summary\u003e\nprotected override void UnloadContent()\n{\n\tFmodManager.Unload();\n}\n\n/// \u003csummary\u003e\n/// Allows the game to run logic such as updating the world,\n/// checking for collisions, gathering input, and playing audio.\n/// \u003c/summary\u003e\n/// \u003cparam name=\"gameTime\"\u003eProvides a snapshot of timing values.\u003c/param\u003e\nprotected override void Update(GameTime gameTime)\n{\n\tFmodManager.Update();\n\tbase.Update(gameTime);\n}\n```\n\n4. Compile and hope that you (and me) did everything right.\n\nYou can also check out the included [Samples project](/Samples). \n\n## But what about other platforms?\n\nI'd like to make console versions of the library - but currently I have no ability\nto do so, and probably won't have for a long time. As for UWP and Apple platforms,\nI just don't care about them enough. \n\nIf you want to be a hero and expand the library with any of those platforms yourself - \ncontact me and we'll figure something out.\n\n\n## License and legal stuffs\n\nThis library is licensed under MIT, so you can use it and its code in any \nshenanigans you want. Free games, commercial games, anything - no payment or \nroyalties required. Just leave a credit. ; - )\n\nBut the show's main star is a bit different. FMOD has its own [license](https://fmod.com/licensing#faq), \nwhich is much less permissive than mine. \n\nDemo [music](https://www.youtube.com/watch?v=zZ81qi90E-Y) is provided by Agrofox and FMOD team.\n\n\n\nAlso big thanque to [StinkBrigade](https://github.com/StinkBrigade) who helped a ton in adding FMOD Studio support.\n\n*don't forget to pet your foxes*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartenfur%2Ffmodforfoxes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartenfur%2Ffmodforfoxes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartenfur%2Ffmodforfoxes/lists"}