Read zip archives in IrrKlang

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Read zip archives in IrrKlang

Post 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)
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post 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)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Post by elvman »

createAudioStream is a member function of IAudioStreamLoader class? But how can I get a pointer to it?
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Post 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?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post 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*...)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Post by elvman »

Please help anybody! I have to finish my project tomorrow!
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Then finish your project without putting the audio files inside zip archives.
execute
Posts: 14
Joined: Wed Nov 22, 2006 7:48 pm

Post by execute »

Try looking at the tutorials for irrKlang or looking in the forums.
elvman
Posts: 253
Joined: Sun Sep 17, 2006 9:37 am
Location: Riga, Latvia
Contact:

Post 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?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post 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.
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Re: Read zip archives in IrrKlang

Post by stefbuet »

This is not thread safe when using streamed files.
Sometimes I'm having bad crashes using this.
CuteAlien wrote:coders are well-known creatures of the night
Post Reply