comparison decoders/timidity/timidity.h @ 455:cbc2a4ffeeec

* Added support for loading DLS format instruments: Timidity_LoadDLS(), Timidity_FreeDLS(), Timidity_LoadDLSSong() * Added Timidity_Init_NoConfig()
author hercules
date Fri, 26 Sep 2003 20:51:58 +0000
parents 498240aa76f1
children c66080364dff
comparison
equal deleted inserted replaced
454:6bd7ca7d218b 455:cbc2a4ffeeec
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 19
20 */ 20 */
21 21
22 #ifndef TIMIDITY_H
23 #define TIMIDITY_H
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
22 typedef Sint16 sample_t; 28 typedef Sint16 sample_t;
23 typedef Sint32 final_volume_t; 29 typedef Sint32 final_volume_t;
24 30
25 #define VIBRATO_SAMPLE_INCREMENTS 32 31 #define VIBRATO_SAMPLE_INCREMENTS 32
26 32
28 #define MAX_VOICES 48 34 #define MAX_VOICES 48
29 35
30 typedef struct { 36 typedef struct {
31 Sint32 37 Sint32
32 loop_start, loop_end, data_length, 38 loop_start, loop_end, data_length,
33 sample_rate, low_freq, high_freq, root_freq; 39 sample_rate, low_vel, high_vel, low_freq, high_freq, root_freq;
34 Sint32 40 Sint32
35 envelope_rate[6], envelope_offset[6]; 41 envelope_rate[6], envelope_offset[6];
36 float 42 float
37 volume; 43 volume;
38 sample_t *data; 44 sample_t *data;
105 typedef struct { 111 typedef struct {
106 MidiEvent event; 112 MidiEvent event;
107 void *next; 113 void *next;
108 } MidiEventList; 114 } MidiEventList;
109 115
116 struct _DLS_Data;
117 typedef struct _DLS_Data DLS_Patches;
118
110 typedef struct { 119 typedef struct {
111 int playing; 120 int playing;
112 SDL_RWops *rw; 121 SDL_RWops *rw;
113 Sint32 rate; 122 Sint32 rate;
114 Sint32 encoding; 123 Sint32 encoding;
115 float master_volume; 124 float master_volume;
116 Sint32 amplification; 125 Sint32 amplification;
126 DLS_Patches *patches;
117 ToneBank *tonebank[128]; 127 ToneBank *tonebank[128];
118 ToneBank *drumset[128]; 128 ToneBank *drumset[128];
119 Instrument *default_instrument; 129 Instrument *default_instrument;
120 int default_program; 130 int default_program;
121 void (*write)(void *dp, Sint32 *lp, Sint32 c); 131 void (*write)(void *dp, Sint32 *lp, Sint32 c);
146 } MidiSong; 156 } MidiSong;
147 157
148 /* Some of these are not defined in timidity.c but are here for convenience */ 158 /* Some of these are not defined in timidity.c but are here for convenience */
149 159
150 extern int Timidity_Init(void); 160 extern int Timidity_Init(void);
161 extern int Timidity_Init_NoConfig(void);
151 extern void Timidity_SetVolume(MidiSong *song, int volume); 162 extern void Timidity_SetVolume(MidiSong *song, int volume);
152 extern int Timidity_PlaySome(MidiSong *song, void *stream, Sint32 len); 163 extern int Timidity_PlaySome(MidiSong *song, void *stream, Sint32 len);
164 extern DLS_Patches *Timidity_LoadDLS(SDL_RWops *rw);
165 extern void Timidity_FreeDLS(DLS_Patches *patches);
166 extern MidiSong *Timidity_LoadDLSSong(SDL_RWops *rw, DLS_Patches *patches, SDL_AudioSpec *audio);
153 extern MidiSong *Timidity_LoadSong(SDL_RWops *rw, SDL_AudioSpec *audio); 167 extern MidiSong *Timidity_LoadSong(SDL_RWops *rw, SDL_AudioSpec *audio);
154 extern void Timidity_Start(MidiSong *song); 168 extern void Timidity_Start(MidiSong *song);
155 extern void Timidity_Seek(MidiSong *song, Uint32 ms); 169 extern void Timidity_Seek(MidiSong *song, Uint32 ms);
156 extern void Timidity_FreeSong(MidiSong *song); 170 extern void Timidity_FreeSong(MidiSong *song);
157 extern void Timidity_Exit(void); 171 extern void Timidity_Exit(void);
172
173 #ifdef __cplusplus
174 }
175 #endif
176 #endif /* TIMIDITY_H */