libolt
30-11-2007 06:24:12
Hi,
I'm attempting to integrate OgreAL into my project for sound playback. I tried following the Basic Demo to get an idea of how to set everything up.
However it crashes on:
I have created as simple of a test app as I can to reproduce this problem:
Now this dies with the following:
I get the following backtrace out of GDB:
Is there perhaps something I'm missing or doing wrong? Any help is greatly appreciated.
Mike
I'm attempting to integrate OgreAL into my project for sound playback. I tried following the Basic Demo to get an idea of how to set everything up.
However it crashes on:
soundMgr = OgreAL::SoundManager::getSingletonPtr();
I have created as simple of a test app as I can to reproduce this problem:
#include "input.h"
#include "simulation.h"
#include "Ogre.h"
#include "OgreWindowEventUtilities.h"
#include "OgreAL.h"
#if defined(WIN32)
#include "windows.h"
using namespace Ogre;
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
#else
int main (int argc, char *argv[]) {
#endif
Ogre::Root *ogre;
Ogre::RenderWindow *window;
Ogre::SceneManager *sceneMgr;
Ogre::Camera *camera;
// fire up an Ogre rendering window. Clearing the first two (of three) params will let us
// specify plugins and resources in code instead of via text file
ogre = new Ogre::Root("", "");
#if defined(_DEBUG)
ogre->loadPlugin("RenderSystem_GL_d");
#else
ogre->loadPlugin("/usr/local/lib/OGRE/RenderSystem_GL");
#endif
Ogre::RenderSystemList *renderSystems = NULL;
Ogre::RenderSystemList::iterator r_it;
// we do this step just to get an iterator that we can use with setRenderSystem. In a future article
// we actually will iterate the list to display which renderers are available.
renderSystems = ogre->getAvailableRenderers();
r_it = renderSystems->begin();
ogre->setRenderSystem(*r_it);
ogre->initialise(false);
// load common plugins
#if defined(_DEBUG)
ogre->loadPlugin("Plugin_CgProgramManager_d");
ogre->loadPlugin("Plugin_OctreeSceneManager_d");
#else
ogre->loadPlugin("/usr/local/lib/OGRE/Plugin_CgProgramManager");
ogre->loadPlugin("/usr/local/lib/OGRE/Plugin_ParticleFX");
// ogre->loadPlugin("Plugin_OctreeSceneManager");
#endif
// load the basic resource location(s)
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"resource", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("Audio", "FileSystem", "General");
#if defined(WIN32)
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"c:\\windows\\fonts", "FileSystem", "GUI");
#endif
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("General");
// Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("GUI");
// setup main window; hardcode some defaults for the sake of presentation
Ogre::NameValuePairList opts;
opts["resolution"] = "1024x768";
opts["fullscreen"] = "false";
opts["vsync"] = "false";
// create a rendering window with the title "CDK"
window = ogre->createRenderWindow("OgreAL Test", 1024, 768, false, &opts);
// since this is basically a CEGUI app, we can use the ST_GENERIC scene manager for now; in a later article
// we'll see how to change this
sceneMgr = ogre->createSceneManager(Ogre::ST_GENERIC);
camera = sceneMgr->createCamera("camera");
// Position it at 500 in Z direction
camera->setPosition(Ogre::Vector3(0,0,500));
// Look back along -Z
camera->lookAt(Ogre::Vector3(0,0,-300));
camera->setNearClipDistance(5);
Ogre::Viewport* vp = window->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
// most examples get the viewport size to calculate this; for now, we'll just
// set it to 4:3 the easy way
camera->setAspectRatio((Ogre::Real)1.333333);
OgreAL::SoundManager *soundMgr;
soundMgr = new OgreAL::SoundManager();
// OgreAL::Sound *snd;
// snd = OgreAL::SoundManager::getSingletonPtr()->createSound("dead", "roar.wav", false);
// this next bit is for the sake of the input handler
unsigned long hWnd;
window->getCustomAttribute("WINDOW", &hWnd);
sceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
Ogre::Light* l = sceneMgr->createLight("MainLight");
l->setPosition(20,80,56);
bool QUIT;
QUIT = false;
while (!QUIT)
{
// handler->capture();
// run the message pump (Eihort)
Ogre::WindowEventUtilities::messagePump();
ogre->renderOneFrame();
}
// clean up after ourselves
delete ogre;
return 0;
}
Now this dies with the following:
*-*-* OgreAL Initialization
MovableObjectFactory for type 'OgreAL_Sound' registered.
MovableObjectFactory for type 'OgreAL_Listener' registered.
*-*-* Creating OpenAL
OpenAL Devices
--------------
OGRE EXCEPTION(40961:): Failed to open Device: OpenAL Error: The specified source name is not valid in initializeDevice
terminate called after throwing an instance of 'Ogre::Exception'
what(): OGRE EXCEPTION(40961:): Failed to open Device: OpenAL Error: The specified source name is not valid in initializeDevice
Program received signal SIGABRT, Aborted.
I get the following backtrace out of GDB:
(gdb) bt
#0 0x00002ba32ad57765 in raise () from /lib/libc.so.6
#1 0x00002ba32ad591c0 in abort () from /lib/libc.so.6
#2 0x00002ba32a6517b4 in __gnu_cxx::__verbose_terminate_handler () from /usr/lib/libstdc++.so.6
#3 0x00002ba32a64f746 in ?? () from /usr/lib/libstdc++.so.6
#4 0x00002ba32a64f773 in std::terminate () from /usr/lib/libstdc++.so.6
#5 0x00002ba32a64f85a in __cxa_throw () from /usr/lib/libstdc++.so.6
#6 0x00002ba329727305 in OgreAL::check (error=40961, description=<value optimized out>, source=@0x7fff8216b310)
at OgreALException.cpp:59
#7 0x00002ba32971ba35 in OgreAL::SoundManager::initializeDevice (this=0x1107660, deviceName=@0x7fff8216b700)
at OgreALSoundManager.cpp:385
#8 0x00002ba32971cde4 in SoundManager (this=0x1107660, deviceName=@0x7fff8216b700) at OgreALSoundManager.cpp:70
#9 0x000000000040457f in main (argc=1, argv=0x7fff8216b878) at /home/libolt/Projects/ogretest/main.cpp:124
Is there perhaps something I'm missing or doing wrong? Any help is greatly appreciated.
Mike