mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +00:00
Added composite test ogre+audiere+openal
This commit is contained in:
parent
abee2689e3
commit
eedf0c9e3b
5 changed files with 68 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
#ifndef MANGLE_INPUT_FILTER_H
|
#ifndef MANGLE_INPUT_FILTER_H
|
||||||
#define MANGLE_INPUT_FILTER_H
|
#define MANGLE_INPUT_FILTER_H
|
||||||
|
|
||||||
#include "sound.h"
|
#include "../sound.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
1
tests/.gitignore
vendored
Normal file
1
tests/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*_test
|
14
tests/Makefile
Normal file
14
tests/Makefile
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
GCC=g++ -I../
|
||||||
|
|
||||||
|
all: ogrevfs_audiere_openal_test
|
||||||
|
|
||||||
|
I_OGRE=$(shell pkg-config --cflags OGRE)
|
||||||
|
L_OGRE=$(shell pkg-config --libs OGRE)
|
||||||
|
L_OPENAL=$(shell pkg-config --libs openal)
|
||||||
|
L_AUDIERE=-laudiere
|
||||||
|
|
||||||
|
ogrevfs_audiere_openal_test: ogrevfs_audiere_openal_test.cpp ../vfs/imp_server/ogre_vfs.cpp ../sound/imp/input_audiere.cpp ../sound/imp/output_openal.cpp ../stream/imp_client/audiere_file.cpp
|
||||||
|
$(GCC) $^ -o $@ $(I_OGRE) $(L_OGRE) $(L_OPENAL) $(L_AUDIERE)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm *_test
|
52
tests/ogrevfs_audiere_openal_test.cpp
Normal file
52
tests/ogrevfs_audiere_openal_test.cpp
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
This example combines:
|
||||||
|
|
||||||
|
- the OGRE VFS system (to read from zip)
|
||||||
|
- Audiere (for decoding sound data)
|
||||||
|
- OpenAL (for sound playback)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sound/imp/openal_audiere.h"
|
||||||
|
#include "vfs/imp_server/ogre_vfs.h"
|
||||||
|
#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;
|
||||||
|
}
|
BIN
tests/sound.zip
Normal file
BIN
tests/sound.zip
Normal file
Binary file not shown.
Loading…
Reference in a new issue