Heya all. I'm currently trying to get a compressed version of DATAFILE , ala grabber, but it seems that the compression isn't relevant with the way I use, the grabber beat me.
Here is a little test I do for testing if loading is OK, playing, saving.
No crash, but a huge file as big as the whole wav before "compressing"
Here are the functions for saving:
With this I got 129 Meg of wav files compressed into ... 145 Megs compressed datafile !
I must be wrong somewhere ...
If anyone have any idea of WTF 
EDIT: Humpf I'm dumb. I'm just reding somethinh as create_lzss_pack_data in the manual... Am I on the right way ? ...
Of course you could always use .zip files, for example. Allegro uses some crappy compression routines because they don't require additional libraries (like gz).
I am taking a look at zlib. My problem will be to manage the dynamic loading-freeing of songs into memory.
Maybe I will add a special flag into 'SOUND' and some test to see if i should load it, for how long, or if it is a 'permanent' sample.
Making ressources handler is a pain in the ass, but it's a necessary war !
Hi
I don't have that much experience in allegro packfiles, but if you try to compress some data that is already compressed, like mp3, xvid frames, jpeg, you get a bigger file. But I don't think that is the problem in this situation...
And, for a better compression ratio (better than zip) you can try the LZMA SDK. But the encoder is in C++...
I'll give it a try, even if I am better at C ;-p
Maybe it is not exactly what you want but you could look into physfs which is a nice resource handler.
Regards
Umpf ! umperio...
That a great link !
It's free, downloadable, api, doc, binaries, src ! And even a tutorial.
Now the thread is OK :-p
Sound that's writtend directly to a file rarely compresses well, because the data isn't very redundant. If you encode the deltas between successive samples and compress those, it works much better. In other words, the sloping "side" of a sound wave is relatively constant. There's sound formats that already do this but I forget the name. PCM?
ADPCM, Adaptive Differential Pulse Code Modulation. PCM is the standard, uncompressed data.
If you have 129 meg of wav's than I'd look at using OGG files instead.
If you're interested in reading ZIP files, then there's an addon that allows you to do that. See http://www.allegro.cc/forums/thread/467091
For large amounts of sound data, I'd strongly suggest you use some sort of lossy compression (ogg is good, mp3 has legal issues, wma even more so). Unless you do heavy processing on the audio, or use insane compression settings, you should be fine.
For music, you might also want to try tracker music instead of actual audio files; because of the typical repetitiveness of computer game music, tracker files are usually much smaller than audio files.
Finally, consider lowering audio quality. You don't need 96kHz, 24bit 5.1 samples. For a game, most sound effects can be 22.5 kHz, 16 bit, mono (some profit from being stereo though), without making much of an audible difference.
If all else fails, distribute on CD/DVD only
I'd look at using OGG files instead
My bad, I never achieve to make any ogg playing with alogg or dumb+ogg
If you're interested in reading ZIP files
Not for the same thing as the topic, but I take the link ;-)
If all else fails, distribute on CD/DVD only
Since all the game/source/stuff is spread around the world by the magic of internet, it's not possible. And I don't have a kopeck to buy and send some copy.
You could always provide two versions:
One with small size and compressed audio
Other with big size and uncompressed audio.
Perhaps you can even charge a few $ for the uncompressed thingie
WavePack is a good lossless audio compression format but its very slow. It might be good for distributing large wav audio files that you don't want to compress into a lossy format. Just a note: the PACKFILE compresion uses an LZW style compresion that is not audio friendly. Audio data is to complex for LZW style compresion. Maybe its time to create a media friendly compression format that selects the compression based on the contents. Maybe a plug-in style compressor.
?Light bulb
typedef struct C_VTABLE { char *name; /* name of plugin */ char *author; /* Name of author + email address + websit.... */ char *file_ext; /* input extensions that might be relavent to this plug */ int type; /* Type of data this plug in understands: TEXT=0, BIN=1, * BITMAP=2, AUDIO=3, VIDEO=4... */ int init_compressor(DC, format_info, ...); void *compress(DC, void *src, int size_in, int *size_out); int init_decompressor(DC, format_info, ...); void *decompress(DC, void *src, int size_in, int *size_out); } C_VTABLE;
Ron Novy, that's a nice start. I'm still waiting for the plug