2009-12-26 21:13:06 +00:00
|
|
|
/*
|
|
|
|
This example combines:
|
|
|
|
|
|
|
|
- the OGRE VFS system (to read from zip)
|
|
|
|
- Audiere (for decoding sound data)
|
|
|
|
- OpenAL (for sound playback)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2010-06-03 18:13:27 +00:00
|
|
|
#include "sound/filters/openal_audiere.hpp"
|
|
|
|
#include "vfs/servers/ogre_vfs.hpp"
|
2009-12-26 21:13:06 +00:00
|
|
|
#include <Ogre.h>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
using namespace Ogre;
|
|
|
|
using namespace Mangle;
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
// Disable Ogre logging
|
|
|
|
new LogManager;
|
|
|
|
Log *log = LogManager::getSingleton().createLog("");
|
|
|
|
log->setDebugOutputEnabled(false);
|
|
|
|
|
|
|
|
// Set up Root
|
|
|
|
Root *root = new Root("","","");
|
|
|
|
|
|
|
|
// Add zip file with a sound in it
|
|
|
|
root->addResourceLocation("sound.zip", "Zip", "General");
|
|
|
|
|
|
|
|
// Ogre file system
|
|
|
|
VFS::OgreVFS vfs;
|
|
|
|
|
2010-01-01 18:52:37 +00:00
|
|
|
// The main sound system
|
|
|
|
Sound::OpenAL_Audiere_Factory mg;
|
|
|
|
Sound::SoundPtr snd = mg.load(vfs.open("owl.ogg"));
|
2009-12-26 21:13:06 +00:00
|
|
|
|
|
|
|
cout << "Playing 'owl.ogg' from 'sound.zip'\n";
|
2010-01-01 18:52:37 +00:00
|
|
|
snd->play();
|
2009-12-26 21:13:06 +00:00
|
|
|
|
2010-01-01 18:52:37 +00:00
|
|
|
while(snd->isPlaying())
|
2009-12-26 21:13:06 +00:00
|
|
|
{
|
|
|
|
usleep(10000);
|
|
|
|
if(mg.needsUpdate) mg.update();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|