I made a sound manager using FreeSL, it' an easy way to implent sound using the example framework or your own framework.
It consist of the following classes FSLSoundObject, FSLSoundEntity, FSLAmbientSound, FSLListener, FSLSoundManager and SoundListener.
FSLSoundObject: is the base object for sounds, can't use directly, must derive from it.
FSLAmbientSound: Used for sound that's not present in the 3D space, like sound tracks or ambient sounds.
FSLSoundEntity: Used for sound located in 3D space.
FSLListener: It the listener, right now it must be a camera.
FSLSoundManager: Manage creation and destruction of sounds, also is in charge of initializing and stoping the sound system.
SoundListener: updates the position of the listener and SoundEntities every frame.
Here is the link to an example and the source files:
http://www.uploading.com/es/?get=AK7VWMHH
or
http://www.mediamax.com/jomunoz/Hosted/OgreSound.zip
In the example just aproach any of the monkey heads where a different sound is playing, also notice the wind blowing in the backgroung.
It as easy as:
Code: Select all
soundManager = new FSLSoundManager( mCamera ); //Create instance of the Sound Manager
soundManager->initSound(); //Init sound system
FSLSoundObject *sonido1 = soundManager->createSoundEntity("chime1.ogg",nodo2,nodo2->getName(),true);
sonido1->play();
//where nodo2 is the SceneNode of the entity that will have the sound.
//Then add the sound listener to the root object, that will update the position of the objects every frame.
mSoundListener = new SoundListener( soundManager );
mRoot->addFrameListener(mSoundListener); //Add sound listener so it will update every frame
Suerte,