BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
ritrackerlib.c File Reference
#include "blitzlib.h"
#include <stddef.h>
#include <hardware/custom.h>
#include <exec/execbase.h>

Data Structures

struct  chan
struct  ptdata
struct  ptglue

Macros

#define CUSTOM   (*(volatile struct Custom *)0xdff000)
#define CIAAPRA   (*(volatile UBYTE *)0xbfe001)
#define CIABTALO   (*(volatile UBYTE *)0xbfd400)
#define CIABTAHI   (*(volatile UBYTE *)0xbfd500)
#define CIABICR   (*(volatile UBYTE *)0xbfdd00)
#define PERIOD(off)
#define SAMPLESTART(off)
#define W(p)

Functions

void _initmodule (void)
void ritrackerlib_mt_music (void)
void _stopmodule (void)
void _trackSetDMA (void)
void _tracker (void)
void _trackermask (void)
void _trackerpause (void)
void ritrackerlib_libinit (void)
void ritrackerlib_libfinit (void)
static void mt_end (void)
static void mt_music_c (void)
static void checkmoreefx (aud_t *hw, struct chan *c)
static void dmawait (void)
static UWORD cmdword (const struct chan *c)
static void settempo (UWORD tempo)
static void l6_int (void)
static void ciaplayerinit_unreached (void)
static void ciaplayerinit (void)
static void ciaplayerfinit (void)
static void mt_init (void)
static void mt_pernop (aud_t *hw, struct chan *c)
static void mt_updatefunk (struct chan *c)
static void mt_arpeggio (aud_t *hw, struct chan *c)
static void nor_trackevent (struct chan *c)
static void mt_portaup (aud_t *hw, struct chan *c)
static void mt_fineportaup (aud_t *hw, struct chan *c)
static void mt_portadown (aud_t *hw, struct chan *c)
static void mt_fineportadown (aud_t *hw, struct chan *c)
static void mt_settoneporta (struct chan *c)
static void mt_toneportnochange (aud_t *hw, struct chan *c)
static void mt_toneportamento (aud_t *hw, struct chan *c)
static void mt_vibrato2 (aud_t *hw, struct chan *c)
static void mt_vibrato (aud_t *hw, struct chan *c)
static void mt_tremolo (aud_t *hw, struct chan *c)
static void mt_sampleoffset (struct chan *c)
static void mt_volslideup (aud_t *hw, struct chan *c, UBYTE amount)
static void mt_volslidedown2 (aud_t *hw, struct chan *c, UBYTE amount)
static void mt_volumeslide (aud_t *hw, struct chan *c)
static void mt_pj2 (void)
static void mt_positionjump (struct chan *c)
static void mt_patternbreak (struct chan *c)
static void mt_volumechange (aud_t *hw, struct chan *c)
static void mt_setspeed (struct chan *c)
static void mt_doretrig (aud_t *hw, struct chan *c)
static void mt_e_commands (aud_t *hw, struct chan *c)
static void mt_checkefx (aud_t *hw, struct chan *c)
static void setperiod_regs (aud_t *hw, struct chan *c)
static void mt_setperiod (aud_t *hw, struct chan *c)
static void mt_playvoice (aud_t *hw, struct chan *c, ULONG *patpos, UBYTE *sampleinfo)
static void libinit_c (void)
 init: nothing plays yet (playing = 0).
static void libfinit_c (void)
 finit: silence the voices (mt_end) if TrackInit was called.
static void tracker_c (UBYTE on)
 Tracker on+off: switch the player on or off.
static void initmodule_c (UBYTE *module)
 TrackInit address: initialise a module and enable playing.
static void tracksetdma_c (UWORD wait)
 TrackDMA dmawait.w: the DBRA count of the waits for Paula's DMA.
static void stopmodule_c (void)
 TrackStop: stop playing (mt_end: volumes 0, audio DMA off).
static void trackerpause_c (UBYTE pause)
 TrackerPause On|Off: pause or continue the module.
static void cut (aud_t *hw)
static void trackermask_c (UBYTE mask)
 TrackerChannels mask: the voices to play.
static void music_c (void)
 TrackPlay: one tick of the play routine (mt_music).

Variables

static struct ptdata pt
static struct ptglue glue = { .realtempo = 125 }
static UBYTE * patdata
static struct AudChannel muted
static aud_t * voicehw [4]

Macro Definition Documentation

◆ CIAAPRA

#define CIAAPRA   (*(volatile UBYTE *)0xbfe001)

◆ CIABICR

#define CIABICR   (*(volatile UBYTE *)0xbfdd00)

◆ CIABTAHI

#define CIABTAHI   (*(volatile UBYTE *)0xbfd500)

◆ CIABTALO

#define CIABTALO   (*(volatile UBYTE *)0xbfd400)

◆ CUSTOM

#define CUSTOM   (*(volatile struct Custom *)0xdff000)

◆ PERIOD

#define PERIOD ( off)
Value:
(*(UWORD *)((UBYTE *)&pt + offsetof(struct ptdata, periods) + (off)))
UWORD periods[16][96]
Definition medlib.c:387
static struct ptdata pt
Definition ritrackerlib.c:235

◆ SAMPLESTART

#define SAMPLESTART ( off)
Value:
(*(UBYTE **)((UBYTE *)&pt + offsetof(struct ptdata, samplestarts) + (off)))
UBYTE * samplestarts[31]
Definition trackerlib.c:189

◆ W

#define W ( p)
Value:
(*(UWORD *)(p))

Function Documentation

◆ _initmodule()

void _initmodule ( void )

◆ _stopmodule()

void _stopmodule ( void )

◆ _tracker()

void _tracker ( void )

◆ _trackermask()

void _trackermask ( void )

◆ _trackerpause()

void _trackerpause ( void )

◆ _trackSetDMA()

void _trackSetDMA ( void )

◆ checkmoreefx()

void checkmoreefx ( aud_t * hw,
struct chan * c )
static

◆ ciaplayerfinit()

void ciaplayerfinit ( void )
static

◆ ciaplayerinit()

void ciaplayerinit ( void )
static

◆ ciaplayerinit_unreached()

void ciaplayerinit_unreached ( void )
static

◆ cmdword()

UWORD cmdword ( const struct chan * c)
static

◆ cut()

void cut ( aud_t * hw)
static

◆ dmawait()

void dmawait ( void )
static

◆ initmodule_c()

void initmodule_c ( UBYTE * module)
static

TrackInit address: initialise a module and enable playing.

mt_init: the sample starts behind the highest pattern, song position 0 (its sample clearing: Fixed (#570); its pattern scan: Fixed (#477)). Also while Tracker Off, where mt_init leaves the filter and the voices alone; Tracker On then plays this module (Fixed (#573): the original's mt_init did nothing, and Tracker On played the old song). The program calls TrackPlay itself (the CIA interrupt setup is dead).

Parameters
moduled0: the module (a Protracker file in memory, 31 samples, "M.K."; not checked)

◆ l6_int()

void l6_int ( void )
static

◆ libfinit_c()

void libfinit_c ( void )
static

finit: silence the voices (mt_end) if TrackInit was called.

◆ libinit_c()

void libinit_c ( void )
static

init: nothing plays yet (playing = 0).

◆ mt_arpeggio()

void mt_arpeggio ( aud_t * hw,
struct chan * c )
static

◆ mt_checkefx()

void mt_checkefx ( aud_t * hw,
struct chan * c )
static

◆ mt_doretrig()

void mt_doretrig ( aud_t * hw,
struct chan * c )
static

◆ mt_e_commands()

void mt_e_commands ( aud_t * hw,
struct chan * c )
static

◆ mt_end()

void mt_end ( void )
static

◆ mt_fineportadown()

void mt_fineportadown ( aud_t * hw,
struct chan * c )
static

◆ mt_fineportaup()

void mt_fineportaup ( aud_t * hw,
struct chan * c )
static

◆ mt_init()

void mt_init ( void )
static

◆ mt_music_c()

void mt_music_c ( void )
static

◆ mt_patternbreak()

void mt_patternbreak ( struct chan * c)
static

◆ mt_pernop()

void mt_pernop ( aud_t * hw,
struct chan * c )
static

◆ mt_pj2()

void mt_pj2 ( void )
static

◆ mt_playvoice()

void mt_playvoice ( aud_t * hw,
struct chan * c,
ULONG * patpos,
UBYTE * sampleinfo )
static

◆ mt_portadown()

void mt_portadown ( aud_t * hw,
struct chan * c )
static

◆ mt_portaup()

void mt_portaup ( aud_t * hw,
struct chan * c )
static

◆ mt_positionjump()

void mt_positionjump ( struct chan * c)
static

◆ mt_sampleoffset()

void mt_sampleoffset ( struct chan * c)
static

◆ mt_setperiod()

void mt_setperiod ( aud_t * hw,
struct chan * c )
static

◆ mt_setspeed()

void mt_setspeed ( struct chan * c)
static

◆ mt_settoneporta()

void mt_settoneporta ( struct chan * c)
static

◆ mt_toneportamento()

void mt_toneportamento ( aud_t * hw,
struct chan * c )
static

◆ mt_toneportnochange()

void mt_toneportnochange ( aud_t * hw,
struct chan * c )
static

◆ mt_tremolo()

void mt_tremolo ( aud_t * hw,
struct chan * c )
static

◆ mt_updatefunk()

void mt_updatefunk ( struct chan * c)
static

◆ mt_vibrato()

void mt_vibrato ( aud_t * hw,
struct chan * c )
static

◆ mt_vibrato2()

void mt_vibrato2 ( aud_t * hw,
struct chan * c )
static

◆ mt_volslidedown2()

void mt_volslidedown2 ( aud_t * hw,
struct chan * c,
UBYTE amount )
static

◆ mt_volslideup()

void mt_volslideup ( aud_t * hw,
struct chan * c,
UBYTE amount )
static

◆ mt_volumechange()

void mt_volumechange ( aud_t * hw,
struct chan * c )
static

◆ mt_volumeslide()

void mt_volumeslide ( aud_t * hw,
struct chan * c )
static

◆ music_c()

void music_c ( void )
static

TrackPlay: one tick of the play routine (mt_music).

Called by the program once per tick (e.g. from a SetInt 5 vertical blank handler); does nothing unless playing is enabled and Tracker is on. The known PT2.3A bugs of the routine are listed in the head of the file. Returns nothing (all registers kept).

◆ nor_trackevent()

void nor_trackevent ( struct chan * c)
static

◆ ritrackerlib_libfinit()

void ritrackerlib_libfinit ( void )

◆ ritrackerlib_libinit()

void ritrackerlib_libinit ( void )

◆ ritrackerlib_mt_music()

void ritrackerlib_mt_music ( void )

◆ setperiod_regs()

void setperiod_regs ( aud_t * hw,
struct chan * c )
inlinestatic

◆ settempo()

void settempo ( UWORD tempo)
static

◆ stopmodule_c()

void stopmodule_c ( void )
static

TrackStop: stop playing (mt_end: volumes 0, audio DMA off).

The module address goes to mt_olddata, which nothing reads.

◆ tracker_c()

void tracker_c ( UBYTE on)
static

Tracker on+off: switch the player on or off.

Nothing happens if the status does not change. 0: mt_end (voices silent, audio DMA off) and status off; else status on. Off keeps mt_Enable, so On continues a module that was playing (Fixed (#572): the original cleared it with mt_end and On only ANDed it, so the song stayed stopped until TrackInit or TrackerPause 0); a module stopped or paused before Off stays stopped. While off, TrackInit initialises the song but leaves the hardware alone (Fixed (#573)).

Parameters
ond0.b: 0 off, else on (any nonzero byte)

◆ trackermask_c()

void trackermask_c ( UBYTE mask)
static

TrackerChannels mask: the voices to play.

Bit 3 = voice 1 ... bit 0 = voice 4 (default 15). A cleared voice's pointer, length, period and volume are zeroed and its audio DMA is switched off; the play routine writes its registers into a block nobody reads, so no effect and no loop pointer reaches it (Fixed (#567): the original left the DMA on and still wrote the effects of the ticks between the rows and mt_SetDMA's loop pointers to Paula). A masked voice still plays its notes, silently: its n_dmabit is 0, so it switches no DMA, and its effects (speed, jumps, breaks) apply (Fixed (#568): the original skipped its notes, and the following voices played the notes of the voice before).

Parameters
maskd0.b: the voice bits

◆ trackerpause_c()

void trackerpause_c ( UBYTE pause)
static

TrackerPause On|Off: pause or continue the module.

Nonzero stops (mt_end), 0 continues (_contmodule): enables playing and plays one tick at once.

Parameters
paused0.b: nonzero pause, 0 continue

◆ tracksetdma_c()

void tracksetdma_c ( UWORD wait)
static

TrackDMA dmawait.w: the DBRA count of the waits for Paula's DMA.

The waits run DMA_Wait + 1 passes; the default is 4000.

Parameters
waitd0.w: the count

Variable Documentation

◆ glue

struct ptglue glue = { .realtempo = 125 }
static

◆ muted

struct AudChannel muted
static

◆ patdata

UBYTE* patdata
static

◆ pt

struct ptdata pt
static

◆ voicehw

aud_t* voicehw[4]
static
Initial value:
= {
(aud_t *)0xdff0a0, (aud_t *)0xdff0b0, (aud_t *)0xdff0c0, (aud_t *)0xdff0d0
}
volatile struct AudChannel aud_t
Definition ciatrklib.c:375