BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
trackerlib.c File Reference
#include "blitzlib.h"
#include <stddef.h>
#include <proto/dos.h>

Data Structures

struct  module
struct  voice
struct  modsampinfo
struct  modsample
struct  modhead

Macros

#define __NOLIBBASE__
#define INTLEVEL   0x8025
#define CIAAPRA   (*(volatile UBYTE *)0xbfe001)
#define mt_samplestarts   mt.samplestarts
#define mt_voices   mt.voices
#define RW(r, o)
#define RL(r, o)
#define SINFO(off, f)

Functions

void doplaymod (void)
void b_doplaymod (void)
void dostopmod (void)
void b_dostopmod (void)
void trackerlib_codefinit (void)
void freemod (void)
void freemod_b (void)
void myint (void)
void playchk (void)
static void mt_delay (void)
static void mt_init (ULONG len)
static void mt_end (void)
static void mt_arpeggio (struct voice *v, ULONG aud)
static void mt_setmyport (struct voice *v)
static void mt_myport (struct voice *v, ULONG aud)
static void mt_vib (struct voice *v, ULONG aud)
static void mt_volslide (struct voice *v, ULONG aud)
static void mt_portup (struct voice *v, ULONG aud)
static void mt_portdown (struct voice *v, ULONG aud)
BL_ALWAYS_INLINE void mt_checkcom (struct voice *v, ULONG aud)
BL_ALWAYS_INLINE void mt_checkcom2 (struct voice *v, ULONG aud)
BL_ALWAYS_INLINE void mt_playvoice (struct voice *v, ULONG aud, const UBYTE *note, const UBYTE *sinfo)
static void mt_music (void)
static void myint_c (void)
void doloadmod (const UBYTE *name, struct DosLibrary *DOSBase)
 LoadModule Module#,Filename$ - load a Sound/NoiseTracker module into chip memory (Amiga mode only).
static void freemod2 (struct module *m, int blitz)
static void stopmod2 (int blitz)
static void playmod2 (int blitz)
static void doplaymod_a (void)
 PlayModule Module# - start playing a module (Amiga / Blitz mode variant).
static void doplaymod_b (void)
 PlayModule Module# - the Blitz mode variant (BLibJsr).
static void dostopmod_a (void)
 StopModule - stop the module (Amiga mode variant; also the library's finit).
static void dostopmod_b (void)
 StopModule - the Blitz mode variant (BLibJsr).
static void freemod_a (void)
 Free Module (the object library's _free; Amiga / Blitz mode variant) - stop the module if it is playing, free its memory.
static void freemod_b_c (void)
 BLITZ_ALIAS (b_doplaymod, doplaymod_b)
 BLITZ_ALIAS (b_dostopmod, dostopmod_b)
static void playchk_c (void)

Variables

static UBYTE * mt_data
static UBYTE mt_speed = 6
static UBYTE mt_songpos
static UWORD mt_pattpos
static UBYTE mt_counter
static UBYTE mt_break
static UWORD mt_dmacon
struct { 
   UBYTE *   samplestarts [31] 
   struct voice   voices [4] 
} mt = { .voices = { { .dmabit = 1 }, { .dmabit = 2 }, { .dmabit = 4 }, { .dmabit = 8 } } }
static const UBYTE mt_sin [32]
static const UWORD mt_periods [38]
static const char mess1 [] = "Error Accessing Module File"
const char mess2 []

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ CIAAPRA

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

◆ INTLEVEL

#define INTLEVEL   0x8025

◆ mt_samplestarts

#define mt_samplestarts   mt.samplestarts

◆ mt_voices

#define mt_voices   mt.voices

◆ RL

#define RL ( r,
o )
Value:
(*(volatile ULONG *)((r) + (o)))

◆ RW

#define RW ( r,
o )
Value:
(*(volatile UWORD *)((r) + (o))) /* AUDx register */

◆ SINFO

#define SINFO ( off,
f )
Value:
(*(const UWORD *)(sinfo + (off) + offsetof(struct modsampinfo, f)))
Definition trackerlib.c:198

Function Documentation

◆ b_doplaymod()

void b_doplaymod ( void )

◆ b_dostopmod()

void b_dostopmod ( void )

◆ BLITZ_ALIAS() [1/2]

BLITZ_ALIAS ( b_doplaymod ,
doplaymod_b  )

◆ BLITZ_ALIAS() [2/2]

BLITZ_ALIAS ( b_dostopmod ,
dostopmod_b  )

◆ doloadmod()

void doloadmod ( const UBYTE * name,
struct DosLibrary * DOSBase )

LoadModule Module#,Filename$ - load a Sound/NoiseTracker module into chip memory (Amiga mode only).

Frees the old module (stopping it if it is playing), takes the length from Examine (FileInfoBlock from memlib), allocates chip memory and reads the file in one Read.

Errors: "Error Accessing Module File" (runtime error also without the debugger, its message in the normal code: fixed, #957) for a missing file or a directory, or when the file cannot be opened.

Fixed (#296): on that error the FileInfoBlock is freed and the lock released (the original kept both; a missing file was Examined with lock 0).

Parameters
named1: the file name; a3: the module object
DOSBasea6: dos.library

◆ doplaymod()

void doplaymod ( void )

◆ doplaymod_a()

void doplaymod_a ( void )
static

PlayModule Module# - start playing a module (Amiga / Blitz mode variant).

mt_init on the module (highest pattern, sample numbers above 31 cleared in the patterns, sample starts, clears the first long of each sample, filter off, speed 6), then the vertical blank interrupt (intlib SetInt $C100, level $8025; ALibJsr / BLibJsr) calls mt_music every frame. a3: the module object.

Errors (debugger, playchk): "Uninitialized Module".

◆ doplaymod_b()

void doplaymod_b ( void )
static

PlayModule Module# - the Blitz mode variant (BLibJsr).

◆ dostopmod()

void dostopmod ( void )

◆ dostopmod_a()

void dostopmod_a ( void )
static

StopModule - stop the module (Amiga mode variant; also the library's finit).

ClrInt $C101 (level $8025), then mt_end: volumes 0, audio DMA off.

◆ dostopmod_b()

void dostopmod_b ( void )
static

StopModule - the Blitz mode variant (BLibJsr).

◆ freemod()

void freemod ( void )

◆ freemod2()

void freemod2 ( struct module * m,
int blitz )
static

◆ freemod_a()

void freemod_a ( void )
static

Free Module (the object library's _free; Amiga / Blitz mode variant) - stop the module if it is playing, free its memory.

a3: the module object.

◆ freemod_b()

void freemod_b ( void )

◆ freemod_b_c()

void freemod_b_c ( void )
static

◆ mt_arpeggio()

void mt_arpeggio ( struct voice * v,
ULONG aud )
static

◆ mt_checkcom()

BL_ALWAYS_INLINE void mt_checkcom ( struct voice * v,
ULONG aud )

◆ mt_checkcom2()

BL_ALWAYS_INLINE void mt_checkcom2 ( struct voice * v,
ULONG aud )

◆ mt_delay()

void mt_delay ( void )
inlinestatic

◆ mt_end()

void mt_end ( void )
static

◆ mt_init()

void mt_init ( ULONG len)
static

◆ mt_music()

void mt_music ( void )
static

◆ mt_myport()

void mt_myport ( struct voice * v,
ULONG aud )
static

◆ mt_playvoice()

BL_ALWAYS_INLINE void mt_playvoice ( struct voice * v,
ULONG aud,
const UBYTE * note,
const UBYTE * sinfo )

◆ mt_portdown()

void mt_portdown ( struct voice * v,
ULONG aud )
static

◆ mt_portup()

void mt_portup ( struct voice * v,
ULONG aud )
static

◆ mt_setmyport()

void mt_setmyport ( struct voice * v)
static

◆ mt_vib()

void mt_vib ( struct voice * v,
ULONG aud )
static

◆ mt_volslide()

void mt_volslide ( struct voice * v,
ULONG aud )
static

◆ myint()

void myint ( void )

◆ myint_c()

void myint_c ( void )
static

◆ playchk()

void playchk ( void )

◆ playchk_c()

void playchk_c ( void )
static

◆ playmod2()

void playmod2 ( int blitz)
static

◆ stopmod2()

void stopmod2 ( int blitz)
static

◆ trackerlib_codefinit()

void trackerlib_codefinit ( void )

Variable Documentation

◆ mess1

const char mess1[] = "Error Accessing Module File"
static

◆ mess2

const char mess2[]
extern

◆ [struct]

struct { ... } mt

◆ mt_break

UBYTE mt_break
static

◆ mt_counter

UBYTE mt_counter
static

◆ mt_data

UBYTE* mt_data
static

◆ mt_dmacon

UWORD mt_dmacon
static

◆ mt_pattpos

UWORD mt_pattpos
static

◆ mt_periods

const UWORD mt_periods[38]
static
Initial value:
= {
0x0358, 0x0328, 0x02fa, 0x02d0, 0x02a6, 0x0280, 0x025c, 0x023a, 0x021a,
0x01fc, 0x01e0, 0x01c5, 0x01ac, 0x0194, 0x017d, 0x0168, 0x0153, 0x0140,
0x012e, 0x011d, 0x010d, 0x00fe, 0x00f0, 0x00e2, 0x00d6, 0x00ca, 0x00be,
0x00b4, 0x00aa, 0x00a0, 0x0097, 0x008f, 0x0087, 0x007f, 0x0078, 0x0071,
0x0000, 0x0000,
}

◆ mt_sin

const UBYTE mt_sin[32]
static
Initial value:
= {
0x00, 0x18, 0x31, 0x4a, 0x61, 0x78, 0x8d, 0xa1, 0xb4, 0xc5, 0xd4, 0xe0,
0xeb, 0xf4, 0xfa, 0xfd, 0xff, 0xfd, 0xfa, 0xf4, 0xeb, 0xe0, 0xd4, 0xc5,
0xb4, 0xa1, 0x8d, 0x78, 0x61, 0x4a, 0x31, 0x18,
}

◆ mt_songpos

UBYTE mt_songpos
static

◆ mt_speed

UBYTE mt_speed = 6
static

◆ samplestarts

UBYTE* samplestarts[31]

◆ voices

struct voice voices[4]