MogreFreeSL

From Ogre Wiki

Jump to: navigation, search

Contents

MogreFreeSL

Introduction

What is it?

MogreFreeSL is a MOGRE wrapper for the 3D FreeSL sound engine. It allows you to use 3D sound with your MOGRE application. It is a port of the original OgreFreeSl wrapper. Anyway MogreFreeSL hasn´t all the FreeSL functions wrapped.

Why I did it?

The primary reason is to show that any developer can port an existing c++ ogre application library to mogre and keep nearly the same ease of use. The secondary reason is mostly my frustration with Managed DirectX 1.1 (because the 2.0 version was discontinued) and using it with .Net 2.0 and Visual Studio 2005. There was also no other decent 3D sound engine for c#, I also needed something with features like sound effects and ogg loading, FreeSL was a library I found easy to use in c++.

About FreeSL

From the Website:

FreeSL (Free Sound Library) is a OpenAL wrapper. It also includes the EAX 2.0 library for realistic audio environment simulations plus occlusion and obstruction. 
Features 
• OpenAL (2D/3D) 
• EAX 2.0 (can simulate complex sound environments like underwater or caves) 
• Sound Object Memory Manager 
• Static Playback WAV and Ogg 
• Stream Playback Ogg and AVI(PCM) 
• Zip File Support (can load static sounds and EAX scripts from *.zip packages) 
• Can be used by Visual Basic and C++

Getting the source

You can get the latest SVN source of MogreFreeSL from here: https://svn.sourceforge.net/svnroot/mogre/trunk/MogreFreeSL

Although this link seems to be more reliable

https://mogre.svn.sourceforge.net/svnroot/mogre/trunk/MogreFreeSL/

Compiling

Compiling MogreFreeSL is very simple. Load up the given solution for Visual Studio 2005 (no project files for Visual Studio 2003 at the moment). Add 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.

Running an App with MogreFreeSL

If you have a MogreFreeSL app running please do not forget to copy paste these dlls from the MogreFreeSL demo release bin folder to your own release bin folder. Failing to do so will cause your application to crash. The dlls to be copied are these:

alut.dll
eax.dll
EaxAc3.dll
FreeSL.dll
ogg.dll
OpenAL32.dll
vorbis.dll
wrap_oal.dll

Tutorial

This is a very quick tutorial on how to use MogreFreeSl in your own app.

First step is to initialize the sound manager, you need to pass the sound manager a camera.

FSLSoundManager.Instance.Initialize(mogrecamera);

You are now free to create Ambient and Object sounds at your will.

To create an ambient sound (a sound that will remain the same no matter where you go, sort of like level music) do this:

FSLSoundObject sound = FSLSoundManager.Instance. CreateAmbientSound("./media/sound/soundfile.ogg", "MyAmbientSound", boollooptrue);

You can now play, stop, pause the sound.

sound.Play();

To create an object sound (a sound that will move) do this (note. You need an existing node to attach the sound object too.)

FSLSoundObject soundobject = FSLSoundManager.Instance.CreateSoundEntity("./media/sound/soundobject.ogg", mynode, mynode.Name, boollooptrue);

You can now play, stop, pause the sound.

soundobject.Play();

DON’T FORGET TO ADD THE FRAME LISTENER TO YOUR MOGRE.ROOT CLASS. Otherwise the sound will not update.

You can do something like the following

myroot.FrameStarted += new Mogre.FrameListener.FrameStartedHandler(soundManager.FrameStarted);

or

Mogre.Root.Singleton.FrameStarted += new Mogre.FrameListener.FrameStartedHandler(soundManager.FrameStarted);

Links

Original OgreFreeSL

FreeSl website

MogreFreeSL thread

Personal tools
administration