2 Copyright (c) 2002,2003, Christian Nowak <chnowak@web.de>
5 Modified by Francisco Muñoz 'Hermes' MAY 2008
7 Redistribution and use in source and binary forms, with or without modification, are
8 permitted provided that the following conditions are met:
10 - Redistributions of source code must retain the above copyright notice, this list of
11 conditions and the following disclaimer.
12 - Redistributions in binary form must reproduce the above copyright notice, this list
13 of conditions and the following disclaimer in the documentation and/or other
14 materials provided with the distribution.
15 - The names of the contributors may not be used to endorse or promote products derived
16 from this software without specific prior written permission.
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
19 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26 THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 typedef struct _modinstr
42 s8 name
[23]; /* 000..021 */
43 u32 length
; /* 022..023 */
44 u8 finetune
; /* 024 */
46 u32 loop_start
; /* 026..027 */
47 u32 loop_end
; /* 028..029 */
57 MOD_INSTR instrument
[31];
65 s32 num_voices
; /* Number of voices in the MOD */
66 s32 num_channels
; /* Number of channels to actually mix (num_channels-num_voices = number of sfx channels) */
69 s32 shiftval
; /* Number of bits to lshift every mixed 16bit word by */
70 /* Player variables */
71 BOOL channel_active
[MAX_VOICES
];
75 s32 songpos
; /* In the song */
76 s32 patternline
; /* In the pattern */
77 s32 patternline_jumpto
; /* For the E6 effect */
78 s32 patternline_jumpcount
; /* For the E6 effect */
82 s32 channels
; /* 1 = mono, 2 = stereo */
83 u32 playpos
[MAX_VOICES
]; /* Playing position for each channel */
84 u8 instnum
[MAX_VOICES
]; /* Current instrument */
85 u16 chanfreq
[MAX_VOICES
]; /* Current frequency */
86 u16 channote
[MAX_VOICES
]; /* Last note triggered */
87 u8 volume
[MAX_VOICES
]; /* Current volume */
88 u8 effect
[MAX_VOICES
]; /* Current effect */
89 u8 effectop
[MAX_VOICES
]; /* Current effect operand */
90 u8 last_effect
[MAX_VOICES
];
91 /* Effects handling */
92 u16 portamento_to
[MAX_VOICES
];
93 u8 porta_speed
[MAX_VOICES
];
94 u8 retrigger_counter
[MAX_VOICES
];
96 u8 sintabpos
[MAX_VOICES
];
97 u8 vib_freq
[MAX_VOICES
];
98 u8 vib_depth
[MAX_VOICES
];
99 u16 vib_basefreq
[MAX_VOICES
];
100 u8 trem_basevol
[MAX_VOICES
];
101 u8 trem_freq
[MAX_VOICES
];
102 u8 trem_depth
[MAX_VOICES
];
103 BOOL glissando
[MAX_VOICES
];
104 u8 trem_wave
[MAX_VOICES
];
105 u8 vib_wave
[MAX_VOICES
];
107 u8 nextinstr
[MAX_VOICES
];
108 u16 nextnote
[MAX_VOICES
];
118 void (*callback
)(void*);
128 s32
MOD_SetMOD ( MOD
*, u8
* );
129 s32
MOD_Load ( MOD
*, const char * );
130 void MOD_Free ( MOD
* );
131 void MOD_Start ( MOD
* );
132 u32
MOD_Player ( MOD
* );
133 s32
MOD_TriggerNote ( MOD
*, s32
, u8
, u16
, u8
);
134 s32
MOD_AllocSFXChannels ( MOD
*, s32
);
136 u16
getNote ( MOD
*, s32
, s32
);
137 u8
getInstr ( MOD
*, s32
, s32
);
138 u8
getEffect ( MOD
*, s32
, s32
);
139 u8
getEffectOp ( MOD
*, s32
, s32
);