Mixer is functional now. More signed/unsigned confusion was causing most of the probl...
[pineappletracker.git] / mod / main.h
blob170046bfdf9d667414b6ae3284929cf9f8ffd0a6
1 #define MOD_NO_NOTE 63
2 #define MOD_NO_SAMPLE 31
4 #define FREQ 44100
6 #define LOG(x, fmt) fprintf(stdout, "LOG: %s : %" #fmt "\n", #x, x)
7 #define CHECK(x) fprintf(stdout, "%s\n", #x)
9 typedef uint8_t u8;
10 typedef uint16_t u16;
11 typedef uint32_t u32;
13 typedef int8_t s8;
14 typedef int16_t s16;
15 typedef int32_t s32;
17 struct sample_header {
18 u8 name[22]; //22 bytes
19 u16 length; //2 bytes
20 u8 finetune; //1 byte
21 u8 vol; //1 byte
22 u16 loopstart; //2 bytes
23 u16 looplength; //2 bytes //more like loop-end
24 char *smpdata; //1 byte
27 struct pattern_entry {
28 u16 period;
29 u8 sample;
30 u8 effect;
31 u8 param;
34 struct pattern {
35 struct pattern_entry pattern_entry[64][4];
38 struct mod_header {
39 char name[20];
40 struct sample_header sample[31];
41 u8 order[128];
42 //u8 **pattern;
43 struct pattern *patterns;
44 u8 orderCount;
45 u8 patternCount;
46 int speed;
47 int tempo;
50 struct mix_channel {
51 //char *data;
52 double smp_index;
53 double inc;
54 u32 vol;
55 u32 length;
56 u32 looplength;
58 int currsample;
59 int currnote;
61 int last_sample;
62 }mix_channels[4];
64 struct mod_header modheader;
66 void process_row(void);
67 s8 get_sample(struct mix_channel *chn);
68 s8 mix(void);
69 void update(void);
70 void init_player(void);
72 int sdl_init(void);