OgreAl and Ogre resource system


09-02-2007 11:39:12


I am trying out OgreAl and it is really great, very well thought out
and programmed!

I have developed my own Archive type and plugged it into
Ogre::ArchiveManager (to obfuscate the media). But OgreAl
uses direct access to files to load Wav and Ogg:
alutLoadWAVFile() and ov_open().
This obviously restricts putting sound files in ZIP archives or
other user defined Ogre archives.

Would it be possible to use Ogre DataStreams instead and
replace with calls to alutCreateBufferFromFileImage() and

And this is probably related to OpenAl, but has anyone noticed:
1. When ogg sound stream finishes playing, I always hear a
kind of click. Is there a way to get rid of it?

2. Sometimes sound does not play at all or stops earlier than
expected. May be it is because I attach several sounds to the same



09-02-2007 13:42:31

The click sounds like it's actually in your sound file. I might be wrong, but if the waveform doesn't dissipate in a natural manner (is just cut off) it has a tenancy to sound like a click.

As for the Ogre Archive manager, If you could send me the code for your ArchiveManager plugin, I'll happily look at it and see what I can do about merging it into the development version. I think that would be a good feature to have, and one that a lot of people would appreciate (I'll see what's done about the script parser and possibly even write another script format for making sounds, sound sequences, distortion effects, and setting initial properties similar to Ogre's particle system)


09-02-2007 15:20:49

You are probably right about sound file being cut. Do you know
any (free) tools which could help me to fix it (make it dissipate)?

Regarding my ArchiveManager plugin - it is nothing special,
it is very similar to Zip. If you can manage to make OgreAl
play sounds from Zip file (in resources.cfg Zip=myfile.zip, and myfile.zip contains sound.ogg),
then I will be all set!

Basically changes should be done in three files:

For instance, in OgreALWavSound.cpp:

alutLoadWAVFile(filename, &mFormat, &mData, &mSize, &mFreq, &mLoop);

should be changed to something similar to:

DataStreamPtr stream = ResourceGroupManager::getSingleton().openResource(filename);
size_t size = stream->size();
char* buf = new char[size];
stream->read(buf, size);
mData = alutLoadMemoryFromFileImage(buf, size, &mFormat, &mSize, &mFreq);
delete[] buf;

It will be a little harder to do it for ogg, but it has callbacks
(via ov_open_callbacks()), which nicely map to Ogre::DataStream


09-02-2007 15:24:13

Resource management is one of the things that is slated for v0.3, I have several ideas floating around in my head. Tying in to the Ogre Resource system is one of them, but were also going to have to manages sources and buffer since there are a finite number of those.

Hmmm, the click could be in your audio, or it could be an OpenAL issue, did you grab the latest SDK and drivers for your sound card? As for the sounds not playing, I'll look into that, I have never tried attaching several sounds to the same node. Are they Sounds or SoundStream? Ogg or Wav? Glad you like OgreAL, thanks for checking it out.