View Single Post
Old 20-04-14, 20:47   #508
Turbo Pascal
Student
 
Join Date: Jan 2004
Location: Central America
Posts: 111
Default

Hi Ensi.

Cdaudio.wav is just a simple *.wav collection files embeded in one big file with a header chunk; every wave inside is a full wave file, if you extract one wave chunk and save it like file01.wav then you can play that file with any wave player.

You will need to found a C++ lib that open *.wav file but from stream memory instead from file disk ( i mean, instead passing the file name you also have option to pass the stream and the offset position in memory).

This Lib has to be capable to read ADPCM data and give you back normal PCM data to feed your openal buffer; even better if that lib can play directly the sound.

Cdaudio.wav file format:
================

It has two sections:
- Directory section with fixed amount entries, where every entry store a filename, a file offset position and a file size.
- Full wave files stored one after other.

* Directory section.
If i remember well there is space for 128 entries (you have to check yourself) some entries are unused (free or blanks) in the original cdadio.wad; first two entries are blanks entries.

Entry format is:
- 260 bytes, File name description.
- 4 Bytes, File offset where the wave sound begins. This value start counting after the directory section; so you have to add to this value the file directory section size to get the real file position inside cdaudio.wav.
- 4 bytes, File wave size; with this pair offset/size you can extract the sound chunk and/or pass to your C++ library to play this sound.

Good luck.
Turbo Pascal is offline   Reply With Quote