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);