Here is , how you can integrate OGRE with “audiere”, an excellent cross-platform audio library in few seconds.
Setting up OGRE and audiere on Anjuta(Linux):
Make C++ Project(Generic/Terminal)
1)Add /usr/local/include/OGRE to “Settings->CompilerAndLinkerSetting->include”
2)Add “/usr/local/lib” to lib path
3)Add OgreMain and audiere to Libraries.
4)To OPTIONS->CFLAGS add –DEXT_HASH
5)Replace the code in main.cc by following code
#include "ExampleApplication.h"
#include “audiere.h”
using namespace audiere;
AudioDevicePtr device(OpenDevice());
OutputStreamPtr song(OpenSound(device,”songname.mp3orwhatever”,false));
class Game : public ExampleApplication
{
void createScene()
{
Entity *robo;
robo = mSceneMgr->createEntity( "Robot", "robot.mesh" );
SceneNode *node1;
node1= mSceneMgr->getRootSceneNode()->createChildSceneNode( "RobotNode" );
node1->attachObject( robo );
song->setVolume(0.5f);
song->play();
}
};
int main()
{
Game mygame;
mygame.go();
return 0;
}
Remember : audiere.h and libaudiere.a(audiere.dll in windows) should be in the same directory in which main.cc is (or in the path).Though I prefer former.
And all the usual stuff (ExampleApplication.h ExampleFrameListener.h plugins.cfg resources.cfg(with absolute paths and not relative) should be in your source folder or in the PATH.
Type say speedofsound.mp3 or .wav or .ogg or flac or(full music filename) I love ColdPlay
Build and Execute.
You should see robot dancing to music.
GoodBye !!!
Personally I like using Class ExampleApplication.h , because one of the main powers of C++ is "Code Reusability" which results from the cornerstone of ObjectOrientedProgramming , i.e. Inheritance
For Fuller introduction to Audiere , see my tutorial here : ---
http://one.fsphost.com/ogre3d/
