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