OSDN Git Service

Merge remote-tracking branch 'upstream/master'
[proj16/16.git] / src / lib / 16_snd.h
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 \r
23 #ifndef __16_SND_H_\r
24 #define __16_SND_H_\r
25 \r
26 #include "src/lib/16_head.h"\r
27 \r
28 #define MIN_REGISTER                    0x01\r
29 #define MAX_REGISTER                    0xF5\r
30 #define ADLIB_FM_ADDRESS        0x388   /* adlib address/status register */\r
31 #define ADLIB_FM_DATA           0x389   /* adlib data register           */\r
32 \r
33 /*\r
34 * FM Instrument definition for .SBI files - SoundBlaster instrument\r
35 * - these are the important parts - we will skip the header, but since\r
36 *   I am not sure where it starts and ends so I have had to guess.\r
37 *   However it SEEMS! to work. Each array has two values, one for\r
38 *   each operator.\r
39 */\r
40 typedef struct{\r
41         byte SoundCharacteristic[2];    /* modulator frequency multiple...  */\r
42         byte Level[2];                  /* modulator frequency level...     */\r
43         byte AttackDecay[2];            /* modulator attack/decay...        */\r
44         byte SustainRelease[2];         /* modulator sustain/release...     */\r
45         byte WaveSelect[2];             /* output waveform distortion       */\r
46         byte Feedback;                  /* feedback algorithm and strength  */\r
47 } FMInstrument;\r
48 \r
49 \r
50 void opl2out(word reg, word data);\r
51 void opl3out(word reg, word data);\r
52 void opl3exp(word data);\r
53 \r
54 void FMReset(void/*int percusiveMode*/);\r
55 void FMKeyOff(int voice);\r
56 void FMKeyOn(int voice, int freq, int octave);\r
57 void FMSetVoice(int voiceNum, FMInstrument *ins);\r
58 \r
59 #endif /*__16_SND_H_*/\r