Skip to main content

History: MogreFreeSL

Source of version: 11

Copy to clipboard
            !Introduction
MogreFreeSL is a MOGRE wrapper for [http://www.lukasheise.com/projects.html|the 3D FreeSL sound engine]. FreeSL (Free Sound Library) is a OpenAL wrapper. It includes the EAX 2.0 library for realistic audio environment simulations plus occlusion and obstruction.

MogreFreeSL allows you to use 3D sound with your MOGRE application. It is a port of the original OgreFreeSl wrapper. Not all of the FreeSL functions are wrapped.

%help% For questions, bug reports, etc. use this [http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=13035|forum topic]

{maketoc}

!Features 
*Based on OpenAL
*Supports EAX 2.0 (can simulate complex sound environments like underwater or caves)
*Contains a SoundObject memory manager
*Can play WAV and Ogg
*Can stream Ogg and AVI(PCM)
*Supports Zip Files (can load static sounds and EAX scripts from *.zip packages)
*Can be used with any .NET language

!Getting the source
The version of MogreFreeSL used in this wiki article is available [http://bitbucket.org/mogre/mogreaddons/changeset/eafcdfaf2263|here]. ([http://bitbucket.org/mogre/mogreaddons/get/eafcdfaf2263.zip|direct .zip download])

You can get the latest MogreFreeSL source from [http://bitbucket.org/mogre/mogreaddons|here].

Click "get source" in the top-right corner, then choose the compression method of your choice.

!Compiling
Compiling MogreFreeSL is very simple. Load the project file under MogreFreeSL\FSLOgreCS in Visual Studio. Replace the broken reference to Mogre with a reference to the version of Mogre you would like to use, either from the SDK or from your own source code compilation. Build the project in whatever configuration you want. You should now be able to reference MogreFreeSL and use it in your project.

!!Compiling Documentation
If you wish to use MogreFreeSL's built in code documentation, click "Project" in the toolbar and then select "FSLOgreCS Properties..." Select the "Build" tab, and check the box next to "XML Documentation File:" When you next build the project, a file called "FSLOgreCS.XML" will be created along with FSLOgreCS.dll in the build directory. Be sure that you copy this file wherever you copy the library, so that you may use the dynamic documentation.

!Using MogreFreeSL
!!Requirements
If you are using MogreFreeSL, please do not forget to copy & paste these dlls from the MogreFreeSL folder to your build folder first; failing to do so will cause your application to crash:
*alut.dll
*eax.dll
*EaxAc3.dll
*FreeSL.dll
*ogg.dll
*OpenAL32.dll
*vorbis.dll
*wrap_oal.dll

!!Initialization
The first step in using MogreFreeSL in your own application is to add a frame listener:

{CODE(wrap="1", colors="c#")}myRoot.FrameStarted += new Mogre.FrameListener.FrameStartedHandler(FSLSoundManager.Instance.FrameStarted);{CODE}

Now initialize the sound manager. You need to pass the sound manager the sound system enumeration and the camera you would like to use. Choose any FreeSL.FSL_SOUND_SYSTEM that you wish. This example uses FSL_SS_EAX2:

{CODE(wrap="1", colors="c#")}FSLSoundManager.Instance.smgr.InitializeSound(FreeSL.FSL_SOUND_SYSTEM.FSL_SS_EAX2, camera);
FSLSoundManager.Instance.GetListener().ZFlipped = true;
FreeSL.fslSetAutoUpdate(true);{CODE}

The second and third line fix issues with channel reversal and streaming, respectively.

!!Usage
You are now free to create Ambient and Object sounds. To create an ambient sound (a sound that will remain the same no matter where you go, like level music) do this:

{CODE(wrap="1", colors="c#")}FSLSoundObject sound = FSLSoundManager.Instance.CreateAmbientSound("file.ogg", "sound name", true, false);{CODE}

You can now play, pause, and stop the sound.

{CODE(wrap="1", colors="c#")}sound.Play();{CODE}

To create an object sound (a sound that can move), do this:

{CODE(wrap="1", colors="c#")}FSLSoundObject soundobject = FSLSoundManager.Instance.CreateSoundEntity("file.ogg", node, node.Name, true, false);{CODE}

__Make sure that your sound file is in mono. If it is not in mono, the 3D effect will not work.__
You can now play, pause, and stop the sound.

{CODE(wrap="1", colors="c#")}soundobject.Play();{CODE}

To change the rate at which a SoundObject's playback volume decreases as it moves away from the camera, you must set the Reference Distance and Maximum Distance.

The Reference Distance is the distance away from the camera at which the SoundObject's volume starts decreasing, and the Maximum Distance is the distance from the camera at which the SoundObject will be at its quietest. Set them thusly:

{CODE(wrap="1", colors="c#")}((FSLSoundEntity)soundobject).SetReferenceDistance(5);
((FSLSoundEntity)soundobject).SetMaxDistance(10);{CODE}

!!!Advanced Usage

Not sure what else to do with MogreFreeSL? Try one of these:

{CODE(wrap="1", colors="c#")}FreeSL.fslSetListenerEnvironmentPreset(FreeSL.FSL_LISTENER_ENVIRONMENT.FSL_ENVIRONMENT_UNDERWATER);

soundobject.SetSpeed(.5f);

FreeSL.fslSoundSetSpeedAllSounds(.5f);{CODE}

!Links
[http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=13035&start=15|MogreFreeSL thread]
[http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=2799|Old MogreFreeSL thread]
[http://www.ogre3d.org/phpBB2/viewtopic.php?t=22679|Original OgreFreeSL]
[http://www.lukasheise.com/projects.html|FreeSL website]

        

History

Information Version
Sun 09 of Oct, 2011 18:33 GMT-0000 materialDefender Clarified download process 17
Sun 09 of Oct, 2011 18:31 GMT-0000 materialDefender Fixed link to files 16
Sun 09 of Oct, 2011 18:22 GMT-0000 materialDefender 15
Sat 08 of Oct, 2011 22:07 GMT-0000 materialDefender 14
Sat 08 of Oct, 2011 22:05 GMT-0000 materialDefender 13
Sat 08 of Oct, 2011 22:03 GMT-0000 materialDefender Updated wiki entry for new version of MogreFreeSL 12
Sun 31 of Jul, 2011 23:14 GMT-0000 jacmoe 11
Sun 26 of Dec, 2010 11:23 GMT-0000 Beauty added forum link 10
Mon 13 of Sep, 2010 23:43 GMT-0000 materialDefenderWiki Changed download link to reflect version used by wiki article. 9
Tue 13 of Jul, 2010 19:55 GMT-0000 materialDefender Moved table of contents 8
Tue 13 of Jul, 2010 19:53 GMT-0000 materialDefender Fixed typing errors 7
Tue 13 of Jul, 2010 19:49 GMT-0000 materialDefender Updated for new version of MogreFreeSL 6
Sat 10 of Jul, 2010 18:23 GMT-0000 materialDefender Provided link to OpenAL website 5
Sun 27 of Dec, 2009 17:37 GMT-0000 jacmoe 4
Sun 27 of Dec, 2009 17:36 GMT-0000 jacmoe 3
Sun 27 of Dec, 2009 17:36 GMT-0000 jacmoe 2
Sat 18 of Oct, 2008 20:29 GMT-0000 OgreWikiBot Robot: Cosmetic changes 1