7 const u16 instrptr
[] = {
11 const u8 instrdata
[] = {
13 'v', 255, 'm', 0x11, '+', 0, 'w', WF_PUL
, 'f', 0xef, 't', 8, 'f', 0xfc, 0, 0, // lead
14 'v', 255, 'w', WF_NOI
, 't', 2, '+', 0, 'w', WF_SAW
, 'f', 0xef, 't', 8, 'f', 0, 't', 12, '~', 0x37, 'f', 0xfc, 0, 0, // lead+vibr
15 'v', 255, 'w', WF_NOI
, 't', 2, 'm', 0x11, '+', 12, 'w', WF_PUL
, 'f', 0xfc, 't', 2, '+', 7, 't', 2, '+', 3, 't', 2, '+', 0, 't', 2, 'j', 5, 0, 0, // arp
16 'v', 255, 'w', WF_NOI
, 't', 2, 'd', 0x80, '+', 0, 'w', WF_PUL
, 'l', 0x80, 't', 12, 'v', 0, 0, 0 // bass drum
19 const struct track trackdata
= {
21 {12*3+0, 1, {'i', 0}, {0xff, 0}},
22 {12*2+0, 1, {0, 0}, {0, 0}},
23 {12*3+0, 1, {0, 0}, {0, 0}},
24 {12*3+3, 1, {0, 0}, {0, 0}},
25 {12*2+0, 1, {0, 0}, {0, 0}},
26 {12*3+3, 1, {0, 0}, {0, 0}},
27 {12*3+2, 1, {0, 0}, {0, 0}},
28 {12*2+0, 1, {0, 0}, {0, 0}},
29 {12*3+7, 1, {0, 0}, {0, 0}},
30 {12*2+0, 1, {0, 0}, {0, 0}},
31 {12*3+3, 1, {0, 0}, {0, 0}},
32 {12*2+0, 1, {0, 0}, {0, 0}},
33 {12*3+2, 1, {0, 0}, {0, 0}},
34 {12*2+0, 1, {0, 0}, {0, 0}},
35 {12*2+10, 1, {0, 0}, {0, 0}},
36 {12*2+0, 1, {0, 0}, {0, 0}},
37 {12*3+0, 1, {0, 0}, {0, 0}},
38 {12*2+0, 1, {0, 0}, {0, 0}},
39 {12*3+0, 1, {0, 0}, {0, 0}},
40 {12*3+3, 1, {0, 0}, {0, 0}},
41 {12*2+0, 1, {0, 0}, {0, 0}},
42 {12*3+3, 1, {0, 0}, {0, 0}},
43 {12*3+7, 1, {0, 0}, {0, 0}},
44 {12*3+8, 1, {0, 0}, {0, 0}},
45 {12*3+5, 1, {0, 0}, {0, 0}},
46 {12*3+7, 1, {0, 0}, {0, 0}},
47 {12*3+3, 1, {0, 0}, {0, 0}},
48 {12*3+2, 1, {0, 0}, {0, 0}},
49 {12*2+0, 1, {0, 0}, {0, 0}},
50 {12*2+10, 1, {0, 0}, {0, 0}},
51 {12*2+7, 1, {0, 0}, {0, 0}},
52 {12*3+2, 1, {0, 0}, {0, 0}},
56 void audiocb(void *userdata
, Uint8
*buf
, int len
) {
59 for(i
= 0; i
< len
; i
++) {
60 buf
[i
] = interrupthandler();
64 int main(int argc
, char **argv
) {
65 SDL_AudioSpec requested
, obtained
;
68 ztlog
= fopen("ztlog","w");
70 if (SDL_Init( SDL_INIT_AUDIO
| SDL_INIT_JOYSTICK
) < 0) {
71 fprintf(ztlog
, "Couldn't initialize SDL: %s\n", SDL_GetError());
77 fprintf(ztlog
, "%i joysticks were found.\n\n", SDL_NumJoysticks() );
78 fprintf(ztlog
, "The names of the joysticks are:\n");
81 for( i
=0; i
< SDL_NumJoysticks(); i
++ ) {
82 fprintf(ztlog
," %s\n", SDL_JoystickName(i
));
87 requested
.freq
= 16000;
88 requested
.format
= AUDIO_U8
;
89 requested
.samples
= 256;
90 requested
.callback
= audiocb
;
91 requested
.channels
= 1;
93 // comment this out to run on grace
94 /*if(SDL_OpenAudio(&requested, &obtained) == -1) {
95 err(1, "SDL_OpenAudio");
98 // Actually if we don't do error checking it just works on grace and
99 // // locally with sound :3
100 SDL_OpenAudio(&requested
, &obtained
);
102 fprintf(stderr
, "freq %d\n", obtained
.freq
);
103 fprintf(stderr
, "samples %d\n", obtained
.samples
);
109 loadfile("untitled.song");