1 /****************************************************************************
3 * ____ ___ ____ __ ______ ___ ____ ____/ / *
4 * / __ `__ \/ __ `/ |/ / __ `__ \/ __ \/ __ / *
5 * / / / / / / /_/ /> </ / / / / / /_/ / /_/ / *
6 * /_/ /_/ /_/\__,_/_/|_/_/ /_/ /_/\____/\__,_/ *
8 * Copyright (c) 2008, Mukunda Johnson (mukunda@maxmod.org) *
10 * Permission to use, copy, modify, and/or distribute this software for any *
11 * purpose with or without fee is hereby granted, provided that the above *
12 * copyright notice and this permission notice appear in all copies. *
14 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES *
15 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF *
16 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR *
17 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES *
18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN *
19 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *
20 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
21 ****************************************************************************/
26 //#define SAMPLE_FORMAT_U8 3
27 //#define SAMPLE_FORMAT_S8 0
28 //#define SAMPLE_FORMAT_S16 1
29 //#define SAMPLE_FORMAT_ADPCM 2
31 #define SAMPF_16BIT 0x001
32 #define SAMPF_SIGNED 0x002
33 #define SAMPF_COMP 0x004
35 #define SAMP_FORMAT_U8 (0 )
36 #define SAMP_FORMAT_U16 (SAMPF_16BIT)
37 #define SAMP_FORMAT_S8 ( SAMPF_SIGNED )
38 #define SAMP_FORMAT_S16 (SAMPF_16BIT | SAMPF_SIGNED )
39 #define SAMP_FORMAT_ADPCM (SAMPF_COMP)
41 #define MAS_TYPE_SONG 0
42 #define MAS_TYPE_SAMPLE_GBA 1
43 #define MAS_TYPE_SAMPLE_NDS 2
45 typedef struct tInstrument_Envelope
57 } Instrument_Envelope;
59 typedef struct tInstrument
75 Instrument_Envelope envelope_volume;
76 Instrument_Envelope envelope_pan;
77 Instrument_Envelope envelope_pitch;
80 typedef struct tSample
107 // bool samp_unsigned;
113 typedef struct tPatternEntry
122 typedef struct tPattern
127 PatternEntry data[MAX_CHANNELS*256];
131 typedef struct tMAS_Module
149 u8 channel_volume[MAX_CHANNELS];
150 u8 channel_panning[MAX_CHANNELS];
152 Instrument* instruments;
157 void Write_Instrument_Envelope( Instrument_Envelope* env );
158 void Write_Instrument( Instrument* inst );
159 void Write_SampleData( Sample* samp );
160 void Write_Sample( Sample* samp );
161 void Write_Pattern( Pattern* patt, bool xm_vol );
162 int Write_MAS( MAS_Module* mod, bool verbose, bool msl_dep );
163 void Delete_Module( MAS_Module* mod );
165 extern u32 MAS_FILESIZE;