1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\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
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
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
25 #include "src/lib/16_in.h"
\r
26 //#include "src/lib/16_snd.h"
\r
27 #include "src/lib/doslib/adlib.h"
\r
28 #include "src/lib/doslib/8254.h" /* 8254 timer */
\r
30 static unsigned int musical_scale[18] = {
\r
52 void main(int argc, char near *argv[])
\r
55 // static FMInstrument testInst =
\r
57 //0x00, 0x01, /* modulator frequency multiple... 0x20 */
\r
58 //0x00, 0x00, /* modulator frequency level... 0x40 */
\r
59 //0xF0, 0xF0, /* modulator attack/decay... 0x60 */
\r
60 //0x73, 0x73, /* modulator sustain/release... 0x80 */
\r
61 //0x03, 0x00, /* output waveform distortion 0xE0 */
\r
62 //0x36, /* feedback algorithm and strength 0xC0 */
\r
67 //FMSetVoice(0, &testInst);
\r
70 printf("Cannot init library\n");
\r
74 if (adlib_fm_voices > 9)
\r
76 // vga_bios_set_80x50_text();
\r
78 memset(adlib_fm,0,sizeof(adlib_fm));
\r
79 memset(&adlib_reg_bd,0,sizeof(adlib_reg_bd));
\r
80 for (i=0;i < adlib_fm_voices;i++) {
\r
81 struct adlib_fm_operator *f;
\r
82 f = &adlib_fm[i].mod;
\r
83 f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1;
\r
84 f = &adlib_fm[i].car;
\r
85 f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1;
\r
88 for (i=0;i < /*adlib_fm_voices*/1;i++) {
\r
89 struct adlib_fm_operator *f;
\r
91 f = &adlib_fm[i].mod;
\r
92 f->mod_multiple = 1;
\r
93 f->total_level = 63 - 16;
\r
94 f->attack_rate = 15;
\r
96 f->sustain_level = 7;
\r
97 f->release_rate = 7;
\r
98 f->f_number = musical_scale[i%18];
\r
102 f = &adlib_fm[i].car;
\r
103 f->mod_multiple = 1;
\r
104 f->total_level = 63 - 16;
\r
105 f->attack_rate = 15;
\r
107 f->sustain_level = 7;
\r
108 f->release_rate = 7;
\r
116 printf("press Z! to noise\npress ESC to quit");
\r
123 adlib_fm[0].mod.key_on = 1;
\r
124 //FMKeyOn(0, 0x106, 4);
\r
128 adlib_fm[0].mod.key_on = 0;
\r
131 adlib_update_groupA0(0,&adlib_fm[0]);
\r