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)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2009-12-28 13:09:17 +00:00
|
|
|
#include "sound/servers/openal_audiere.h"
|
|
|
|
#include "vfs/servers/ogre_vfs.h"
|
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;
|
|
|
|
|
|
|
|
Sound::OpenAL_Audiere_Manager mg;
|
|
|
|
Sound::Sound *snd = mg.load(vfs.open("owl.ogg"));
|
|
|
|
|
|
|
|
Sound::Instance *s = snd->getInstance(false, false);
|
|
|
|
cout << "Playing 'owl.ogg' from 'sound.zip'\n";
|
|
|
|
s->play();
|
|
|
|
|
|
|
|
while(s->isPlaying())
|
|
|
|
{
|
|
|
|
usleep(10000);
|
|
|
|
if(mg.needsUpdate) mg.update();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(s) s->drop();
|
|
|
|
if(snd) snd->drop();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|