Merge branch 'feature/handle-quit-event'
[jumpnbump.git] / dj.h
blobc5d6b5aaa3956dcea3fee85eb5950b3e61a02b5b
1 /*
2 * dj.h
3 * Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
4 *
5 * Copyright (C) 2002 Florian Schulze - crow@icculus.org
7 * This file is part of Jump'n'Bump.
9 * Jump'n'Bump is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * Jump'n'Bump is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <stdio.h>
25 #include <stdlib.h>
27 #ifdef DOS
28 #include <pc.h>
29 #include <dpmi.h>
30 #include <go32.h>
31 #include <sys/nearptr.h>
32 #endif
34 #define DJ_SD_TYPE_NOSOUND 0
35 #define DJ_SD_TYPE_SBLASTER 1
37 #define DJ_SFX_TYPE_SSS 0
38 #define DJ_SFX_TYPE_WAV 1
39 #define DJ_SFX_TYPE_SMP 2
42 typedef struct dj_hardware_info {
43 char sd_type;
44 short sd_version;
45 short port;
46 char irq;
47 char dma;
48 } dj_hardware_info;
50 typedef struct dj_mixing_info {
51 char sfx_volume, num_sfx_channels;
52 char mod_volume, num_mod_channels;
53 char stereo_mix, auto_mix;
54 unsigned short mixing_freq;
55 unsigned short dma_time, dmabuf_len;
56 char cur_dmabuf;
57 unsigned long dmabuf_address[2];
58 char *mixed_buf;
59 } dj_mixing_info;
61 typedef struct sfx_data {
62 char priority;
63 unsigned short default_freq;
64 char default_volume;
65 unsigned long length;
66 char loop;
67 unsigned long loop_start, loop_length;
68 unsigned char *buf;
69 } sfx_data;
71 typedef struct dj_mod_info {
72 char num_channels;
73 char speed;
74 short bpm;
75 char order_pos;
76 char pat_pos;
77 char name[20];
78 struct {
79 char name[22];
80 unsigned short length;
81 char finetune;
82 char volume;
83 unsigned short loop_start;
84 unsigned short loop_length;
85 char *buf;
86 } samples[31];
87 char song_length;
88 char num_pat;
89 char pat_order[128];
90 char *pat[128];
91 } dj_mod_info;
94 extern char dj_init(void);
95 extern void dj_deinit(void);
96 extern void dj_start(void);
97 extern void dj_stop(void);
98 extern void dj_set_nosound(char flag);
99 extern char dj_set_sd(char sd_type, short port, char irq, char dma);
100 extern char dj_autodetect_sd(void);
101 extern void dj_get_sd_string(char *strbuf);
102 extern char dj_set_stereo(char flag);
103 extern void dj_reverse_stereo(char flag);
104 extern void dj_set_auto_mix(char flag);
105 extern unsigned short dj_set_mixing_freq(unsigned short freq);
106 extern void dj_set_dma_time(unsigned short time);
107 extern char dj_get_hardware_info(dj_hardware_info *ptr);
108 extern char dj_get_mixing_info(dj_mixing_info *ptr);
109 extern char dj_get_mod_info(char mod_num, dj_mod_info *ptr);
110 extern void dj_set_fake_vu_speed(unsigned char speed);
111 extern unsigned char dj_get_fake_vu(char channel);
112 extern char dj_reset_sd(void);
114 extern char dj_mix_needed(void);
115 extern void dj_mix(void);
117 extern char dj_set_num_sfx_channels(char num_channels);
118 extern void dj_set_sfx_volume(char volume);
119 extern char dj_get_sfx_volume(void);
120 extern void dj_play_sfx(unsigned char sfx_num, unsigned short freq, char volume, char panning, unsigned short delay, char channel);
121 extern char dj_get_sfx_settings(unsigned char sfx_num, sfx_data *data);
122 extern char dj_set_sfx_settings(unsigned char sfx_num, sfx_data *data);
123 extern void dj_set_sfx_channel_volume(char channel_num, char volume);
124 extern void dj_stop_sfx_channel(char channel_num);
125 extern char dj_load_sfx(unsigned char *file_handle, char *filename, int file_length, char sfx_type, unsigned char sfx_num);
126 extern void dj_free_sfx(unsigned char sfx_num);
128 extern char dj_ready_mod(char mod_num);
129 extern char dj_start_mod(void);
130 extern void dj_stop_mod(void);
131 extern void dj_set_mod_volume(char volume);
132 extern char dj_get_mod_volume(void);
133 extern char dj_load_mod(unsigned char *file_handle, char *filename, char mod_num);
134 extern void dj_free_mod(char mod_num);