Exception: Could not open Ogg file

uberglitch

12-10-2007 00:39:49

Hey everyone, just starting out with a new project and trying to get sounds to play. I've hit a roadblock in that I can't seem to find my own audio files (how embarrassing).

I've tried a few different locations, and none have worked.

Here is the relevant code in my project that deals with sound:


OgreAL::SoundManager *soundManager;
soundManager = new OgreAL::SoundManager();
OgreAL::Sound *bgSound = soundManager->createSoundStream("bgmusic", "testaudio1.ogg", true);
bgSound->setGain(0.5);
bgSound->setRelativeToListener(true);


It compiles just fine, but can't find the file. I have copies of "testaudio1.ogg" in /Media/Audio/ and in a .zip file in ./resources/ but neither work. Both of those are set up in Resources.cfg and in the code, so I'm stumped.

Here's the relevant section my Ogre.log


16:24:43: *-*-* OgreAL Initialization
16:24:43: MovableObjectFactory for type 'OgreAL_Sound' registered.
16:24:43: MovableObjectFactory for type 'OgreAL_Listener' registered.
16:24:43: *-*-* Creating OpenAL
16:24:43: OpenAL Devices: Generic Software,
16:24:43: Choosing: Generic Software
16:24:43: Supported Formats
16:24:43: -----------------
16:24:43: * AL_FORMAT_MONO16, Monophonic Sound
16:24:43: * AL_FORMAT_STEREO16, Stereo Sound
16:24:43: * AL_FORMAT_QUAD16, 4 Channel Sound
16:24:43: * AL_FORMAT_51CHN16, 5.1 Surround Sound
16:24:43: * AL_FORMAT_61CHN16, 6.1 Surround Sound
16:24:43: * AL_FORMAT_71CHN16, 7.1 Surround Sound
16:24:43: EAX 2.0 Detected
16:24:43: OGRE EXCEPTION(1:): Could not open Ogg file. in OgreAL::OggSound::ctor


Thanks for any help you can offer!

CaseyB

12-10-2007 03:56:26

Could you post your resources.cfg? What do you mean set up in resources.cfg AND the code?

uberglitch

12-10-2007 04:16:31

hmm...

My resources.cfg looks like this:


# Resource locations to be added to the 'boostrap' path
# This also contains the minimum you need to use the Ogre example framework
[Bootstrap]
Zip=../../media/packs/OgreCore.zip

# Resource locations to be added to the default path
[General]
FileSystem=../../media
FileSystem=../../media/audio
FileSystem=../../media/fonts
FileSystem=../../media/materials/programs
FileSystem=../../media/materials/scripts
FileSystem=../../media/materials/textures
FileSystem=../../media/models
FileSystem=../../media/overlays
FileSystem=../../media/particle
FileSystem=../../media/gui
FileSystem=../../media/DeferredShadingMedia
Zip=../../media/packs/cubemap.zip
Zip=../../media/packs/cubemapsJS.zip
Zip=../../media/packs/dragon.zip
Zip=../../media/packs/fresneldemo.zip
Zip=../../media/packs/ogretestmap.zip
Zip=../../media/packs/skybox.zip
Zip=/resource/audio.zip


And by code, I mean I also tried to load the OGG file as a resource:
Both testaudio1.ogg and roar.wav are in audio.zip as well as in /media/audio


Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"resource/audio.zip", "Zip", "Audio");
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("Audio");


I tried loading a wav file, just to check if it was working at all, using this code:



OgreAL::Sound *roarSound = soundManager->createSound("roar", "roar.wav", false);
node1->attachObject(roarSound);
roarSound->play();


And got this exception:


20:15:18: OGRE EXCEPTION(3:): OpenAL Error: The value pointer given is not valid in OgreAL::Sound::initSource


node1 is happy and initialized, so that shouldn't be the problem. Is it possible I did an SVN pull when things weren't quite working right? I pulled at around 3pm Pacific Time on the 11th.

Igor

12-10-2007 04:23:50

Sorry for a certainly stupid post, but do you really have
/resource directory in your system?
maybe it must be ./resource ?

uberglitch

12-10-2007 04:34:35

It is ./resource, but I have the string as /resource/blahblaha for my GUI and meshes and they load fine ><

Thanks for making me double check though.

Igor

12-10-2007 05:48:31

Well, when i hit same exception, i found, that i asked for "music.ogg" and a filename was "Music.ogg" (i'm under windows) that was cool :)
Try following code after call to ResourceGroupManager::getSingleton().initialiseAllResourceGroups():

Ogre::FileInfoListPtr resourceList = ResourceGroupManager::getSingleton().listResourceFileInfo("General");
Ogre::FileInfoList::iterator itr = resourceList->begin();
for(;itr != resourceList->end(); itr++)
{
if(itr->basename.find(".ogg") != Ogre::String::npos){
LogManager::getSingletonPtr()->logMessage( "FOUND ogg:" +itr->basename);
}
}

Does filename of your ogg fall in logs?
If no - this is a problem with resource load, imo

uberglitch

12-10-2007 06:56:21

I inserted the code you gave me, modified to find all files in audio.zip, which generated this:


22:50:06: ==== Starting to iterate through audio ====
22:50:06: FOUND:roar.wav
22:50:06: FOUND:testaudio1.ogg
22:50:06: ==== Finished iterating through audio ====


I set the search term back to ".ogg" and it still found it :?


22:52:53: ==== Starting to iterate through audio ====
22:52:53: FOUND:testaudio1.ogg
22:52:53: ==== Finished iterating through audio ====


So it is being found as a resource... Can OgreAL decode streams from within zip archives?

uberglitch

12-10-2007 07:19:22

That was it!

I changed the resource type to be FileSystem, extracted it from the zip into resource/audio and it works. This also solves my .wav file problem.

So the remaining question is, how can I coax OgreAL into working with my archives? I'd really like to be able to compress all this audio.

CaseyB

12-10-2007 07:19:37

Can OgreAL decode streams from within zip archives?Not yet. At the moment I am not using Ogre Resource Manager as I should be, I am just using it to resolve the path to the sound file, but it should still be finding the file you have in your filesystem.