Difference between revisions of "ADPCM Functions"

From Archaic Pixels
Jump to: navigation, search
(ad_read)
(ad_write)
Line 72: Line 72:
 
{|
 
{|
 
|-
 
|-
! ??? ad_write([color=blue]int[/color] ad_addr, [color=red]char[/color] mode, [color=blue]int[/color] buf, [color=blue]int[/color] bytes); [b][ 3.21+ ][/b]
+
! [color=red]char[/color] ad_write([color=blue]int[/color] ad_addr, [color=red]char[/color] mode, [color=blue]int[/color] buf, [color=blue]int[/color] bytes); [b][ 3.21+ ][/b]
 
|-
 
|-
 
|
 
|
Line 78: Line 78:
 
     Write 'bytes' bytes starting at offset 'ad_addr' in adpcm buffer.
 
     Write 'bytes' bytes starting at offset 'ad_addr' in adpcm buffer.
 
     The mode 'mode' determines the meaning of the 'buf' offset.
 
     The mode 'mode' determines the meaning of the 'buf' offset.
 +
 
       Valid modes          Meaning of 'buf'
 
       Valid modes          Meaning of 'buf'
 
       -----------          ----------------
 
       -----------          ----------------
Line 83: Line 84:
 
       2-6                Directly into memory mapped to MMR #'mode'
 
       2-6                Directly into memory mapped to MMR #'mode'
 
       0xFF              Offset in video ram.
 
       0xFF              Offset in video ram.
 +
 
     Non-zero return values indicate errors.
 
     Non-zero return values indicate errors.
 
|}
 
|}
 
  
 
== ad_play ==
 
== ad_play ==

Revision as of 17:44, 13 September 2010

ADPCM Functions

ad_reset

void ad_reset(void); [ 3.02+ ]
 Resets ADPCM hardware.


ad_stop

void ad_stop(void); [ 3.21+ ]
 Stop playing adpcm.


ad_stat

int ad_stat(void); [ 3.21+ ]
    Returns current adpcm status. Return FALSE(0) if adpcm
    playing isn't in progress else non zero value.


ad_trans

char 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

char 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

char 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

 ??? 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.