Author Topic: Read audio files from a .zip?  (Read 146 times)

stoneageartisans

  • Posts: 1
Read audio files from a .zip?
« on: 12 Nov '17 - 21:47 »
Can BASS read audio files that are stored inside a .zip file or other type of compressed archive? If not, is there another library that can create an input stream to an audio file inside a .zip file that could be usable by BASS? I have all my assets inside a .zip for easy deployment and I would like my sound assets to be in the same zip.

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: Read audio files from a .zip?
« Reply #1 on: 13 Nov '17 - 14:45 »
BASS doesn't support archives itself, but you could use a 3rd-party library to decompress the files for BASS. There are a couple of ways you could do that: decompress the entire file to memory (or disk) and pass that to BASS_StreamCreateFile, or decompress the file data as it is needed with BASS_StreamCreateFileUser (your FILEREADPROC callback function would get decompressed data from the library). If you need seeking, then I think the former would be the only option. If the files aren't very large, the former would probably be best (and simplest) for that too, otherwise you could try the latter. There are several ZIP libraries available (mostly based on zlib).