Diff for /np2/sound/opngenc.c between versions 1.5 and 1.11

version 1.5, 2003/10/23 15:38:13 version 1.11, 2005/05/13 05:47:25
Line 18 Line 18
   
   
         OPNCFG  opncfg;          OPNCFG  opncfg;
         SINT32  env_curve[EVC_ENT*2 + 1];  
         SINT32  envtable[EVC_ENT];  
         SINT32  sintable[SIN_ENT];  
 #ifdef OPNGENX86  #ifdef OPNGENX86
         char    envshift[EVC_ENT];          char    envshift[EVC_ENT];
         char    sinshift[SIN_ENT];          char    sinshift[SIN_ENT];
Line 34  static SINT32 decaytable[94]; Line 31  static SINT32 decaytable[94];
 static const SINT32     decayleveltable[16] = {  static const SINT32     decayleveltable[16] = {
                                         SC( 0),SC( 1),SC( 2),SC( 3),SC( 4),SC( 5),SC( 6),SC( 7),                                          SC( 0),SC( 1),SC( 2),SC( 3),SC( 4),SC( 5),SC( 6),SC( 7),
                                         SC( 8),SC( 9),SC(10),SC(11),SC(12),SC(13),SC(14),SC(31)};                                          SC( 8),SC( 9),SC(10),SC(11),SC(12),SC(13),SC(14),SC(31)};
 static const BYTE multipletable[] = {  static const UINT8 multipletable[] = {
                                 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30};                                  1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30};
 static const SINT32 nulltable[] = {  static const SINT32 nulltable[] = {
                                         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                                          0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
                                         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};                                          0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 static const BYTE kftable[16] = {0,0,0,0,0,0,0,1,2,3,3,3,3,3,3,3};  static const UINT8 kftable[16] = {0,0,0,0,0,0,0,1,2,3,3,3,3,3,3,3};
 static const BYTE dttable[] = {  static const UINT8 dttable[] = {
                                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,                                          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,                                          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                         0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,                                          0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
Line 55  static const int fmslot[4] = {0, 2, 1, 3 Line 52  static const int fmslot[4] = {0, 2, 1, 3
   
 void opngen_initialize(UINT rate) {  void opngen_initialize(UINT rate) {
   
           UINT    ratebit;
         int             i;          int             i;
         int             j;          int             j;
         double  pom;          double  pom;
         double  freq;          double  freq;
         UINT32  calcrate;          UINT32  calcrate;
   
         calcrate = rate * 55466 / 44100;          if (rate == 44100) {
                   ratebit = 0;
         opncfg.calc1024 = FMDIV_ENT * 44100 / 55466;          }
           else if (rate == 22050) {
                   ratebit = 1;
           }
           else {
                   ratebit = 2;
           }
           calcrate = (OPNA_CLOCK / 72) >> ratebit;
           opncfg.calc1024 = FMDIV_ENT * 44100 / (OPNA_CLOCK / 72);
   
         for (i=0; i<EVC_ENT; i++) {          for (i=0; i<EVC_ENT; i++) {
 #ifdef OPNGENX86  #ifdef OPNGENX86
Line 71  void opngen_initialize(UINT rate) { Line 77  void opngen_initialize(UINT rate) {
                 sft = ENVTBL_BIT;                  sft = ENVTBL_BIT;
                 while(sft < (ENVTBL_BIT + 8)) {                  while(sft < (ENVTBL_BIT + 8)) {
                         pom = (double)(1 << sft) / pow(10.0, EG_STEP*(EVC_ENT-i)/20.0);                          pom = (double)(1 << sft) / pow(10.0, EG_STEP*(EVC_ENT-i)/20.0);
                         envtable[i] = (long)pom;                          opncfg.envtable[i] = (long)pom;
                         envshift[i] = sft - TL_BITS;                          envshift[i] = sft - TL_BITS;
                         if (envtable[i] >= (1 << (ENVTBL_BIT - 1))) {                          if (opncfg.envtable[i] >= (1 << (ENVTBL_BIT - 1))) {
                                 break;                                  break;
                         }                          }
                         sft++;                          sft++;
                 }                  }
 #else  #else
                 pom = (double)(1 << ENVTBL_BIT) / pow(10.0, EG_STEP*(EVC_ENT-i)/20.0);                  pom = (double)(1 << ENVTBL_BIT) / pow(10.0, EG_STEP*(EVC_ENT-i)/20.0);
                 envtable[i] = (long)pom;                  opncfg.envtable[i] = (long)pom;
 #endif  #endif
         }          }
         for (i=0; i<SIN_ENT; i++) {          for (i=0; i<SIN_ENT; i++) {
Line 89  void opngen_initialize(UINT rate) { Line 95  void opngen_initialize(UINT rate) {
                 sft = SINTBL_BIT;                  sft = SINTBL_BIT;
                 while(sft < (SINTBL_BIT + 8)) {                  while(sft < (SINTBL_BIT + 8)) {
                         pom = (double)(1 << sft) * sin(2*PI*i/SIN_ENT);                          pom = (double)(1 << sft) * sin(2*PI*i/SIN_ENT);
                         sintable[i] = (long)pom;                          opncfg.sintable[i] = (long)pom;
                         sinshift[i] = sft;                          sinshift[i] = sft;
                         if (sintable[i] >= (1 << (SINTBL_BIT - 1))) {                          if (opncfg.sintable[i] >= (1 << (SINTBL_BIT - 1))) {
                                 break;                                  break;
                         }                          }
                         if (sintable[i] <= -1 * (1 << (SINTBL_BIT - 1))) {                          if (opncfg.sintable[i] <= -1 * (1 << (SINTBL_BIT - 1))) {
                                 break;                                  break;
                         }                          }
                         sft++;                          sft++;
                 }                  }
 #else  #else
                 pom = (double)((1 << SINTBL_BIT) - 1) * sin(2*PI*i/SIN_ENT);                  pom = (double)((1 << SINTBL_BIT) - 1) * sin(2*PI*i/SIN_ENT);
                 sintable[i] = (long)pom;                                                        // ver0.27                  opncfg.sintable[i] = (long)pom;
 #endif  #endif
         }          }
         for (i=0; i<EVC_ENT; i++) {          for (i=0; i<EVC_ENT; i++) {
                 pom = pow(((double)(EVC_ENT-1-i)/EVC_ENT), 8) * EVC_ENT;                  pom = pow(((double)(EVC_ENT-1-i)/EVC_ENT), 8) * EVC_ENT;
                 env_curve[i] = (long)pom;                                                       // ver0.27                  opncfg.envcurve[i] = (long)pom;
                 env_curve[EVC_ENT + i] = i;                  opncfg.envcurve[EVC_ENT + i] = i;
         }          }
         env_curve[EVC_ENT*2] = EVC_ENT;          opncfg.envcurve[EVC_ENT*2] = EVC_ENT;
   
 //      opmbaserate = (1L << FREQ_BITS) / (rate * x / 44100) * 55466;  //      opmbaserate = (1L << FREQ_BITS) / (rate * x / 44100) * 55466;
 //      でも今は x == 55466だから…  //      でも今は x == 55466だから…
Line 150  void opngen_initialize(UINT rate) { Line 156  void opngen_initialize(UINT rate) {
                         freq *= 1.0 + (i & 3) * 0.25;                          freq *= 1.0 + (i & 3) * 0.25;
                 }                  }
                 freq *= (double)(1 << ((i >> 2) - 1));                  freq *= (double)(1 << ((i >> 2) - 1));
   #if 0
                   attacktable[i] = (long)((freq + OPM_ARRATE - 1) / OPM_ARRATE);
                   decaytable[i] = (long)((freq + OPM_DRRATE - 1) / OPM_DRRATE);
   #else
                 attacktable[i] = (long)(freq / OPM_ARRATE);                  attacktable[i] = (long)(freq / OPM_ARRATE);
                 decaytable[i] = (long)(freq / OPM_DRRATE);                  decaytable[i] = (long)(freq / OPM_DRRATE);
   #endif
                   if (attacktable[i] >= EC_DECAY) {
                           TRACEOUT(("attacktable %d %d %d", i, attacktable[i], EC_DECAY));
                   }
                   if (decaytable[i] >= EC_DECAY) {
                           TRACEOUT(("decaytable %d %d %d", i, decaytable[i], EC_DECAY));
                   }
         }          }
         attacktable[62] = EC_DECAY - 1;          attacktable[62] = EC_DECAY - 1;
         attacktable[63] = EC_DECAY - 1;          attacktable[63] = EC_DECAY - 1;
Line 169  void opngen_setvol(UINT vol) { Line 186  void opngen_setvol(UINT vol) {
 #endif  #endif
 }  }
   
 void opngen_setVR(BYTE channel, BYTE value) {  void opngen_setVR(REG8 channel, REG8 value) {
   
         if ((channel & 3) && (value)) {          if ((channel & 3) && (value)) {
                 opncfg.vr_en = TRUE;                  opncfg.vr_en = TRUE;
Line 187  void opngen_setVR(BYTE channel, BYTE val Line 204  void opngen_setVR(BYTE channel, BYTE val
 static void set_algorithm(OPNCH *ch) {  static void set_algorithm(OPNCH *ch) {
   
         SINT32  *outd;          SINT32  *outd;
           UINT8   outslot;
   
         outd = &opngen.outdc;          outd = &opngen.outdc;
         if (ch->stereo) {          if (ch->stereo) {
Line 205  static void set_algorithm(OPNCH *ch) { Line 223  static void set_algorithm(OPNCH *ch) {
                         ch->connect1 = &opngen.feedback2;                          ch->connect1 = &opngen.feedback2;
                         ch->connect2 = &opngen.feedback3;                          ch->connect2 = &opngen.feedback3;
                         ch->connect3 = &opngen.feedback4;                          ch->connect3 = &opngen.feedback4;
                           outslot = 0x08;
                         break;                          break;
   
                 case 1:                  case 1:
                         ch->connect1 = &opngen.feedback3;                          ch->connect1 = &opngen.feedback3;
                         ch->connect2 = &opngen.feedback3;                          ch->connect2 = &opngen.feedback3;
                         ch->connect3 = &opngen.feedback4;                          ch->connect3 = &opngen.feedback4;
                           outslot = 0x08;
                         break;                          break;
   
                 case 2:                  case 2:
                         ch->connect1 = &opngen.feedback4;                          ch->connect1 = &opngen.feedback4;
                         ch->connect2 = &opngen.feedback3;                          ch->connect2 = &opngen.feedback3;
                         ch->connect3 = &opngen.feedback4;                          ch->connect3 = &opngen.feedback4;
                           outslot = 0x08;
                         break;                          break;
   
                 case 3:                  case 3:
                         ch->connect1 = &opngen.feedback2;                          ch->connect1 = &opngen.feedback2;
                         ch->connect2 = &opngen.feedback4;                          ch->connect2 = &opngen.feedback4;
                         ch->connect3 = &opngen.feedback4;                          ch->connect3 = &opngen.feedback4;
                           outslot = 0x08;
                         break;                          break;
   
                 case 4:                  case 4:
                         ch->connect1 = &opngen.feedback2;                          ch->connect1 = &opngen.feedback2;
                         ch->connect2 = outd;                          ch->connect2 = outd;
                         ch->connect3 = &opngen.feedback4;                          ch->connect3 = &opngen.feedback4;
                           outslot = 0x0a;
                         break;                          break;
   
                 case 5:                  case 5:
                         ch->connect1 = 0;                          ch->connect1 = 0;
                         ch->connect2 = outd;                          ch->connect2 = outd;
                         ch->connect3 = outd;                          ch->connect3 = outd;
                           outslot = 0x0e;
                         break;                          break;
   
                 case 6:                  case 6:
                         ch->connect1 = &opngen.feedback2;                          ch->connect1 = &opngen.feedback2;
                         ch->connect2 = outd;                          ch->connect2 = outd;
                         ch->connect3 = outd;                          ch->connect3 = outd;
                           outslot = 0x0e;
                         break;                          break;
   
                 case 7:                  case 7:
Line 248  static void set_algorithm(OPNCH *ch) { Line 273  static void set_algorithm(OPNCH *ch) {
                         ch->connect1 = outd;                          ch->connect1 = outd;
                         ch->connect2 = outd;                          ch->connect2 = outd;
                         ch->connect3 = outd;                          ch->connect3 = outd;
                           outslot = 0x0f;
         }          }
         ch->connect4 = outd;          ch->connect4 = outd;
           ch->outslot = outslot;
 }  }
   
 static void set_dt1_mul(OPNSLOT *slot, BYTE value) {  static void set_dt1_mul(OPNSLOT *slot, REG8 value) {
   
         slot->multiple = (SINT32)multipletable[value & 0x0f];          slot->multiple = (SINT32)multipletable[value & 0x0f];
         slot->detune1 = detunetable[(value >> 4) & 7];          slot->detune1 = detunetable[(value >> 4) & 7];
 }  }
   
 static void set_tl(OPNSLOT *slot, BYTE value) {  static void set_tl(OPNSLOT *slot, REG8 value) {
   
   #if (EVC_BITS >= 7)
         slot->totallevel = ((~value) & 0x007f) << (EVC_BITS - 7);          slot->totallevel = ((~value) & 0x007f) << (EVC_BITS - 7);
   #else
           slot->totallevel = ((~value) & 0x007f) >> (7 - EVC_BITS);
   #endif
 }  }
   
 static void set_ks_ar(OPNSLOT *slot, BYTE value) {  static void set_ks_ar(OPNSLOT *slot, REG8 value) {
   
         slot->keyscale = (BYTE)(((~value)>>6)&3);          slot->keyscale = ((~value) >> 6) & 3;
         value &= 0x1f;          value &= 0x1f;
         slot->attack = (value)?(attacktable + (value << 1)):nulltable;          slot->attack = (value)?(attacktable + (value << 1)):nulltable;
         slot->env_inc_attack = slot->attack[slot->envraito];          slot->env_inc_attack = slot->attack[slot->envratio];
         if (slot->env_mode == EM_ATTACK) {          if (slot->env_mode == EM_ATTACK) {
                 slot->env_inc = slot->env_inc_attack;                  slot->env_inc = slot->env_inc_attack;
         }          }
 }  }
   
 static void set_d1r(OPNSLOT *slot, BYTE value) {  static void set_d1r(OPNSLOT *slot, REG8 value) {
   
         value &= 0x1f;          value &= 0x1f;
         slot->decay1 = (value)?(decaytable + (value << 1)):nulltable;          slot->decay1 = (value)?(decaytable + (value << 1)):nulltable;
         slot->env_inc_decay1 = slot->decay1[slot->envraito];          slot->env_inc_decay1 = slot->decay1[slot->envratio];
         if (slot->env_mode == EM_DECAY1) {          if (slot->env_mode == EM_DECAY1) {
                 slot->env_inc = slot->env_inc_decay1;                  slot->env_inc = slot->env_inc_decay1;
         }          }
 }  }
   
 static void set_dt2_d2r(OPNSLOT *slot, BYTE value) {  static void set_dt2_d2r(OPNSLOT *slot, REG8 value) {
   
         value &= 0x1f;          value &= 0x1f;
         slot->decay2 = (value)?(decaytable + (value << 1)):nulltable;          slot->decay2 = (value)?(decaytable + (value << 1)):nulltable;
Line 292  static void set_dt2_d2r(OPNSLOT *slot, B Line 323  static void set_dt2_d2r(OPNSLOT *slot, B
                 slot->env_inc_decay2 = 0;                  slot->env_inc_decay2 = 0;
         }          }
         else {          else {
                 slot->env_inc_decay2 = slot->decay2[slot->envraito];                  slot->env_inc_decay2 = slot->decay2[slot->envratio];
         }          }
         if (slot->env_mode == EM_DECAY2) {          if (slot->env_mode == EM_DECAY2) {
                 slot->env_inc = slot->env_inc_decay2;                  slot->env_inc = slot->env_inc_decay2;
         }          }
 }  }
   
 static void set_d1l_rr(OPNSLOT *slot, BYTE value) {  static void set_d1l_rr(OPNSLOT *slot, REG8 value) {
   
         slot->decaylevel = decayleveltable[(value >> 4)];          slot->decaylevel = decayleveltable[(value >> 4)];
         slot->release = decaytable + ((value & 0x0f) << 2) + 2;          slot->release = decaytable + ((value & 0x0f) << 2) + 2;
         slot->env_inc_release = slot->release[slot->envraito];          slot->env_inc_release = slot->release[slot->envratio];
         if (slot->env_mode == EM_RELEASE) {          if (slot->env_mode == EM_RELEASE) {
                 slot->env_inc = slot->env_inc_release;                  slot->env_inc = slot->env_inc_release;
                 if (value == 0xff) {                  if (value == 0xff) {
                         slot->env_mode = EM_OFF;                          slot->env_mode = EM_OFF;
                         slot->env_cnt = EC_OFF;                          slot->env_cnt = EC_OFF;
                         slot->env_end = EC_OFF+1;                          slot->env_end = EC_OFF + 1;
                         slot->env_inc = 0;                          slot->env_inc = 0;
                 }                  }
         }          }
 }  }
   
 static void set_ssgeg(OPNSLOT *slot, BYTE value) {  static void set_ssgeg(OPNSLOT *slot, REG8 value) {
   
         value &= 0xf;          value &= 0xf;
         if ((value == 0xb) || (value == 0xd)) {          if ((value == 0xb) || (value == 0xd)) {
Line 324  static void set_ssgeg(OPNSLOT *slot, BYT Line 355  static void set_ssgeg(OPNSLOT *slot, BYT
         }          }
         else {          else {
                 slot->ssgeg1 = 0;                  slot->ssgeg1 = 0;
                 slot->env_inc_decay2 = slot->decay2[slot->envraito];                  slot->env_inc_decay2 = slot->decay2[slot->envratio];
         }          }
         if (slot->env_mode == EM_DECAY2) {          if (slot->env_mode == EM_DECAY2) {
                 slot->env_inc = slot->env_inc_decay2;                  slot->env_inc = slot->env_inc_decay2;
Line 335  static void channleupdate(OPNCH *ch) { Line 366  static void channleupdate(OPNCH *ch) {
   
         int             i;          int             i;
         UINT32  fc = ch->keynote[0];                                            // ver0.27          UINT32  fc = ch->keynote[0];                                            // ver0.27
         BYTE    kc = ch->kcode[0];          UINT8   kc = ch->kcode[0];
         BYTE    evr;          UINT    evr;
         OPNSLOT *slot;          OPNSLOT *slot;
         int             s;          int             s;
   
Line 344  static void channleupdate(OPNCH *ch) { Line 375  static void channleupdate(OPNCH *ch) {
         if (!(ch->extop)) {          if (!(ch->extop)) {
                 for (i=0; i<4; i++, slot++) {                  for (i=0; i<4; i++, slot++) {
                         slot->freq_inc = (fc + slot->detune1[kc]) * slot->multiple;                          slot->freq_inc = (fc + slot->detune1[kc]) * slot->multiple;
                         evr = (BYTE)(kc >> slot->keyscale);                          evr = kc >> slot->keyscale;
                         if (slot->envraito != evr) {                          if (slot->envratio != evr) {
                                 slot->envraito = evr;                                  slot->envratio = evr;
                                 slot->env_inc_attack = slot->attack[evr];                                  slot->env_inc_attack = slot->attack[evr];
                                 slot->env_inc_decay1 = slot->decay1[evr];                                  slot->env_inc_decay1 = slot->decay1[evr];
                                 slot->env_inc_decay2 = slot->decay2[evr];                                  slot->env_inc_decay2 = slot->decay2[evr];
Line 359  static void channleupdate(OPNCH *ch) { Line 390  static void channleupdate(OPNCH *ch) {
                         s = extendslot[i];                          s = extendslot[i];
                         slot->freq_inc = (ch->keynote[s] + slot->detune1[ch->kcode[s]])                          slot->freq_inc = (ch->keynote[s] + slot->detune1[ch->kcode[s]])
                                                                                                                 * slot->multiple;                                                                                                                  * slot->multiple;
                         evr = (BYTE)(ch->kcode[s] >> slot->keyscale);                          evr = ch->kcode[s] >> slot->keyscale;
                         if (slot->envraito != evr) {                          if (slot->envratio != evr) {
                                 slot->envraito = evr;                                  slot->envratio = evr;
                                 slot->env_inc_attack = slot->attack[evr];                                  slot->env_inc_attack = slot->attack[evr];
                                 slot->env_inc_decay1 = slot->decay1[evr];                                  slot->env_inc_decay1 = slot->decay1[evr];
                                 slot->env_inc_decay2 = slot->decay2[evr];                                  slot->env_inc_decay2 = slot->decay2[evr];
Line 404  void opngen_reset(void) { Line 435  void opngen_reset(void) {
                 ch++;                  ch++;
         }          }
         for (i=0x30; i<0xc0; i++) {          for (i=0x30; i<0xc0; i++) {
                 opngen_setreg(0, (BYTE)i, 0xff);                  opngen_setreg(0, i, 0xff);
                 opngen_setreg(3, (BYTE)i, 0xff);                  opngen_setreg(3, i, 0xff);
                 opngen_setreg(6, (BYTE)i, 0xff);                  opngen_setreg(6, i, 0xff);
                 opngen_setreg(9, (BYTE)i, 0xff);                  opngen_setreg(9, i, 0xff);
         }          }
 }  }
   
 void opngen_setcfg(BYTE maxch, UINT flag) {  void opngen_setcfg(REG8 maxch, UINT flag) {
   
         OPNCH   *ch;          OPNCH   *ch;
         UINT    i;          UINT    i;
Line 438  void opngen_setcfg(BYTE maxch, UINT flag Line 469  void opngen_setcfg(BYTE maxch, UINT flag
         }          }
 }  }
   
 void opngen_setextch(UINT chnum, BYTE data) {  void opngen_setextch(UINT chnum, REG8 data) {
   
         OPNCH   *ch;          OPNCH   *ch;
   
Line 446  void opngen_setextch(UINT chnum, BYTE da Line 477  void opngen_setextch(UINT chnum, BYTE da
         ch[chnum].extop = data;          ch[chnum].extop = data;
 }  }
   
 void opngen_setreg(BYTE chbase, BYTE reg, BYTE value) {  void opngen_setreg(REG8 chbase, UINT reg, REG8 value) {
   
         UINT    chpos;          UINT    chpos;
         OPNCH   *ch;          OPNCH   *ch;
         OPNSLOT *slot;          OPNSLOT *slot;
         UINT    fn;          UINT    fn;
         BYTE    blk;          UINT8   blk;
   
         chpos = reg & 3;          chpos = reg & 3;
         if (chpos == 3) {          if (chpos == 3) {
Line 527  void opngen_setreg(BYTE chbase, BYTE reg Line 558  void opngen_setreg(BYTE chbase, BYTE reg
                                 break;                                  break;
   
                         case 0xb0:                          case 0xb0:
                                 ch->algorithm = (BYTE)(value & 7);                                  ch->algorithm = (UINT8)(value & 7);
                                 value = (value >> 3) & 7;                                  value = (value >> 3) & 7;
                                 if (value) {                                  if (value) {
                                         ch->feedback = 8 - value;                                          ch->feedback = 8 - value;
Line 539  void opngen_setreg(BYTE chbase, BYTE reg Line 570  void opngen_setreg(BYTE chbase, BYTE reg
                                 break;                                  break;
   
                         case 0xb4:                          case 0xb4:
                                 ch->pan = (BYTE)(value & 0xc0);                                  ch->pan = (UINT8)(value & 0xc0);
                                 set_algorithm(ch);                                  set_algorithm(ch);
                                 break;                                  break;
                 }                  }
         }          }
 }  }
   
 void opngen_keyon(UINT chnum, BYTE value) {  void opngen_keyon(UINT chnum, REG8 value) {
   
         OPNCH   *ch;          OPNCH   *ch;
         OPNSLOT *slot;          OPNSLOT *slot;
         BYTE    bit;          REG8    bit;
         UINT    i;          UINT    i;
   
         sound_sync();          sound_sync();
Line 577  void opngen_keyon(UINT chnum, BYTE value Line 608  void opngen_keyon(UINT chnum, BYTE value
                         if (slot->env_mode > EM_RELEASE) {                          if (slot->env_mode > EM_RELEASE) {
                                 slot->env_mode = EM_RELEASE;                                  slot->env_mode = EM_RELEASE;
                                 if (!(slot->env_cnt & EC_DECAY)) {                                  if (!(slot->env_cnt & EC_DECAY)) {
                                         slot->env_cnt = (env_curve[slot->env_cnt >> ENV_BITS]                                          slot->env_cnt = (opncfg.envcurve[slot->env_cnt
                                                                                                         << ENV_BITS) + EC_DECAY;                                                                                  >> ENV_BITS] << ENV_BITS) + EC_DECAY;
                                 }                                  }
                                 slot->env_end = EC_OFF;                                  slot->env_end = EC_OFF;
                                 slot->env_inc = slot->env_inc_release;                                  slot->env_inc = slot->env_inc_release;
Line 587  void opngen_keyon(UINT chnum, BYTE value Line 618  void opngen_keyon(UINT chnum, BYTE value
                 slot++;                  slot++;
                 bit <<= 1;                  bit <<= 1;
         }          }
         keydisp_fmkeyon((BYTE)chnum, value);          keydisp_fmkeyon((UINT8)chnum, value);
 }  }
   

Removed from v.1.5  
changed lines
  Added in v.1.11


RetroPC.NET-CVS <cvs@retropc.net>