|
|
| version 1.6, 2003/10/27 15:06:31 | version 1.7, 2003/11/28 08:01:33 |
|---|---|
| Line 5 | Line 5 |
| #include "fmboard.h" | #include "fmboard.h" |
| extern OPNCFG opncfg; | #if defined(OPNGENX86) |
| #error use opngen.x86 | |
| #endif | |
| extern SINT32 env_curve[]; // ver0.27 | |
| extern SINT32 envtable[]; | extern OPNCFG opncfg; |
| extern SINT32 sintable[]; // ver0.27 | |
| #define CALCENV(e, c, s) \ | #define CALCENV(e, c, s) \ |
| Line 39 extern SINT32 sintable[]; // ver0.27 | Line 40 extern SINT32 sintable[]; // ver0.27 |
| break; \ | break; \ |
| } \ | } \ |
| } \ | } \ |
| (e) = (c)->slot[(s)].totallevel - env_curve[(c)->slot[(s)].env_cnt \ | (e) = (c)->slot[(s)].totallevel - \ |
| >> ENV_BITS]; | opncfg.envcurve[(c)->slot[(s)].env_cnt >> ENV_BITS]; |
| #define SLOTOUT(s, e, c) \ | #define SLOTOUT(s, e, c) \ |
| ((sintable[(((s).freq_cnt + (c)) >> (FREQ_BITS - SIN_BITS)) & \ | ((opncfg.sintable[(((s).freq_cnt + (c)) >> \ |
| (SIN_ENT-1)] * envtable[(e)]) >> (ENVTBL_BIT+SINTBL_BIT-TL_BITS)) | (FREQ_BITS - SIN_BITS)) & (SIN_ENT-1)] * \ |
| opncfg.envtable[(e)]) >> (ENVTBL_BIT+SINTBL_BIT-TL_BITS)) | |
| #if 0 | |
| static SINT32 calcrateenvlope(OPNSLOT *slot) { | |
| /* calcrate phage generator */ | |
| slot->freq_cnt += slot->freq_inc; | |
| /* calcrate envelope generator */ | |
| slot->env_cnt += slot->env_inc; | |
| if (slot->env_cnt >= slot->env_end) { | |
| switch(slot->env_mode) { | |
| case EM_ATTACK: // DECAY1 start | |
| slot->env_mode = EM_DECAY1; | |
| slot->env_cnt = EC_DECAY; | |
| slot->env_end = slot->decaylevel; | |
| slot->env_inc = slot->env_inc_decay1; | |
| break; | |
| case EM_DECAY1: // DECAY2 start | |
| slot->env_mode = EM_DECAY2; | |
| slot->env_cnt = slot->decaylevel; | |
| slot->env_end = EC_OFF; | |
| slot->env_inc = slot->env_inc_decay2; | |
| break; | |
| case EM_RELEASE: // OFF timing | |
| slot->env_mode = EM_OFF; | |
| case EM_DECAY2: // DECAY end | |
| slot->env_cnt = EC_OFF; | |
| slot->env_end = EC_OFF + 1; | |
| slot->env_inc = 0; | |
| break; | |
| } | |
| } | |
| return(slot->totallevel - env_curve[slot->env_cnt >> ENV_BITS]); | |
| } | |
| #endif | |
| static void calcratechannel(OPNCH *ch) { | static void calcratechannel(OPNCH *ch) { |
| Line 93 static void calcratechannel(OPNCH *ch) { | Line 59 static void calcratechannel(OPNCH *ch) { |
| opngen.feedback4 = 0; | opngen.feedback4 = 0; |
| /* SLOT 1 */ | /* SLOT 1 */ |
| // envout = calcrateenvlope(ch->slot + 0); | |
| CALCENV(envout, ch, 0); | CALCENV(envout, ch, 0); |
| if (envout > 0) { | if (envout > 0) { |
| if (ch->feedback) { | if (ch->feedback) { |
| Line 116 static void calcratechannel(OPNCH *ch) { | Line 81 static void calcratechannel(OPNCH *ch) { |
| } | } |
| } | } |
| /* SLOT 2 */ | /* SLOT 2 */ |
| // envout = calcrateenvlope(ch->slot + 1); | |
| CALCENV(envout, ch, 1); | CALCENV(envout, ch, 1); |
| if (envout > 0) { | if (envout > 0) { |
| *ch->connect2 += SLOTOUT(ch->slot[1], envout, opngen.feedback2); | *ch->connect2 += SLOTOUT(ch->slot[1], envout, opngen.feedback2); |
| } | } |
| /* SLOT 3 */ | /* SLOT 3 */ |
| // envout = calcrateenvlope(ch->slot + 2); | |
| CALCENV(envout, ch, 2); | CALCENV(envout, ch, 2); |
| if (envout > 0) { | if (envout > 0) { |
| *ch->connect3 += SLOTOUT(ch->slot[2], envout, opngen.feedback3); | *ch->connect3 += SLOTOUT(ch->slot[2], envout, opngen.feedback3); |
| } | } |
| /* SLOT 4 */ | /* SLOT 4 */ |
| // envout = calcrateenvlope(ch->slot + 3); | |
| CALCENV(envout, ch, 3); | CALCENV(envout, ch, 3); |
| if (envout > 0) { | if (envout > 0) { |
| *ch->connect4 += SLOTOUT(ch->slot[3], envout, opngen.feedback4); | *ch->connect4 += SLOTOUT(ch->slot[3], envout, opngen.feedback4); |