ADPCM Functions
From Archaic Pixels
Revision as of 00:58, 13 September 2010 by Gravis (Talk | contribs) (Created page with "** ADPCM FUNCTIONS ** --------------------- ad_reset(); [3.02+] Resets ADPCM hardware. ad_stop(); [3.21+] Stop playing adpcm. ad_stat(); ...")
- ADPCM FUNCTIONS **
ad_reset(); [3.02+]
Resets ADPCM hardware.
ad_stop(); [3.21+]
Stop playing adpcm.
ad_stat(); [3.21+]
Returns current adpcm status. Return FALSE(0) if adpcm
playing isn't in progress else non zero value.
ad_trans(int ovl_index, int sect_offset, char nb_sectors, int ad_addr); [3.21+]
Transfer data from CDROM into adpcm buffer.
Read it from the overlay segment specified by 'ovl_idx', with sector
offset (ie. multiples of 2048 bytes) of 'sect_offset'.
Read 'nb_sectors' sectors and store data into adpcm buffer starting
from offset 'ad_addr'.
Non-zero return values indicate errors.
ad_read(int ad_addr, char mode, int buf, int bytes); [3.21+]
Read data from the adpcm buffer.
Read 'bytes' bytes starting at offset 'ad_addr' in adpcm buffer.
The mode 'mode' determines the meaning of the 'buf' offset.
Valid modes Meaning of 'buf'
----------- ----------------
0 Offset in the mapped ram.
2-6 Directly into memory mapped to MMR #'mode'
0xFF Offset in video ram.
Non-zero return values indicate errors.
ad_write(int ad_addr, char mode, int buf, int bytes); [3.21+]
Write data into the adpcm buffer.
Write 'bytes' bytes starting at offset 'ad_addr' in adpcm buffer.
The mode 'mode' determines the meaning of the 'buf' offset.
Valid modes Meaning of 'buf'
----------- ----------------
0 Offset in the mapped ram.
2-6 Directly into memory mapped to MMR #'mode'
0xFF Offset in video ram.
Non-zero return values indicate errors.
ad_play(int ad_addr, int bytes, char freq, char mode); [3.21+]
Play adpcm sound from data loaded in the adpcm buffer.
Start playing from 'ad_addr' offset in the adpcm buffer, for 'bytes' bytes.
The frequency used for playback is computed from 'freq' using the
following formula : real_frequency_in_khz = 32 / (16 - 'freq'). Valid range
for 'freq' is 0-15.
If bit 0 of 'mode' is on, values of 'ad_addr', 'bytes' and 'freq' from
the previous ad_play call are reused.
If bit 7 of 'mode' is on, playback loops instead of stopping at the end
of the range.