Sound refuses to play


09-06-2008 11:35:12

Hey, this has been annoying me since yesterday evening, so I thought I'd come on here and see what you lot think...

I just quickly stuck OgreAL into my "game framework" and I am having a little bit of trouble getting sounds to play.

This is pretty much the sound code here:

// Create OgreAL sound manager
new OgreAL::SoundManager();
mALSoundMgr = OgreAL::SoundManager::getSingletonPtr();

// Log all the available audio devices
LOG("AudioManager: Audio devices available: ");
Ogre::StringVector devices = mALSoundMgr->getDeviceList();
Ogre::StringVector::iterator deviceIter = devices.begin();
for( ; deviceIter != devices.end(); deviceIter++ )
LOG("AudioManager: -> " + (*deviceIter));

// Create a test sound
OgreAL::Sound* sound;
sound = mALSoundMgr->createSound("TestSound", "abc.ogg",false,false);

// Some logging to see if the sound is actually playing/exists
if( mALSoundMgr->hasSound("TestSound") )
if( !sound->play() )

mALSoundMgr->hasSound("TestSound") returns true...
but sound->play() returns false

I've done some resource group checking, and the abc.ogg resource exists and can be found by ogre's resource manager, its not in an archive (I read that OgreAL accesses sound files directly so I made a new filesystem resource purely for testing this). I have tried numerous ogg files, ones which were provided by CaseyB as part of the media, and my own. Theres nothing to suggest that the ogg file isn't being loaded as there is a considerable pause which would suggest that the file is being moved into memory.

I am using a multithreaded build of ogreAL, and the ogre resource logs show OgreAL messages and nothing which looks out of the ordinary.

And more strangely, this worked a few weeks ago. I have since changed my code base around slightly, but I can't understand why this small bit of code doesn't work....

Thanks for any help


11-06-2008 16:53:42

I don't see anything obviously wrong with that code, although the play() function returning false is normal, it returns TRUE if the sound is already playing, but I guess you aren't hearing any audio?


11-06-2008 20:17:16

Ah, right, thanks about that retun value clue. But yeah, I don't hear any audio. Odd huh, I'm thinking it could be a driver issue, I've already reinstalled OpenAL, and like I said, this was working, on the same system no more than a few weeks ago. Strange huh.

Any ideas?

Thanks again