NXEngine v1.0.0.6
[NXEngine.git] / sound / pxt.h
blobafe745f745174f4d816f0e9b009f07b867e8092b
2 #ifndef _PXT_H
3 #define _PXT_H
5 #include "../common/basics.h"
7 #define PXT_NO_CHANNELS 4
9 enum
11 MOD_SINE,
12 MOD_TRI,
13 MOD_SAWUP,
14 MOD_SAWDOWN,
15 MOD_SQUARE,
16 MOD_NOISE,
17 MOD_WHITE,
18 MOD_PULSE,
20 PXT_NO_MODELS
23 typedef struct
25 signed char *model; // ptr to model data
26 uchar model_no; // index of model data (0-5, which wave[] model points to)
28 double phaseacc;
29 double phaseinc;
30 double repeat; // pixtone calls it "freq"
31 uchar volume; // pixtone calls it "top"
32 uchar offset;
34 int white_ptr; // like "phaseacc" but for MOD_WHITE (the odd one out)
35 } stPXWave;
37 #define PXENV_NUM_VERTICES 3
38 typedef struct
40 int initial;
42 int time[PXENV_NUM_VERTICES];
43 int val[PXENV_NUM_VERTICES];
44 } stPXEnvelope;
46 typedef struct
48 int size_blocks;
49 char enabled;
51 stPXWave main;
52 stPXWave pitch;
53 stPXWave pitch2;
54 stPXWave volume;
55 stPXEnvelope envelope;
57 unsigned char envbuffer[256];
58 signed char *buffer;
59 } stPXChannel;
61 typedef struct
63 stPXChannel chan[PXT_NO_CHANNELS];
65 signed char *final_buffer;
66 int final_size;
67 } stPXSound;
69 #endif