OSDN Git Service

updated copyleft and need to test and fix newer version of open watcom
[proj16/16.git] / src / lib / 16_snd.h
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2022 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 "src/lib/16_tail.h"\r
28 #include <hw/8254/8254.h>               /* 8254 timer */\r
29 #include <hw/adlib/adlib.h>\r
30 #include <hw/vga/vga.h>\r
31 #include <hw/dos/dos.h>\r
32 #include <hw/8259/8259.h>\r
33 \r
34 #define SD_USESCAMMPM\r
35 \r
36 #define MIN_REGISTER                    0x01\r
37 #define MAX_REGISTER                    0xF5\r
38 #define ADLIB_FM_ADDRESS        0x388   /* adlib address/status register */\r
39 #define ADLIB_FM_DATA           0x389   /* adlib data register           */\r
40 \r
41 /*\r
42 * FM Instrument definition for .SBI files - SoundBlaster instrument\r
43 * - these are the important parts - we will skip the header, but since\r
44 *   I am not sure where it starts and ends so I have had to guess.\r
45 *   However it SEEMS! to work. Each array has two values, one for\r
46 *   each operator.\r
47 */\r
48 typedef struct{\r
49         byte SoundCharacteristic[2];    /* modulator frequency multiple...  */\r
50         byte Level[2];                  /* modulator frequency level...     */\r
51         byte AttackDecay[2];            /* modulator attack/decay...        */\r
52         byte SustainRelease[2];         /* modulator sustain/release...     */\r
53         byte WaveSelect[2];             /* output waveform distortion       */\r
54         byte Feedback;                  /* feedback algorithm and strength  */\r
55 } FMInstrument;\r
56 \r
57 void opl2out(word reg, word data);\r
58 void opl3out(word reg, word data);\r
59 void opl3exp(word data);\r
60 \r
61 void FMReset(void/*int percusiveMode*/);\r
62 void FMKeyOff(int voice);\r
63 void FMKeyOn(int voice, int freq, int octave);\r
64 void FMSetVoice(int voiceNum, FMInstrument *ins);\r
65 \r
66 void SD_Initimf(global_game_variables_t *gvar);\r
67 void SD_imf_reset_music(global_game_variables_t *gvar);\r
68 void    SD_StartupTimer(global_game_variables_t *gvar),\r
69                 SD_ShutdownTimer();\r
70 void SD_imf_free_music(global_game_variables_t *gvar);\r
71 int SD_imf_load_music(const char *path, global_game_variables_t *gvar);\r
72 void interrupt SD_irq0(void);\r
73 void SD_imf_tick(global_game_variables_t *gvar);\r
74 void SD_adlib_shut_up();\r
75 \r
76 #endif /*__16_SND_H_*/\r