]> icculus.org git repositories - btb/d2x.git/blob - arch/dos/allg_snd/internal.h
keep Changelog in cvs (and use --accum)
[btb/d2x.git] / arch / dos / allg_snd / internal.h
1 /*         ______   ___    ___ 
2  *        /\  _  \ /\_ \  /\_ \ 
3  *        \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___ 
4  *         \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
5  *          \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
6  *           \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
7  *            \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
8  *                                           /\____/
9  *                                           \_/__/
10  *      By Shawn Hargreaves,
11  *      1 Salisbury Road,
12  *      Market Drayton,
13  *      Shropshire,
14  *      England, TF9 1AJ.
15  *
16  *      Some definitions for internal use by the library code.
17  *      This should not be included by user programs.
18  *
19  *      See readme.txt for copyright information.
20  */
21
22
23 #ifndef INTERNAL_H
24 #define INTERNAL_H
25
26 #include "allegro.h"
27
28 #ifdef DJGPP
29 #include "interndj.h"
30 #else
31 #include "internli.h"
32 #endif
33 #include <stdio.h>
34 #include <dos.h>
35
36 #define rest delay
37 #define PACKFILE FILE
38 #define pack_fopen fopen
39 #define pack_fputs fputs
40 #define pack_fread(x,y,z) fread(x,1,y,z)
41 #define pack_fclose fclose
42 #define pack_getc(f) fgetc(f)
43 #define pack_igetw(f) (fgetc(f) | (fgetc(f) << 8))
44 #define pack_igetl(f) (pack_igetw(f) | (pack_igetw(f) << 16))
45 #define pack_mgetw(f) ((fgetc(f) << 8) | fgetc(f))
46 #define pack_mgetl(f) ((pack_mgetw(f) << 16) | pack_mgetw(f))
47 #define pack_feof(f) feof(f)
48 #define file_exists(n,x,z) (file_size(n)!=-1)
49 #define F_READ "rb"
50 #define F_WRITE "wb"
51
52 char *pack_fgets(char *p, int max, PACKFILE *f);
53 long file_size(const char *n);
54 char *get_filename(const char *s);
55 char *get_extension(const char *s);
56
57 void put_backslash(char *n);
58
59
60 /* flag for how many times we have been initialised */
61 extern int _allegro_count;
62
63
64 /* some Allegro functions need a block of scratch memory */
65 extern void *_scratch_mem;
66 extern int _scratch_mem_size;
67
68 __INLINE__ void _grow_scratch_mem(int size)
69 {
70    if (size > _scratch_mem_size) {
71       size = (size+1023) & 0xFFFFFC00;
72       _scratch_mem = realloc(_scratch_mem, size);
73       _scratch_mem_size = size;
74    }
75 }
76
77
78 /* list of functions to call at program cleanup */
79 void _add_exit_func(void (*func)());
80 void _remove_exit_func(void (*func)());
81
82
83 /* various bits of mouse stuff */
84 void _set_mouse_range();
85 extern BITMAP *_mouse_screen;
86
87
88 /* various bits of timer stuff */
89 extern int _timer_use_retrace;
90 extern volatile int _retrace_hpp_value;
91
92
93 /* asm joystick polling routine */
94 int _poll_joystick(int *x, int *y, int *x2, int *y2, int poll_mask);
95
96
97 /* caches and tables for svga bank switching */
98 extern int _last_bank_1, _last_bank_2; 
99 extern int *_gfx_bank; 
100
101
102 /* bank switching routines */
103 void _stub_bank_switch();
104 void _stub_bank_switch_end();
105
106
107 /* stuff for setting up bitmaps */
108 typedef struct _GFX_MODE_INFO
109 {
110    int w, h;
111    int bpp;
112    int bios_num;
113    int bios_int;
114    int (*setter)(int w, int h, int bpp);
115 } _GFX_MODE_INFO;
116
117 void _check_gfx_virginity();
118 BITMAP *_gfx_mode_set_helper(int w, int h, int v_w, int v_h, int color_depth, GFX_DRIVER *driver, int (*detect)(), _GFX_MODE_INFO *mode_list, void (*set_width)(int w));
119 BITMAP *_make_bitmap(int w, int h, unsigned long addr, GFX_DRIVER *driver, int color_depth, int bpl);
120 void _sort_out_virtual_width(int *width, GFX_DRIVER *driver);
121
122 GFX_VTABLE *_get_vtable(int color_depth);
123
124 extern int _sub_bitmap_id_count;
125
126 #define BYTES_PER_PIXEL(bpp)     (((int)(bpp) + 7) / 8)
127
128 int _color_load_depth(int depth);
129
130 BITMAP *_fixup_loaded_bitmap(BITMAP *bmp, PALETTE pal, int bpp);
131
132
133 /* truecolor pixel blending information */
134 extern BLENDER_MAP *_blender_map15;
135 extern BLENDER_MAP *_blender_map16;
136 extern BLENDER_MAP *_blender_map24;
137
138 extern int _blender_col_15;
139 extern int _blender_col_16;
140 extern int _blender_col_24;
141 extern int _blender_col_32;
142
143 extern int _blender_alpha;
144
145
146 /* VGA register access routines */
147 void _vga_vsync();
148 void _vga_set_pallete_range(PALLETE p, int from, int to, int vsync);
149
150 extern int _crtc;
151
152
153 /* _read_vga_register:
154  *  Reads the contents of a VGA register.
155  */
156 __INLINE__ int _read_vga_register(int port, int index)
157 {
158    if (port==0x3C0)
159       inportb(_crtc+6); 
160
161    outportb(port, index);
162    return inportb(port+1);
163 }
164
165
166 /* _write_vga_register:
167  *  Writes a byte to a VGA register.
168  */
169 __INLINE__ void _write_vga_register(int port, int index, int v) 
170 {
171    if (port==0x3C0) {
172       inportb(_crtc+6);
173       outportb(port, index);
174       outportb(port, v);
175    }
176    else {
177       outportb(port, index);
178       outportb(port+1, v);
179    }
180 }
181
182
183 /* _alter_vga_register:
184  *  Alters specific bits of a VGA register.
185  */
186 __INLINE__ void _alter_vga_register(int port, int index, int mask, int v)
187 {
188    int temp;
189    temp = _read_vga_register(port, index);
190    temp &= (~mask);
191    temp |= (v & mask);
192    _write_vga_register(port, index, temp);
193 }
194
195
196 /* _vsync_out_h:
197  *  Waits until the VGA is not in either a vertical or horizontal retrace.
198  */
199 __INLINE__ void _vsync_out_h()
200 {
201    do {
202    } while (inportb(0x3DA) & 1);
203 }
204
205
206 /* _vsync_out_v:
207  *  Waits until the VGA is not in a vertical retrace.
208  */
209 __INLINE__ void _vsync_out_v()
210 {
211    do {
212    } while (inportb(0x3DA) & 8);
213 }
214
215
216 /* _vsync_in:
217  *  Waits until the VGA is in the vertical retrace period.
218  */
219 __INLINE__ void _vsync_in()
220 {
221    if (_timer_use_retrace) {
222       int t = retrace_count; 
223
224       do {
225       } while (t == retrace_count);
226    }
227    else {
228       do {
229       } while (!(inportb(0x3DA) & 8));
230    }
231 }
232
233
234 /* _write_hpp:
235  *  Writes to the VGA pelpan register.
236  */
237 __INLINE__ void _write_hpp(int value)
238 {
239    if (_timer_use_retrace) {
240       _retrace_hpp_value = value;
241
242       do {
243       } while (_retrace_hpp_value == value);
244    }
245    else {
246       do {
247       } while (!(inportb(0x3DA) & 8));
248
249       _write_vga_register(0x3C0, 0x33, value);
250    }
251 }
252
253
254 int _test_vga_register(int port, int index, int mask);
255 int _test_register(int port, int mask);
256 void _set_vga_virtual_width(int old_width, int new_width);
257
258
259 /* current drawing mode */
260 extern int _drawing_mode;
261 extern BITMAP *_drawing_pattern;
262 extern int _drawing_x_anchor;
263 extern int _drawing_y_anchor;
264 extern unsigned int _drawing_x_mask;
265 extern unsigned int _drawing_y_mask;
266
267
268 /* graphics drawing routines */
269 void _normal_line(BITMAP *bmp, int x1, int y1, int x2, int y2, int color);
270 void _normal_rectfill(BITMAP *bmp, int x1, int y1, int x2, int y2, int color);
271
272 int  _linear_getpixel8(struct BITMAP *bmp, int x, int y);
273 void _linear_putpixel8(struct BITMAP *bmp, int x, int y, int color);
274 void _linear_vline8(struct BITMAP *bmp, int x, int y1, int y2, int color);
275 void _linear_hline8(struct BITMAP *bmp, int x1, int y, int x2, int color);
276 void _linear_draw_sprite8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
277 void _linear_draw_sprite_v_flip8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
278 void _linear_draw_sprite_h_flip8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
279 void _linear_draw_sprite_vh_flip8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
280 void _linear_draw_trans_sprite8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
281 void _linear_draw_lit_sprite8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
282 void _linear_draw_rle_sprite8(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
283 void _linear_draw_trans_rle_sprite8(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
284 void _linear_draw_lit_rle_sprite8(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
285 void _linear_draw_character8(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
286 void _linear_textout_fixed8(struct BITMAP *bmp, void *f, int h, unsigned char *str, int x, int y, int color);
287 void _linear_blit8(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
288 void _linear_blit_backward8(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
289 void _linear_masked_blit8(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
290 void _linear_clear_to_color8(struct BITMAP *bitmap, int color);
291
292 #ifdef ALLEGRO_COLOR16
293
294 void _linear_putpixel15(struct BITMAP *bmp, int x, int y, int color);
295 void _linear_vline15(struct BITMAP *bmp, int x, int y1, int y2, int color);
296 void _linear_hline15(struct BITMAP *bmp, int x1, int y, int x2, int color);
297 void _linear_draw_trans_sprite15(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
298 void _linear_draw_lit_sprite15(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
299 void _linear_draw_rle_sprite15(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
300 void _linear_draw_trans_rle_sprite15(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
301 void _linear_draw_lit_rle_sprite15(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
302
303 int  _linear_getpixel16(struct BITMAP *bmp, int x, int y);
304 void _linear_putpixel16(struct BITMAP *bmp, int x, int y, int color);
305 void _linear_vline16(struct BITMAP *bmp, int x, int y1, int y2, int color);
306 void _linear_hline16(struct BITMAP *bmp, int x1, int y, int x2, int color);
307 void _linear_draw_sprite16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
308 void _linear_draw_256_sprite16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
309 void _linear_draw_sprite_v_flip16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
310 void _linear_draw_sprite_h_flip16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
311 void _linear_draw_sprite_vh_flip16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
312 void _linear_draw_trans_sprite16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
313 void _linear_draw_lit_sprite16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
314 void _linear_draw_rle_sprite16(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
315 void _linear_draw_trans_rle_sprite16(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
316 void _linear_draw_lit_rle_sprite16(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
317 void _linear_draw_character16(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
318 void _linear_textout_fixed16(struct BITMAP *bmp, void *f, int h, unsigned char *str, int x, int y, int color);
319 void _linear_blit16(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
320 void _linear_blit_backward16(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
321 void _linear_masked_blit16(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
322 void _linear_clear_to_color16(struct BITMAP *bitmap, int color);
323
324 #endif
325
326 #ifdef ALLEGRO_COLOR24
327
328 int  _linear_getpixel24(struct BITMAP *bmp, int x, int y);
329 void _linear_putpixel24(struct BITMAP *bmp, int x, int y, int color);
330 void _linear_vline24(struct BITMAP *bmp, int x, int y1, int y2, int color);
331 void _linear_hline24(struct BITMAP *bmp, int x1, int y, int x2, int color);
332 void _linear_draw_sprite24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
333 void _linear_draw_256_sprite24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
334 void _linear_draw_sprite_v_flip24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
335 void _linear_draw_sprite_h_flip24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
336 void _linear_draw_sprite_vh_flip24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
337 void _linear_draw_trans_sprite24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
338 void _linear_draw_lit_sprite24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
339 void _linear_draw_rle_sprite24(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
340 void _linear_draw_trans_rle_sprite24(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
341 void _linear_draw_lit_rle_sprite24(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
342 void _linear_draw_character24(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
343 void _linear_textout_fixed24(struct BITMAP *bmp, void *f, int h, unsigned char *str, int x, int y, int color);
344 void _linear_blit24(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
345 void _linear_blit_backward24(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
346 void _linear_masked_blit24(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
347 void _linear_clear_to_color24(struct BITMAP *bitmap, int color);
348
349 #endif
350
351 #ifdef ALLEGRO_COLOR32
352
353 int  _linear_getpixel32(struct BITMAP *bmp, int x, int y);
354 void _linear_putpixel32(struct BITMAP *bmp, int x, int y, int color);
355 void _linear_vline32(struct BITMAP *bmp, int x, int y1, int y2, int color);
356 void _linear_hline32(struct BITMAP *bmp, int x1, int y, int x2, int color);
357 void _linear_draw_sprite32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
358 void _linear_draw_256_sprite32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
359 void _linear_draw_sprite_v_flip32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
360 void _linear_draw_sprite_h_flip32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
361 void _linear_draw_sprite_vh_flip32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
362 void _linear_draw_trans_sprite32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
363 void _linear_draw_lit_sprite32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
364 void _linear_draw_rle_sprite32(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
365 void _linear_draw_trans_rle_sprite32(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
366 void _linear_draw_lit_rle_sprite32(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
367 void _linear_draw_character32(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
368 void _linear_textout_fixed32(struct BITMAP *bmp, void *f, int h, unsigned char *str, int x, int y, int color);
369 void _linear_blit32(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
370 void _linear_blit_backward32(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
371 void _linear_masked_blit32(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
372 void _linear_clear_to_color32(struct BITMAP *bitmap, int color);
373
374 #endif
375
376 int  _x_getpixel(struct BITMAP *bmp, int x, int y);
377 void _x_putpixel(struct BITMAP *bmp, int x, int y, int color);
378 void _x_vline(struct BITMAP *bmp, int x, int y1, int y2, int color);
379 void _x_hline(struct BITMAP *bmp, int x1, int y, int x2, int color);
380 void _x_draw_sprite(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
381 void _x_draw_sprite_v_flip(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
382 void _x_draw_sprite_h_flip(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
383 void _x_draw_sprite_vh_flip(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
384 void _x_draw_trans_sprite(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y);
385 void _x_draw_lit_sprite(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
386 void _x_draw_rle_sprite(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
387 void _x_draw_trans_rle_sprite(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y);
388 void _x_draw_lit_rle_sprite(struct BITMAP *bmp, struct RLE_SPRITE *sprite, int x, int y, int color);
389 void _x_draw_character(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color);
390 void _x_textout_fixed(struct BITMAP *bmp, void *f, int h, unsigned char *str, int x, int y, int color);
391 void _x_blit_from_memory(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
392 void _x_blit_to_memory(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
393 void _x_blit(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
394 void _x_blit_forward(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
395 void _x_blit_backward(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
396 void _x_masked_blit(struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
397 void _x_clear_to_color(struct BITMAP *bitmap, int color);
398
399
400 /* asm helper for stretch_blit() */
401 void _do_stretch(BITMAP *source, BITMAP *dest, void *drawer, int sx, fixed sy, fixed syd, int dx, int dy, int dh, int color_depth);
402
403
404 /* information for polygon scanline fillers */
405 typedef struct POLYGON_SEGMENT
406 {
407    fixed u, v, du, dv;              /* fixed point u/v coordinates */
408    fixed c, dc;                     /* single color gouraud shade values */
409    fixed r, g, b, dr, dg, db;       /* RGB gouraud shade values */
410    float z, dz;                     /* polygon depth (1/z) */
411    float fu, fv, dfu, dfv;          /* floating point u/v coordinates */
412    unsigned char *texture;          /* the texture map */
413    int umask, vmask, vshift;        /* texture map size information */
414    int seg;                         /* destination bitmap selector */
415 } POLYGON_SEGMENT;
416
417
418 /* polygon scanline filler functions */
419 void _poly_scanline_flat(unsigned long addr, int w, POLYGON_SEGMENT *info);
420 void _poly_scanline_gcol(unsigned long addr, int w, POLYGON_SEGMENT *info);
421 void _poly_scanline_grgb(unsigned long addr, int w, POLYGON_SEGMENT *info);
422 void _poly_scanline_atex(unsigned long addr, int w, POLYGON_SEGMENT *info);
423 void _poly_scanline_ptex(unsigned long addr, int w, POLYGON_SEGMENT *info);
424 void _poly_scanline_atex_mask(unsigned long addr, int w, POLYGON_SEGMENT *info);
425 void _poly_scanline_ptex_mask(unsigned long addr, int w, POLYGON_SEGMENT *info);
426 void _poly_scanline_atex_lit(unsigned long addr, int w, POLYGON_SEGMENT *info);
427 void _poly_scanline_ptex_lit(unsigned long addr, int w, POLYGON_SEGMENT *info);
428
429
430 /* sound lib stuff */
431 extern int _digi_volume;
432 extern int _midi_volume;
433 extern int _flip_pan; 
434
435 extern int (*_midi_init)();
436 extern void (*_midi_exit)();
437
438 int _midi_allocate_voice(int min, int max);
439
440 extern volatile long _midi_tick;
441
442 int _digmid_find_patches(char *dir, char *file);
443
444 #define VIRTUAL_VOICES  256
445
446
447 typedef struct          /* a virtual (as seen by the user) soundcard voice */
448 {
449    SAMPLE *sample;      /* which sample are we playing? (NULL = free) */
450    int num;             /* physical voice number (-1 = been killed off) */
451    int autokill;        /* set to free the voice when the sample finishes */
452    long time;           /* when we were started (for voice allocation) */
453    int priority;        /* how important are we? */
454 } VOICE;
455
456 extern VOICE _voice[VIRTUAL_VOICES];
457
458
459 typedef struct          /* a physical (as used by hardware) soundcard voice */
460 {
461    int num;             /* the virtual voice currently using me (-1 = free) */
462    int playmode;        /* are we looping? */
463    int vol;             /* current volume (fixed point .12) */
464    int dvol;            /* volume delta, for ramping */
465    int target_vol;      /* target volume, for ramping */
466    int pan;             /* current pan (fixed point .12) */
467    int dpan;            /* pan delta, for sweeps */
468    int target_pan;      /* target pan, for sweeps */
469    int freq;            /* current frequency (fixed point .12) */
470    int dfreq;           /* frequency delta, for sweeps */
471    int target_freq;     /* target frequency, for sweeps */
472 } PHYS_VOICE;
473
474 extern PHYS_VOICE _phys_voice[DIGI_VOICES];
475
476
477 #define MIXER_DEF_SFX               8
478 #define MIXER_MAX_SFX               32
479
480 int _mixer_init(int bufsize, int freq, int stereo, int is16bit, int *voices);
481 void _mixer_exit();
482 void _mix_some_samples(unsigned long buf, unsigned short seg, int issigned);
483
484 void _mixer_init_voice(int voice, SAMPLE *sample);
485 void _mixer_release_voice(int voice);
486 void _mixer_start_voice(int voice);
487 void _mixer_stop_voice(int voice);
488 void _mixer_loop_voice(int voice, int loopmode);
489 int  _mixer_get_position(int voice);
490 void _mixer_set_position(int voice, int position);
491 int  _mixer_get_volume(int voice);
492 void _mixer_set_volume(int voice, int volume);
493 void _mixer_ramp_volume(int voice, int time, int endvol);
494 void _mixer_stop_volume_ramp(int voice);
495 int  _mixer_get_frequency(int voice);
496 void _mixer_set_frequency(int voice, int frequency);
497 void _mixer_sweep_frequency(int voice, int time, int endfreq);
498 void _mixer_stop_frequency_sweep(int voice);
499 int  _mixer_get_pan(int voice);
500 void _mixer_set_pan(int voice, int pan);
501 void _mixer_sweep_pan(int voice, int time, int endpan);
502 void _mixer_stop_pan_sweep(int voice);
503 void _mixer_set_echo(int voice, int strength, int delay);
504 void _mixer_set_tremolo(int voice, int rate, int depth);
505 void _mixer_set_vibrato(int voice, int rate, int depth);
506
507 /* dummy functions for the NoSound drivers */
508 int  _dummy_detect();
509 int  _dummy_init(int voices);
510 void _dummy_exit();
511 int  _dummy_mixer_volume(int volume);
512 void _dummy_init_voice(int voice, SAMPLE *sample);
513 void _dummy_noop1(int p);
514 void _dummy_noop2(int p1, int p2);
515 void _dummy_noop3(int p1, int p2, int p3);
516 int  _dummy_get_position(int voice);
517 int  _dummy_get(int voice);
518 void _dummy_raw_midi(unsigned char data);
519 int  _dummy_load_patches(char *patches, char *drums);
520 void _dummy_adjust_patches(char *patches, char *drums);
521 void _dummy_key_on(int inst, int note, int bend, int vol, int pan);
522
523
524 /* from djgpp's libc, needed to find which directory we were run from */
525 extern int __crt0_argc;
526 extern char **__crt0_argv;
527
528
529 #endif          /* ifndef INTERNAL_H */