change PAD_ScanPads()s behaviour. the return value now contains a bitmask of the...
[libogc.git] / gc / modplay / modplay.h
blob1f957ac7019b78f9440ce7a45d33ab4ecdf986a4
1 /*
2 Copyright (c) 2002,2003, Christian Nowak <chnowak@web.de>
3 All rights reserved.
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.
29 #ifndef __MODPLAY_H__
30 #define __MODPLAY_H__
32 #include <gctypes.h>
34 #define MAX_VOICES 32
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
40 typedef struct _modinstr
42 s8 name[23]; /* 000..021 */
43 u32 length; /* 022..023 */
44 u8 finetune; /* 024 */
45 u8 volume; /* 025 */
46 u32 loop_start; /* 026..027 */
47 u32 loop_end; /* 028..029 */
48 u32 loop_length;
49 BOOL looped;
50 s8 * data;
51 } MOD_INSTR;
53 typedef struct _mod
55 BOOL loaded;
56 s8 name[21];
57 MOD_INSTR instrument[31];
58 s32 num_patterns;
59 u8 song_length;
60 u8 ciaa;
61 u8 song[128];
62 s8 id[4];
63 u8 * patterndata;
64 s32 num_instr;
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) */
67 u8 * mixingbuf;
68 s32 mixingbuflen;
69 s32 shiftval; /* Number of bits to lshift every mixed 16bit word by */
70 /* Player variables */
71 BOOL channel_active[MAX_VOICES];
72 s32 patterndelay;
73 s32 speed;
74 s32 bpm;
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 */
79 s32 speedcounter;
80 s32 freq;
81 s32 bits;
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];
95 u8 arp_counter;
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];
110 u32 samplespertick;
111 u32 samplescounter;
113 u8 * modraw;
114 u32 *bpmtab;
115 u32 *inctab;
117 u32 notebeats;
118 void (*callback)(void*);
120 u8 musicvolume;
121 u8 sfxvolume;
123 BOOL set;
124 BOOL *notify;
126 } MOD;
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 );
141 #ifdef __cplusplus
143 #endif
145 #endif