Page 1 of 1

(C++) Integrating Audiere With Irrlicht Zip File System

Posted: Thu Mar 09, 2006 10:15 am
by jdoyle1983
Hopefully this a suitable location for this post, I couldn't find anything in the forums (although I didn't really look that hard.) I hope this this will be usefull to some:

I'm going to leave a lot of details out here, assuming the user already knows how to setup Irrlicht / Audiere, so not a bunch of details, just implementation:

For simplicity sake, I'm using full namespace for both libs.

Here it is, in 9 Actual Lines of Code:

Code: Select all

//First, we create the file system
irr::io::IFileSystem* fs = device->getFileSystem();

//Next, we add our zip archive
fs->addZipFileArchive("//path//to//archive");

//Next, load up our file (any supported by Audiere)
irr::io::IReadFile* rf = fs->createAndOpenFile("filename");

//Make room to copy our buffer temporarily
void* buffer = malloc(rf->getSize());

//Read our buffer
rf->read(buffer,rf->getSize());

//Create a file pointer object, Audiere makes a copy of this buffer
audiere::FilePtr mf = audiere::CreateMemoryFile(buffer,rf->getSize());

//Since Audiere made a copy, we can get rid of it
free(buffer);

//Get Rid of Drop our Opened File
fs->drop();

//Load up the audiere stream, when using this route, I have found that
//you cannot trust Audiere to Auto-Detect, to be safe, specify the file
//type.
audiere::OutputStreamPtr stream = audiere::OpenSound(aud_device,mf,true,audiere::FF_MP3);

I'm sure someone could go all out and class crazy and make a nice wrapper for both, but I'm working on a large project, and 9 lines if good enough..... :lol: :lol: :lol:

Posted: Mon May 10, 2010 8:08 pm
by Bate
Thank you.

I know it's an old thread but since nobody replied I just want you to know that sharing was not in vain. ;)

Posted: Tue May 11, 2010 8:43 am
by eye776
Yeah, this helped me too.
I know audiere is old and lacks updates, but the SoundManager I wrote using it still works great, and I'll stick to it till something better comes along. (I even have fake 3d sounds and listener implemented).