Skip to content

Commit

Permalink
Added proper README and debug packing script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martenfur committed Apr 22, 2019
1 parent 44967b4 commit 87fbb2f
Show file tree
Hide file tree
Showing 23 changed files with 198 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AndroidNativeLibrary Include="libs\arm64-v8a\libfmod.so" />
<AndroidNativeLibrary Include="libs\armeabi-v7a\libfmod.so" />
<AndroidNativeLibrary Include="libs\armeabi\libfmod.so" />
<AndroidNativeLibrary Include="libs\x86\libfmod.so" />
<AndroidNativeLibrary Include="libs\x86_64\libfmod.so" />
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
</ItemGroup>
Expand All @@ -95,6 +90,13 @@
<ItemGroup>
<None Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<AndroidNativeLibrary Include="libs\arm64-v8a\libfmod.so" />
<AndroidNativeLibrary Include="libs\armeabi-v7a\libfmod.so" />
<AndroidNativeLibrary Include="libs\armeabi\libfmod.so" />
<AndroidNativeLibrary Include="libs\x86\libfmod.so" />
<AndroidNativeLibrary Include="libs\x86_64\libfmod.so" />
</ItemGroup>
<Import Project="..\ChaiFoxes.FMODAudio.Demos\ChaiFoxes.FMODAudio.Demos.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<DefineConstants>TRACE;DEBUG;ANDROID</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\ChaiFoxes.FMODAudio.Android.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -34,6 +35,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\ChaiFoxes.FMODAudio.Android.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
Expand All @@ -57,8 +59,9 @@
<AndroidNativeLibrary Include="libs\arm64-v8a\libfmod.so" />
<AndroidNativeLibrary Include="libs\armeabi-v7a\libfmod.so" />
<AndroidNativeLibrary Include="libs\armeabi\libfmod.so" />
<None Include="ChaiFoxes.FMODAudio.Android.nuspec" />
<None Include="ChaiFoxes.FMODAudio.Android.targets" />
<None Include="ChaiFoxes.FMODAudio.Android.nuspec">
<SubType>Designer</SubType>
</None>
<None Include="Resources\AboutResources.txt" />
<AndroidNativeLibrary Include="libs\x86\libfmod.so" />
<AndroidNativeLibrary Include="libs\x86_64\libfmod.so" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
<authors>gn Fur</authors>
<owners>Chai Foxes</owners>
<projectUrl>https://github.com/gnFur/ChaiFoxes.FMODAudio</projectUrl>
<iconUrl>https://raw.githubusercontent.com/gnFur/ChaiFoxes.FMODAudio/master/Icon/logofoxe.png?raw=true</iconUrl>
<iconUrl>https://raw.githubusercontent.com/gnFur/ChaiFoxes.FMODAudio/master/Icon/icon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>FMOD library wrapper for Monogame Android.</description>
<description>FMOD library wrapper for Android Monogame projects.</description>
<releaseNotes>Added foxes.</releaseNotes>
<copyright>Copyright 2019</copyright>
<tags>fmod audio monogame android</tags>
</metadata>
<files>
<file src="bin\$configuration$\ChaiFoxes.FMODAudio.Android.Bindings.dll" target="lib\monoandroid81" />
</files>
</package>
4 changes: 2 additions & 2 deletions ChaiFoxes.FMODAudio/ChaiFoxes.FMODAudio.Desktop/App.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<dllmap dll="fmod.dll" os="linux" cpu="x86" target="./x86/libfmod.so"/>
<dllmap dll="fmod.dll" os="linux" cpu="x86-64" target="./x64/libfmod.so"/>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChaiFoxes.FMODAudio</RootNamespace>
<AssemblyName>ChaiFoxes.FMODAudio</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\ChaiFoxes.FMODAudio.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -29,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\ChaiFoxes.FMODAudio.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework, Version=3.6.0.1625, Culture=neutral, processorArchitecture=MSIL">
Expand All @@ -49,7 +52,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="ChaiFoxes.FMODAudio.Desktop.nuspec" />
<None Include="ChaiFoxes.FMODAudio.Desktop.nuspec">
<SubType>Designer</SubType>
</None>
<None Include="x64\fmod.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@
<authors>gn Fur</authors>
<owners>Chai Foxes</owners>
<projectUrl>https://github.com/gnFur/ChaiFoxes.FMODAudio</projectUrl>
<iconUrl>https://raw.githubusercontent.com/gnFur/ChaiFoxes.FMODAudio/master/Icon/icon.png?raw=true</iconUrl>
<iconUrl>https://raw.githubusercontent.com/gnFur/ChaiFoxes.FMODAudio/master/Icon/icon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>FMOD library wrapper for Monogame DesktopGL. Supports Windows and Linux.</description>
<description>FMOD library wrapper for Windows and Linux Monogame projects.</description>
<releaseNotes>Added foxes.</releaseNotes>
<copyright>Copyright 2019</copyright>
<tags>fmod audio monogame windows linux</tags>
</metadata>
<files>
<file src="x64\*" target="Build\x64\" />
<file src="x86\*" target="Build\x86\" />
<file src="ChaiFoxes.FMODAudio.Desktop.targets" target="Build\" />
</files>
</package>

This file was deleted.

170 changes: 168 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,168 @@
# ChaiFoxes.FMOD
Cross-platform C# FMOD wrapper.
# ChaiFoxes.FMODAudio

*I suffer so you don't have to.*

**NOTE: CURRENTLY THIS LIBRARY IS IN DEVELOPMENT AND NUGET PACKAGES ARE NOT AVAILABLE**

The time has come. You're finally witnessing a high-level cross-platform C# library, which makes Monogame and FMOD best friends.

![header](C:/D/_Projects/ChaiFoxes.FMOD/pics/ebites.png)


In case you came here and the only thing you got so far was that hilarious doge meme,
[FMOD](http://fmod.org) is quite powerful cross-platform audio engine, which is
pretty much the only hope to have any decent audio in Monogame.

The catch is - FMOD is written in C++, and the only thing C# overlords got
is bare-bones C# wrapper. No tutorials, no setup guides. Only you and DllImport.

![send help](C:/D/_Projects/ChaiFoxes.FMOD/pics/help.png)


This is why this library exists. It does the tough part for you, loads and sets
everything up, plus provides some basic high-level interface.

Also note that even though primary target of this library is Monogame, its sources
will be very useful if you want to use FMOD in some other C#-based project.

## Setup

Setting things up is a little fiddly. Here's the thing - FMOD license prohibits me from
distributing from distributing their libraries with my Nuget package - so you have to
download them yourself.

### Preparations.

Go to the [FMOD Download page](https://www.fmod.com/download) (accessing it requires
registration), find FMOD Studio API downloads and download APIs for Windows, Linux
and Android. If you're going to set up all three, of course.


Windows API requires installation, Linux and Android doesn't. You can drop them near
Windows API just to have everything in one place.

![setup1](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup1.png)

### Windows & Linux

1. Open your DesktopGL or SharpDX Monogame project.
2. Install NuGet package ChaiFoxes.FMODAudio.Desktop. Alternatively, you can compile
it from sources.
3. Navigate to your FMOD Windows API installation. From it navigate to `\api\core\lib`.
You will see two directories: x64 and x86. Each one will contain this:

![setup2](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup2.png)


Out of all the files you'll need only `fmod.dll` from both `x86` and `x64` directories.
Your Monogame project should already have `x86` and `x64` directories
(if you don't - just create them) - copy corresponding versions of `fmod.dll`
into them. You should end up with it looking like this:


![setup3](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup3.png)

Make sure dll files will be copied to the output directory:

![setup4](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup4.png)

4. Navigate to your FMOD Linux API installation. From it navigate to `\api\core\lib`.
This time you will see four directories:

![setup5](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup5.png)

You'll need only `x86` and `x86_64`.

Each directory contains this:

![setup6](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup6.png)

You will need only `libfmod` files - those without L. Copy fmod files from `x86`
directory to `x86` directory of your project, and then copy files from `x86_64`
to your `x64` directory. You'll end up with this:

![setup7](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup7.png)

*NOTE: If you're going for Linux-only build, you can exclude fmod.dll files.*

Again, make sure all the files you've just added will be copied
to the output directory:

![setup4](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup4.png)

And that's it - you got yourself cross-platform desktop FMOD!

### Android

1. Open your Monogame Android project.
2. Install NuGet package ChaiFoxes.FMODAudio.Android. Alternatively, you can compile
it from sources.
3. Create `libs` directory in the root of your project.
4. Navigate to your FMOD Android API installation. From it navigate to `\api\core\lib`.
You will see this:

![setup8](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup8.png)

5. Each folder contains `libfmod.so` and `libfmodL.so` files.
You need only `libfmod.so` from each directory. Copy everything over to your `libs`
directory. You'll end up with this:

![setup9](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup9.png)

6. Select each `.so` file you've just copied, open their Properties and set their
Build Action to `AndroidNativeLibrary`.

![setup10](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup10.png)

## Playing some tunes!

So, after you've set up everything, it's time to bop some pops, as kids say these days.

1. Find some sound file and import it into Content Pipeline.
2. Select sound file and set its Build Action to Copy.

![setup11](C:/D/_Projects/ChaiFoxes.FMOD/pics/setup11.png)

3. Include ChaiFoxes.FMODAudio namespace and paste the following code in your
Initialize() method:

```
AudioMgr.Init("Content/");
var sound = AudioMgr.LoadStreamedSound("test.mp3");
var group = AudioMgr.CreateChannelGroup("group");
AudioMgr.PlaySound(sound, group);
```
4. Compile and hope that you (and me) did everything right.

You can also check out demo project included in sources. Though, note that it requires
main library project to be present and compiled in Debug. You can also replace project reference
to Nuget packages.

## But what about other platforms?

I'd like to make console versions of the library - but currently I have no ability
to do so, and probably won't have for a long time. As for UWP an Apple platforms,
I just don't care about them enough.

If you want to be a hero and expand the library with any of those platfrorms yourself -
contact me and we'll figure something out. ; - )


## License and legal stuffs

This library is licensed under MPL 2.0, so you can use it and its code in any
shenanigans you want. Free games, commercial games, anything - no payment or
royalties required. Just leave a credit. ; - )

But the show's main star is a bit different. FMOD has its own [license](https://fmod.com/licensing#faq),
which is much less permissive than mine.

Demo [music](https://www.youtube.com/watch?v=zZ81qi90E-Y) is provided by Agrofox.

## Fin.

Want to contribute, suggest a feature or just want to pour shit on my code? Feel free to contact me via email: **[email protected]** or on [Twitter](https://twitter.com/ChaiFoxes).


*don't forget to pet your foxes*
2 changes: 2 additions & 0 deletions packDebug.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nuget pack ChaiFoxes.FMODAudio\ChaiFoxes.FMODAudio.Desktop\ChaiFoxes.FMODAudio.Desktop.csproj -Properties Configuration=Release -OutputDirectory Release\
nuget pack ChaiFoxes.FMODAudio\ChaiFoxes.FMODAudio.Android\ChaiFoxes.FMODAudio.Android.csproj -Properties Configuration=Release -OutputDirectory Release\
Binary file added pics/ebites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pics/setup9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 87fbb2f

Please sign in to comment.