Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
Macros | Functions | Variables
modplayer-state.c File Reference
#include "common/syscalls/syscalls.h"
#include "modplayer/modplayer.c"
#include "exotic/cester.h"
Include dependency graph for modplayer-state.c:

Macros

#define MODPLAYER_STATE_PLAYER
 
#define CESTER_NO_SIGNAL
 
#define CESTER_NO_TIME
 
#define EXIT_SUCCESS   0
 
#define EXIT_FAILURE   1
 

Functions

 CESTER_BODY (static uint8_t s_module __attribute__((aligned(4)));static uint8_t *cell(unsigned row, unsigned channel) { return s_module+sizeof(struct MODFileFormat)+(row *4+channel) *4;} static void setCell(unsigned row, unsigned channel, unsigned sample, unsigned period, unsigned fx, unsigned param) { uint8_t *c=cell(row, channel);c[0]=(sample &0xf0)|(period > > 8);c[1]=period &0xff;c[2]=((sample &0x0f)<< 4)|fx;c[3]=param;} static void buildModule() { __builtin_memset(s_module, 0, sizeof(s_module));struct MODFileFormat *m=(struct MODFileFormat *) s_module;for(unsigned i=0;i< 2;i++) { m->samples[i].lenarr[1]=16;m->samples[i].volume=64;m->samples[i].repeatLength=1;} m->songLength=1;m->signature[0]='H';m->signature[1]='I';m->signature[2]='T';m->signature[3]='4';} static void playThroughRow(unsigned row) { MOD_LoadEx((const struct MODFileFormat *) s_module,(const uint8_t *) -1);for(unsigned i=0;i< row *6+1;i++) MOD_Poll();} static void keyOnsAfterRow0(const char *name, uint8_t *keyOns, unsigned polls) { MOD_LoadEx((const struct MODFileFormat *) s_module,(const uint8_t *) -1);for(unsigned i=0;i< 6;i++) MOD_Poll();ramsyscall_printf("%s: row 0 key-ons %u, then per poll:", name, s_channelData[0].keyOns);for(unsigned i=0;i< polls;i++) { MOD_Poll();keyOns[i]=s_channelData[0].keyOns;ramsyscall_printf(" %u", keyOns[i]);} ramsyscall_printf("\n");}[sizeof(struct MODFileFormat)+4 *0x100+16])
 
 buildModule ()
 
 setCell (0, 0, 1, 428, 0, 0)
 
 setCell (1, 0, 0, 428, 0xe, 0x93)
 
 setCell (1, 1, 0, 0, 0xe, 0xe1)
 
 keyOnsAfterRow0 ("e9x_with_note_pattern_delay", keyOns, 13)
 
 for (unsigned i=0;i< 13;i++) cester_assert_uint_eq(expected[i]
 

Variables

uint8_t keyOns [13]
 

Macro Definition Documentation

◆ CESTER_NO_SIGNAL

#define CESTER_NO_SIGNAL

◆ CESTER_NO_TIME

#define CESTER_NO_TIME

◆ EXIT_FAILURE

#define EXIT_FAILURE   1

◆ EXIT_SUCCESS

#define EXIT_SUCCESS   0

◆ MODPLAYER_STATE_PLAYER

#define MODPLAYER_STATE_PLAYER

Function Documentation

◆ buildModule()

buildModule ( )

◆ CESTER_BODY()

CESTER_BODY ( static uint8_t s_module __attribute__((aligned(4)));static uint8_t *cell(unsigned row, unsigned channel) { return s_module+sizeof(struct MODFileFormat)+(row *4+channel) *4;} static void setCell(unsigned row, unsigned channel, unsigned sample, unsigned period, unsigned fx, unsigned param) { uint8_t *c=cell(row, channel);c[0]=(sample &0xf0)|(period > > 8);c[1]=period &0xff;c[2]=((sample &0x0f)<< 4)|fx;c[3]=param;} static void buildModule() { __builtin_memset(s_module, 0, sizeof(s_module));struct MODFileFormat *m=(struct MODFileFormat *) s_module;for(unsigned i=0;i< 2;i++) { m->samples[i].lenarr[1]=16;m->samples[i].volume=64;m->samples[i].repeatLength=1;} m->songLength=1;m->signature[0]='H';m->signature[1]='I';m->signature[2]='T';m->signature[3]='4';} static void playThroughRow(unsigned row) { MOD_LoadEx((const struct MODFileFormat *) s_module,(const uint8_t *) -1);for(unsigned i=0;i< row *6+1;i++) MOD_Poll();} static void keyOnsAfterRow0(const char *name, uint8_t *keyOns, unsigned polls) { MOD_LoadEx((const struct MODFileFormat *) s_module,(const uint8_t *) -1);for(unsigned i=0;i< 6;i++) MOD_Poll();ramsyscall_printf("%s: row 0 key-ons %u, then per poll:", name, s_channelData[0].keyOns);for(unsigned i=0;i< polls;i++) { MOD_Poll();keyOns[i]=s_channelData[0].keyOns;ramsyscall_printf(" %u", keyOns[i]);} ramsyscall_printf("\n");}   [sizeof(struct MODFileFormat)+4 *0x100+16])

◆ for()

for ( )

◆ keyOnsAfterRow0()

keyOnsAfterRow0 ( "e9x_with_note_pattern_delay"  ,
keyOns  ,
13   
)

◆ setCell() [1/3]

setCell ( 0  ,
0  ,
1  ,
428  ,
0  ,
0   
)

◆ setCell() [2/3]

setCell ( 1  ,
0  ,
0  ,
428  ,
0xe  ,
0x93   
)

◆ setCell() [3/3]

setCell ( 1  ,
1  ,
0  ,
0  ,
0xe  ,
0xe1   
)

Variable Documentation

◆ keyOns

keyOns[i]