1 /***************************************************************************
2 ****************************************************************************
3 ****************************************************************************
4 *
5 * FunktrackerGOLD - By Jason Nunn
6 * Copyright (C) 1996,1998 Jason Nunn
7 *
8 * FunktrackerGOLD now comes under the GNU General Public License. Please
9 * read the COPYING notice in this distribution.
10 *
11 * ================================================================
12 * defs
13 *
14 ****************************************************************************
15 ****************************************************************************
16 ***************************************************************************/
17 #include "options.h"
18 
19 #define FUNK_VERSION  "1.5"
20 #define WELCOME \
21 "FunktrackerGOLD version " FUNK_VERSION ", Copyright (C) 1994,1996,1998 Jason Nunn\n\n" \
22 "FunktrackerGOLD is now under the GNU GENERAL PUBLIC LICENSE AGREEMENT,\n" \
23 "and comes with ABSOLUTELY NO WARRANTY. This is free software, and you are\n" \
24 "welcome to redistribute it under certain conditions.\n\n" \
25 "   Contact: 32 Rothdale Rd, Moil Darwin NT 0810, AUSTRALIA\n" \
26 "     Email: jsno@downunder.net.au or jsno@stormfront.com.au\n" \
27 "       WWW: http://www.downunder.net.au/~jsno/\n" \
28 "Discussion: http://www.downunder.net.au/forum (Area:Unix_Programming)\n" \
29 "\n"
30 
31 #define STOP 0
32 #define PLAY 1
33 
34 #define MAX_BPM_RATE 188
35 #define MIN_BPM_RATE 62
36 
37 #define FERR_OK         0
38 #define FERR_MALLOC     1
39 #define FERR_FOPEN      2
40 #define FERR_FREAD      3
41 #define FERR_FUNK_SIG   4
42 #define FERR_FCORRUPT   5
43 #define FERR_PAT_LIM    6
44 #define FERR_OLD_FK     7
45 #define FERR_FCREATE    8
46 #define FERR_FWRITE     9
47 #define FERR_ESEQTABLE  10
48 #define FERR_SAMUNKNOWN 11
49 #define FERR_MODCOMPLEX 12
50 #define FERR_SNGUNKNOWN 13
51 #define FERR_PREC_NN    14
52 
53 #define EM_SAMPLE   0
54 #define EM_SEQUENCE 1
55 #define EM_PATTERN  2
56 #define EM_MAIN     3
57 #define EM_QUIT     4
58 
59 /******************************************
60 * defs for 32bit Linux 1.2.13
61 *
62 * we use these to reference alignment critical
63 * structures in our funk file
64 *
65 ******************************************/
66 typedef                char sDB;  /*1 byte*/
67 typedef unsigned       char uDB;
68 typedef          short int  sDW;  /*2 bytes*/
69 typedef unsigned short int  uDW;
70 typedef                int  sDD;  /*4 bytes*/
71 typedef unsigned       int  uDD;
72 typedef             double  sDQ;  /*ansi double - 8 bytes*/
73 
74 /*********************************************************************
75 * This structure is used for talking to either a DAC mixxer or DSP mixxer
76 **********************************************************************/
77 typedef struct _tchmix
78 {
79   unsigned long start;
80   unsigned long length;
81   unsigned char funkctrl;
82   void          *sample_addr;
83   double        sample_ptr;
84   double        freq;
85   int           left_volume;
86   int           right_volume;
87   long          *echo_buffer;
88   unsigned int  echo_ptr;
89   int           echo_delay;  /*16 point* @ 0.02 per sec each*/
90   int           echo_decay;  /*also 16 point*/
91   int           echo_feedback;
92 } tchmix;
93 
94 /*statistical types for info block*/
95 #define FKCPU_UNKNOWN  0
96 #define FKCPU_IBMPC1   1
97 #define FKCPU_IBMPC2   2
98 #define FKCPU_I386     3
99 #define FKCPU_I486     4
100 #define FKCPU_PENTIUM  5
101 #define FKCPU_LINUX    6
102 #define FKCPU_FREEBSD  7
103 #define FKCPU_NOTUSED8 8
104 #define FKCPU_NOTUSED9 9
105 #define FKCPU_NOTUSEDA 10
106 #define FKCPU_NOTUSEDB 11
107 #define FKCPU_NOTUSEDC 12
108 #define FKCPU_NOTUSEDD 13
109 #define FKCPU_NOTUSEDE 14
110 #define FKCPU_OTHER    15
111 
112 #define FKCARD_SB20      0
113 #define FKCARD_SBPRO     1
114 #define FKCARD_GUSV      2
115 #define FKCARD_SB10      3
116 #define FKCARD_SB16      4
117 #define FKCARD_GUSF      5
118 #define FKCARD_RIPPED    6
119 #define FKCARD_PAS       7
120 #define FKCARD_VOX08     8
121 #define FKCARD_VOX16     9
122 #define FKCARD_NOTUSEDA 10
123 #define FKCARD_NOTUSEDB 11
124 #define FKCARD_NOTUSEDC 12
125 #define FKCARD_NOTUSEDD 13
126 #define FKCARD_NOTUSEDE 14
127 #define FKCARD_OTHER    15
128 
129 /*******************************************
130 * alignment essential structures
131 *******************************************/
132 #pragma pack(1)
133 
134 typedef struct _tfunk_sb
135 {
136   sDB sname[19];
137   uDD start;
138   uDD length;
139   uDB volume;
140   uDB balance;
141   uDB pt_and_sop;
142   uDB vv_waveform;
143   uDB rl_and_as;
144 } tfunk_sb;
145 
146 typedef struct _tfunk_hr
147 {
148   sDB      sig[4];
149   uDB      info[4];
150   uDD      LZH_check_size;
151   sDB      funk_type[4];
152   uDB      loop_order;
153   uDB      order_list[256];
154   uDB      break_list[128];
155   tfunk_sb funk_sb[64];
156 } tfunk_hr;
157 
158 typedef struct _tslot
159 {
160   uDB not_sam;
161   uDB sam_com;
162   uDB com_val;
163 } tslot;
164 
165 #pragma pack()
166 /*******************************************
167 * alignment not essential
168 *******************************************/
169 typedef struct _tfunk_chan
170 {
171 /*-control system-----------------*/
172   int channel_kill;
173   int command;
174   int com_val;
175   int comspd_count;
176   int sample;
177   int port_type;
178   int sample_ofs_parm;
179   int vib_waveform;
180   int vol_vib_waveform;
181   int retrig_spd_count;
182   int retrig_count;
183   int retrig_limit;
184   int arp_speed;
185   int balance;
186   tslot *delay_pattern_ptr;
187 /*-note system--------------------*/
188   unsigned char note_command;
189   unsigned char note_com_val;
190   int note_comspd_count;
191   int note;
192   long ifreq;
193   long ifreq_vibrato;
194   long ifreq_portdest;
195   long rfreq;
196   long rfreq_portdest;
197   int vib_ptr;
198   int note_beat_count;
199 /*-volume system-----------------*/
200   unsigned char volume_command;
201   unsigned char volume_com_val;
202   int volume_comspd_count;
203   int volume;                  /*changed from uchar to DD*/
204   int volume_vibrato;
205   int volume_portdest;
206   int rvolume;
207   int vol_vib_ptr;
208   int volume_beat_count;
209 } tfunk_chan;
210 
211 typedef struct _tfunk_info
212 {
213   unsigned char funk_cpu_type;
214   unsigned char funk_card_type;
215   int           trek_status;
216   int           sequence_ofs;
217   int           pattern_ofs_display;
218   int           sequence_ofs_display;
219   int           pattern_ofs;
220   int           tempo;
221   int           tempo_count;
222   int           no_of_patterns;
223   int           no_of_sequences;
224   int           master_volume;
225   unsigned long sample_block_size;
226   int           funk_pd_size;
227   int           no_active_channels;
228   int           precision;
229   int           sample_precision;
230   int           bpm_rate;
231   int           hz_rate;
232   int           stereo;
233   int           sampling_rate;
234 } tfunk_info;
235