Question about programming and compression

Hello readers, i was wondering if i was to compress files music for example or any kind of file. Could it be properly used in my program or it would have to be uncompressed? If so would it cause delay in usage speed or anything?
According to me it depends on what you mean by compressing...
If you mean that you want to "box" your file for storing purpose, then "unbox" it and use it in your program (for example zip it and then unzip it), then there would probably be some overhead.
If you simply want to create a new file which contains "a little less information" than the original one (such as MP3 compared to WAV) then I don't think there would be any delay.
Last edited on
Could it be properly used in my program or it would have to be uncompressed?
It would have to be uncompressed. You do not have to store uncompressed file on disc: you can uncompress direcly in memory (as you probably want to load it anyway)

would it cause delay in usage speed or anything?
Launch any game. It uses compressed resources. MPQ files common in blizzard games? Archives. Pak files common for Q3 engine games? Zip archives.

One common optimisation for supporting games for machines which barely meet minimal system requirements to be able to play normally is to unpack all resources game uses. Increase in speed is not really noticeable.
Thats probably the term i am looking for. I wish to compress the resources of my game but still use them. How would i go about this, Thanks for replying by the way.
Read on compression algorithms, implement one in your program (or get a library). Save compressed files and unpack them in memory. You can use boost::iostream for that: http://www.boost.org/doc/libs/1_40_0/libs/iostreams/doc/classes/zlib.html#examples
Topic archived. No new replies allowed.