|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Data Structures | |
| struct | vhdr |
| struct | opened |
Macros | |
| #define | TOK_iffchunk TOK_ifffind /* "iffchunk" in audiolib */ |
| #define | AUD(ch, off) |
| #define | CIAAPRA (*(volatile UBYTE *)0xbfe001) |
| #define | VHPOSR_B (*(volatile UBYTE *)0xdff006) |
| #define | IFFCALL(tok, r) |
| #define | SND_START(ch, bit) |
| #define | SND_REPEAT(ch, bit) |
Functions | |
| void | dodplay2 (void) |
| void | dodplay (void) |
| void | dodiskbuff (void) |
| void | dofilter (void) |
| void | dovolume (void) |
| void | dosdata (void) |
| SoundData Sound#,Offset,Data: write a byte of the sample (inline MOVE.l (a3),a0:MOVE.b d2,0(a0,d1.l), as in the original). | |
| void | dopsound (void) |
| PeekSound(Sound#,Offset): a byte of the sample, sign extended to a word (inline, as in the original). | |
| void | audiolib_codeinit (void) |
| void | audiolib_codefinit (void) |
| void | dofreesound (void) |
| void | sndchk (void) |
| void | dpchk (void) |
| void | vchk (void) |
| void | ischk1 (void) |
| void | ischk2 (void) |
| void | sdatachk (void) |
| void | setpchk (void) |
| void | doisound2 (void) |
| void | doisound3 (void) |
| void | doisound (void) |
| static UBYTE * | alloc (ULONG size, ULONG flags) |
| static void | dealloc (void *mem, ULONG size) |
| static void | dofilter_c (UWORD on) |
| Filter On|Off: the audio low pass filter (the power LED bit, BCLR/BSET #1,$BFE001). | |
| BLITZ_ALIAS (dofilter, dofilter_c) | |
| static void | dodiskbuff_c (ULONG len) |
| DiskBuffer Bufferlen: the length of each half of DiskPlay's chip buffer (default 1024). | |
| BLITZ_ALIAS (dodiskbuff, dodiskbuff_c) | |
| static BLITZ_ENTRYPOINT void | dovolume_c (UWORD mask, const UBYTE *args) |
| Volume Channelmask,Vol1[,Vol2...]: set the volume of the channels of the mask. | |
| BLITZ_ALIAS_EP (dovolume, dovolume_c) | |
| static void | freesound (struct bb_sound *s) |
| static void | dofreesound_c (void) |
| Free Sound (the object's _free nullsub): free the sample of the sound in a3 (not for "cL" data of DecodeSound). | |
| static int | opensound (const UBYTE *name, struct opened *o, UBYTE *buf) |
| void | doloadsound (const UBYTE *name) |
| LoadSound Sound#,Filename$: load an IFF 8SVX file into the sound. | |
| void | _cludgesound (ULONG *p) |
| DecodeSound Sound#,MemoryLocation: a sound from an 8SVX FORM in memory. | |
| void | _setperiod (UWORD period) |
| SetPeriod Sound#,Period: set the sound's period. | |
| static void | initsound (ULONG len, UWORD period, ULONG rep) |
| static void | doisound2_c (ULONG len) |
| InitSound Sound#,Length: an empty sound of Length bytes in chip memory (cleared), period 428, repeat from the start. | |
| static void | doisound3_c (ULONG len, UWORD period) |
| InitSound Sound#,Length,Period: InitSound with a period. | |
| static void | doisound_c (ULONG len, UWORD period, ULONG rep) |
| InitSound Sound#,Length,Period,Repeat: InitSound with a period and a repeat offset. | |
| BL_ALWAYS_INLINE void | wait12 (void) |
| static UWORD | chansoff (UWORD mask) |
| BL_ALWAYS_INLINE void | playsound (UWORD mask, WORD nvol, int loop, const UBYTE *args) |
| static BLITZ_ENTRYPOINT void | dosound2_c (UWORD mask) |
| Sound Sound#,Channelmask: play the sound once on the channels. | |
| BLITZ_ALIAS_EP (dosound2, dosound2_c) | |
| static BLITZ_ENTRYPOINT void | dosound_c (UWORD mask, WORD nvol, const UBYTE *args) |
| Sound Sound#,Channelmask,Vol1[,Vol2...]: Sound with volumes. | |
| BLITZ_ALIAS_EP (dosound, dosound_c) | |
| static BLITZ_ENTRYPOINT void | dosoundl2_c (UWORD mask) |
| LoopSound Sound#,Channelmask: play the sound and repeat its repeat part. | |
| BLITZ_ALIAS_EP (dosoundl2, dosoundl2_c) | |
| static BLITZ_ENTRYPOINT void | dosoundl_c (UWORD mask, WORD nvol, const UBYTE *args) |
| LoopSound Sound#,Channelmask,Vol1[,Vol2...]: LoopSound with volumes. | |
| BLITZ_ALIAS_EP (dosoundl, dosoundl_c) | |
| static void | intwait (UWORD bits) |
| static LONG | loadbuff (UBYTE **pp, UWORD dma) |
| static void | diskplay (const UBYTE *name, UWORD mask, WORD nvol, const UBYTE *args) |
| static void | dodplay2_c (const UBYTE *name, UWORD mask, const UBYTE *args) |
| DiskPlay Filename$,Channelmask: stream an 8SVX file from disk. | |
| BLITZ_ALIAS (dodplay2, dodplay2_c) | |
| static void | dodplay_c (const UBYTE *name, UWORD mask, WORD nvol, const UBYTE *args) |
| DiskPlay Filename$,Channelmask,Vol1[,Vol2...]: DiskPlay with volumes. | |
| BLITZ_ALIAS (dodplay, dodplay_c) | |
| static void | codeinit_c (void) |
| init: audio DMA and interrupts off, DiskBuffer 1024, a zero word in chip memory (memlib globalloc). | |
| static void | codefinit_c (void) |
| finit: audio DMA off, the volume of all channels 0. | |
| static void | dpchk_c (UWORD mask) |
| static void | sndchk_c (UWORD mask) |
| static void | setpchk_c (void) |
| static void | vchk_c (UWORD mask) |
| static void | ischk1_c (ULONG len) |
| static void | ischk2_c (ULONG len, ULONG rep) |
| static void | sdatachk_c (ULONG off) |
Variables | |
| static ULONG | dbufflen = 1024 |
| static LONG | dlen |
| static UBYTE * | dbuffat |
| static UBYTE * | dbuffend |
| static UWORD * | chzero |
| static const char | mess1 [] = "Illegal Sound file" |
| static const char | mess2 [] = "Can't Find VHDR" |
| static const char | mess3 [] = "Error Reading File" |
| static const char | mess4 [] = "Sound too long" |
| static const char | mess5 [] = "Uninitialized Sound" |
| const char | mess6 [] |
| const char | mess7 [] |
| const char | mess8 [] |
| const char | mess9 [] |
| const char | messa [] |
| #define AUD | ( | ch, | |
| off ) |
| #define CIAAPRA (*(volatile UBYTE *)0xbfe001) |
| #define IFFCALL | ( | tok, | |
| r ) |
| #define TOK_iffchunk TOK_ifffind /* "iffchunk" in audiolib */ |
| #define VHPOSR_B (*(volatile UBYTE *)0xdff006) |
| void _cludgesound | ( | ULONG * | p | ) |
DecodeSound Sound#,MemoryLocation: a sound from an 8SVX FORM in memory.
Looks for VHDR and BODY; chip data (below 2 MB) is used in place ("cL", never freed), other data copied to chip memory. Fixed (#68): freeing the sound clears the "cL" mark, so a later copy of fast memory is freed again. Errors: "Illegal Sound file" (no FORM/8SVX, no VHDR/BODY before the end of the FORM), "Sound too long" (>= 128K). The Sound object comes in a3 (!libs {audiolib,$1380}, from Sound# in d0).
| p | d1: the address of the FORM |
| void _setperiod | ( | UWORD | period | ) |
SetPeriod Sound#,Period: set the sound's period.
Without a sound: runtime error "Uninitialized Sound" (err5, in the normal code; the original branches into the error check area, fixed: #70). Fixed (#66): the error check (setpchk) tests the sound only; the original's sndchk went on into dpchk and tested the period as channel mask: a period > 15 was "Illegal Chanel Mask" with the debugger. The Sound object comes in a3 (!libs {audiolib,$1380}, from Sound# in d0).
| period | d1.w: the period |
|
static |
| void audiolib_codefinit | ( | void | ) |
| void audiolib_codeinit | ( | void | ) |
| BLITZ_ALIAS | ( | dodiskbuff | , |
| dodiskbuff_c | ) |
| BLITZ_ALIAS | ( | dodplay2 | , |
| dodplay2_c | ) |
| BLITZ_ALIAS | ( | dofilter | , |
| dofilter_c | ) |
| BLITZ_ALIAS_EP | ( | dosound | , |
| dosound_c | ) |
| BLITZ_ALIAS_EP | ( | dosound2 | , |
| dosound2_c | ) |
| BLITZ_ALIAS_EP | ( | dosoundl | , |
| dosoundl_c | ) |
| BLITZ_ALIAS_EP | ( | dosoundl2 | , |
| dosoundl2_c | ) |
| BLITZ_ALIAS_EP | ( | dovolume | , |
| dovolume_c | ) |
|
static |
|
static |
finit: audio DMA off, the volume of all channels 0.
|
static |
init: audio DMA and interrupts off, DiskBuffer 1024, a zero word in chip memory (memlib globalloc).
|
static |
|
static |
| void dodiskbuff | ( | void | ) |
|
static |
DiskBuffer Bufferlen: the length of each half of DiskPlay's chip buffer (default 1024).
| len | d0: the length in bytes |
| void dodplay | ( | void | ) |
| void dodplay2 | ( | void | ) |
|
static |
DiskPlay Filename$,Channelmask: stream an 8SVX file from disk.
Through two halves of a chip buffer (DiskBuffer, default 1024 bytes each), waiting for the audio interrupt bits in INTREQR (busy wait, as in the original). Fixed (#69): a BODY whose length is a multiple of the buffer length (or 0) ends; the original never returned. Errors: as LoadSound (no file, no VHDR, read error); (debugger, dpchk) "Illegal Chanel Mask". Fixed (#950): on those errors the chip buffer is freed (the original kept it).
|
static |
| void dofilter | ( | void | ) |
|
static |
Filter On|Off: the audio low pass filter (the power LED bit, BCLR/BSET #1,$BFE001).
Fixed (#985): bit 1 of CIAAPRA is the active-low /LED output (0 = LED bright, filter on; Amiga Hardware Reference Manual): On clears it, Off sets it. The original set it for On (BSET) and so switched the filter off, and Off switched it on.
| on | d0.w: not 0 = on |
| void dofreesound | ( | void | ) |
|
static |
Free Sound (the object's _free nullsub): free the sample of the sound in a3 (not for "cL" data of DecodeSound).
| void doisound | ( | void | ) |
| void doisound2 | ( | void | ) |
|
static |
InitSound Sound#,Length: an empty sound of Length bytes in chip memory (cleared), period 428, repeat from the start.
Errors (debugger, ischk1): "Sound too long" (>= 128K), "Sound Length MUST be even". The Sound object comes in a3 (!libs {audiolib,$1380}, from Sound# in d0).
| len | d1: the length in bytes |
| void doisound3 | ( | void | ) |
|
static |
InitSound Sound#,Length,Period: InitSound with a period.
Errors (debugger, ischk1): as InitSound Sound#,Length. The Sound object comes in a3 (!libs {audiolib,$1380}, from Sound# in d0).
| len | d1: the length in bytes |
| period | d2.w: the period |
|
static |
InitSound Sound#,Length,Period,Repeat: InitSound with a period and a repeat offset.
Errors (debugger, ischk2): as InitSound Sound#,Length, and "Repeat offset MUST be even", "Repeat MUST be less than Length". The Sound object comes in a3 (!libs {audiolib,$1380}, from Sound# in d0).
| void doloadsound | ( | const UBYTE * | name | ) |
LoadSound Sound#,Filename$: load an IFF 8SVX file into the sound.
Through iffiolib: VHDR (repeat start and length, period = 3579440 / samplesPerSec, DIVU: overflow below 55 Hz leaves 3579440), then BODY into chip memory. Errors: "Illegal Sound file" (no file), "Can't Find VHDR", "Error Reading File", "Sound too long" (>= 128K). Fixed (#67): the file is closed before the last three (the original left it open). The Sound object comes in a3 (!libs {audiolib,$1380}, from Sound# in d0).
| name | d1: the file name |
| void dopsound | ( | void | ) |
PeekSound(Sound#,Offset): a byte of the sample, sign extended to a word (inline, as in the original).
a3 = the Sound object (!libs {audiolib,$1380}), d1 = the offset; d0.w = the byte. Fixed (#46): a3 is left as it is; inside a string expression the compiler saves a3 (the end of the string) around the call (eval.c libfunction). Errors (debugger, sdatachk): as SoundData.
| void dosdata | ( | void | ) |
SoundData Sound#,Offset,Data: write a byte of the sample (inline MOVE.l (a3),a0:MOVE.b d2,0(a0,d1.l), as in the original).
a3 = the Sound object (!libs {audiolib,$1380}), d1 = the offset, d2 = the byte. Errors (debugger, sdatachk): "Uninitialized Sound", "Data offset too large".
|
static |
Sound Sound#,Channelmask: play the sound once on the channels.
Switches the channels' DMA off, waits for 12 changes of the VHPOSR line byte, starts the sound on every channel of the mask (volume 64 or the next given one) and after another 12 lines sets a zero word in chip memory as the repeat part. Errors (debugger, sndchk): "Uninitialized Sound", "Illegal Chanel Mask" (mask > 15). The Sound object comes in a3 (!libs {audiolib,$1380}, from Sound# in d0). The four entries are __entrypoint routines (they save nothing and change d0-d6, with volumes d7, and a2; the original changes d0, d2-d4, d6, d7 and a0).
| mask | d1.w: the channel mask |
|
static |
Sound Sound#,Channelmask,Vol1[,Vol2...]: Sound with volumes.
As Sound Sound#,Channelmask, with the volumes from the a2 stack, one per channel of the mask (channel 0 first).
| mask | d1.w: the channel mask |
| nvol | d7.w: the number of volumes |
| args | a2: the compiler's stack with the volumes (words) |
|
static |
LoopSound Sound#,Channelmask: play the sound and repeat its repeat part.
As Sound, but after the second wait the repeat part of the sound is set as the channels' location and length.
| mask | d1.w: the channel mask |
|
static |
LoopSound Sound#,Channelmask,Vol1[,Vol2...]: LoopSound with volumes.
As LoopSound Sound#,Channelmask, with the volumes as Sound.
| mask | d1.w: the channel mask |
| nvol | d7.w: the number of volumes |
| args | a2: the compiler's stack with the volumes (words) |
| void dovolume | ( | void | ) |
|
static |
Volume Channelmask,Vol1[,Vol2...]: set the volume of the channels of the mask.
The volumes from the a2 stack, one per set bit (channel 0 first). Errors (debugger, vchk): "Illegal Chanel Mask" (mask > 15). The four channels unrolled: one bit test and one write to an absolute AUDxVOL each, no loop counter and no address step (the original's LSR/BCC/LEA/DBF loop costs 196 cycles for one channel without the call, this 130).
| mask | d0.w: the channel mask |
| args | a2: the compiler's stack with the volumes (words) |
| void dpchk | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
| void ischk1 | ( | void | ) |
|
static |
| void ischk2 | ( | void | ) |
|
static |
|
static |
|
static |
| BL_ALWAYS_INLINE void playsound | ( | UWORD | mask, |
| WORD | nvol, | ||
| int | loop, | ||
| const UBYTE * | args ) |
| void sdatachk | ( | void | ) |
|
static |
| void setpchk | ( | void | ) |
|
static |
| void sndchk | ( | void | ) |
|
static |
| void vchk | ( | void | ) |
|
static |
| BL_ALWAYS_INLINE void wait12 | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
extern |
| const char mess7[] |
| const char mess8[] |
| const char mess9[] |
| const char messa[] |