Page 1 of 1
Read zip archives in IrrKlang
Posted: Wed Nov 22, 2006 8:43 pm
by elvman
IrrKlang documentation says, that it is possible to read audio streams from zip files. But how to do that? I searched over the internet, but found no information. How can I load sounds from zip archive? Any ideas? Or maybe it isn't possible? If it is not possible then why does it says "irrKlang can read directly from compressed zip files, pak files, memory, and everywhere the Irrlicht Engine can" on the IrrKlang site.
P.S. IrrKlang directed me to this forum (I thought that it is IrrKlang's forum)
Posted: Wed Nov 22, 2006 9:55 pm
by bitplane
you can pass an IReadFile pointer to createAudioStream, in irrlicht you can get an IReadFile pointer by using irrdevice->getFileSystem()->createAndOpenFile("filename"), this will look inside any available zip/pak files (added to the filesystem like in the quake map example)
Posted: Wed Nov 22, 2006 10:06 pm
by elvman
createAudioStream is a member function of IAudioStreamLoader class? But how can I get a pointer to it?
Posted: Wed Nov 22, 2006 10:16 pm
by elvman
OK then. Thisi is my code:
Code: Select all
IReadFile* pFile=m_pIrrlichtDevice->getFileSystem()->createAndOpenFile("Music/5_TUF.OGG");
IAudioStreamLoader* pLoader;
m_pIrrKlangDevice->registerAudioStreamLoader(pLoader);
IAudioStream* pStream=pLoader->createAudioStream(pFile);
But what can I do with this IAudioStream object? How can I play the sound?
Posted: Wed Nov 22, 2006 11:59 pm
by bitplane
oh, my bad. I haven't used irrKlang yet myself and was guessing there.
unless I'm missing something, it looks like irrKlang is missing ISoundEngine::getSoundSource( IReadFile*...)
Posted: Thu Nov 23, 2006 7:44 pm
by elvman
Please help anybody! I have to finish my project tomorrow!
Posted: Fri Nov 24, 2006 2:08 am
by vitek
Then finish your project without putting the audio files inside zip archives.
Posted: Fri Nov 24, 2006 4:35 am
by execute
Try looking at the tutorials for irrKlang or looking in the forums.
Posted: Fri Nov 24, 2006 8:49 am
by elvman
I tryed everything. This forum has almost no information about IrrKlang and there ar no other tutorials than this
short example on the internet. Does the author of IrrKlang come to this forum? Maybe he can help me?
Posted: Sat Jan 13, 2007 8:44 am
by niko
Sorry for the late answer, take a look at this:
http://www.ambiera.com/irrklang/tutoria ... ccess.html
You would only need the second block of code of that tutorial: in CMyFileFactory::createAndOpenFile, just return Irrlicht->getFileSystem()->createAndOpenFile(), and after starting up irrKlang add your file factory it using engine->addFileFactory(factory); like in the tutorial. In this way, irrKlang will use the file system of irrlicht.
You can also change the behavior and make irrklang only read special files using the Irrlicht Filesystem or whatever you like.
Re: Read zip archives in IrrKlang
Posted: Thu Aug 04, 2011 3:01 pm
by stefbuet
This is not thread safe when using streamed files.
Sometimes I'm having bad crashes using this.