+ //FMReset();
+ //FMSetVoice(0, &testInst);
+ if(!init_adlib())
+ {
+ printf("Cannot init library\n");
+ exit(-5);
+ }
+
+ if (adlib_fm_voices > 9)
+ printf("OPL3!\n");
+// vga_bios_set_80x50_text();
+
+ memset(adlib_fm,0,sizeof(adlib_fm));
+ memset(&adlib_reg_bd,0,sizeof(adlib_reg_bd));
+ for (i=0;i < adlib_fm_voices;i++) {
+ struct adlib_fm_operator *f;
+ f = &adlib_fm[i].mod;
+ f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1;
+ f = &adlib_fm[i].car;
+ f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1;
+ }
+
+ for (i=0;i < /*adlib_fm_voices*/1;i++) {
+ struct adlib_fm_operator *f;
+
+ f = &adlib_fm[i].mod;
+ f->mod_multiple = 1;
+ f->total_level = 63 - 16;
+ f->attack_rate = 15;
+ f->decay_rate = 0;
+ f->sustain_level = 7;
+ f->release_rate = 7;
+ f->f_number = musical_scale[i%18];
+ f->octave = 4;
+ f->key_on = 0;
+
+ f = &adlib_fm[i].car;
+ f->mod_multiple = 1;
+ f->total_level = 63 - 16;
+ f->attack_rate = 15;
+ f->decay_rate = 0;
+ f->sustain_level = 7;
+ f->release_rate = 7;
+ f->f_number = 0;
+ f->octave = 0;
+ f->key_on = 0;
+ }
+
+ adlib_apply_all();
+
+ printf("press Z! to noise\npress ESC to quit");