]> 4ch.mooo.com Git - 16.git/blob - src/lib/16_sd.h
p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I...
[16.git] / src / lib / 16_sd.h
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2017 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_SD_H_\r
24 #define __16_SD_H_\r
25 \r
26 #include "src/lib/16_head.h"\r
27 #include <hw/8254/8254.h>               /* 8254 timer */\r
28 #include <hw/adlib/adlib.h>\r
29 \r
30 #define MIN_REGISTER                    0x01\r
31 #define MAX_REGISTER                    0xF5\r
32 #define ADLIB_FM_ADDRESS        0x388   /* adlib address/status register */\r
33 #define ADLIB_FM_DATA           0x389   /* adlib data register           */\r
34 \r
35 /*\r
36 * FM Instrument definition for .SBI files - SoundBlaster instrument\r
37 * - these are the important parts - we will skip the header, but since\r
38 *   I am not sure where it starts and ends so I have had to guess.\r
39 *   However it SEEMS! to work. Each array has two values, one for\r
40 *   each operator.\r
41 */\r
42 typedef struct{\r
43         byte SoundCharacteristic[2];    /* modulator frequency multiple...  */\r
44         byte Level[2];                  /* modulator frequency level...     */\r
45         byte AttackDecay[2];            /* modulator attack/decay...        */\r
46         byte SustainRelease[2];         /* modulator sustain/release...     */\r
47         byte WaveSelect[2];             /* output waveform distortion       */\r
48         byte Feedback;                  /* feedback algorithm and strength  */\r
49 } FMInstrument;\r
50 \r
51 \r
52 void opl2out(word reg, word data);\r
53 void opl3out(word reg, word data);\r
54 void opl3exp(word data);\r
55 \r
56 void FMReset(void/*int percusiveMode*/);\r
57 void FMKeyOff(int voice);\r
58 void FMKeyOn(int voice, int freq, int octave);\r
59 void FMSetVoice(int voiceNum, FMInstrument *ins);\r
60 \r
61 #endif /*__16_SND_H_*/\r