1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 07:53:52 +00:00
openmw/sound/tests/sound_3d_test.cpp
2010-08-12 14:49:58 +02:00

46 lines
872 B
C++

#include <iostream>
#include <exception>
#include <assert.h>
#include <mangle/stream/servers/file_stream.hpp>
#include <mangle/sound/filters/openal_audiere.hpp>
#include <sound/sndmanager.hpp>
using namespace std;
using namespace Mangle::Stream;
using namespace Mangle::Sound;
using namespace OEngine::Sound;
const std::string sound = "../../mangle/sound/tests/cow.wav";
SoundManagerPtr m;
// Play and wait for finish
void play(float x, float y, float z)
{
cout << "Playing at " << x << "," << y << "," << z << endl;
SoundPtr snd = m->play3D(sound,x,y,z);
while(snd->isPlaying())
{
usleep(10000);
m->update();
}
}
int main()
{
SoundFactoryPtr oaf(new OpenAL_Audiere_Factory);
SoundManagerPtr mg(new SoundManager(oaf));
m = mg;
mg->setListenerPos(0,0,0,0,1,0,0,0,1);
play(0,0,0);
play(1,1,0);
play(-1,0,0);
return 0;
}