| version 1.1.1.1, 2003/10/16 17:58:13 | version 1.5, 2007/12/29 12:56:22 | 
| Line 25 | Line 25 | 
 |  |  | 
 | // ---- vibrate | // ---- vibrate | 
 |  |  | 
| static int vibrate_update(VOICE v) { | static int VERMOUTHCL vibrate_update(VOICE v) { | 
 |  |  | 
 | int             depth; | int             depth; | 
 | int             phase; | int             phase; | 
| Line 52  static int vibrate_update(VOICE v) { | Line 52  static int vibrate_update(VOICE v) { | 
 | return((int)(step * (float)(1 << FREQ_SHIFT))); | return((int)(step * (float)(1 << FREQ_SHIFT))); | 
 | } | } | 
 |  |  | 
| static SAMPLE resample_vibrate(VOICE v, SAMPLE dst, SAMPLE dstterm) { | static SAMPLE VERMOUTHCL resample_vibrate(VOICE v, SAMPLE dst, | 
|  | SAMPLE dstterm) { | 
 |  |  | 
 | SAMPLE  src; | SAMPLE  src; | 
 | SAMPLE  dstbreak; | SAMPLE  dstbreak; | 
| Line 95  static SAMPLE resample_vibrate(VOICE v, | Line 96  static SAMPLE resample_vibrate(VOICE v, | 
 | } while(dstbreak < dstterm); | } while(dstbreak < dstterm); | 
 | v->sampstep = step; | v->sampstep = step; | 
 | } | } | 
| v->vibrate.count = cnt - (dstterm - dst); | v->vibrate.count = cnt - (int)(dstterm - dst); | 
 | do { | do { | 
 | RESAMPLING(dst, src, pos); | RESAMPLING(dst, src, pos); | 
 | dst++; | dst++; | 
| Line 109  static SAMPLE resample_vibrate(VOICE v, | Line 110  static SAMPLE resample_vibrate(VOICE v, | 
 | return(dst); | return(dst); | 
 | } | } | 
 |  |  | 
| static SAMPLE resample_vibloop(VOICE v, SAMPLE dst, SAMPLE dstterm) { | static SAMPLE VERMOUTHCL resample_vibloop(VOICE v, SAMPLE dst, | 
|  | SAMPLE dstterm) { | 
 |  |  | 
 | SAMPLE  src; | SAMPLE  src; | 
 | SAMPLE  dstbreak; | SAMPLE  dstbreak; | 
| Line 147  static SAMPLE resample_vibloop(VOICE v, | Line 149  static SAMPLE resample_vibloop(VOICE v, | 
 | } while(dstbreak < dstterm); | } while(dstbreak < dstterm); | 
 | v->sampstep = step; | v->sampstep = step; | 
 | } | } | 
| v->vibrate.count = cnt - (dstterm - dst); | v->vibrate.count = cnt - (int)(dstterm - dst); | 
 | do { | do { | 
 | RESAMPLING(dst, src, pos); | RESAMPLING(dst, src, pos); | 
 | dst++; | dst++; | 
| Line 161  static SAMPLE resample_vibloop(VOICE v, | Line 163  static SAMPLE resample_vibloop(VOICE v, | 
 | return(dst); | return(dst); | 
 | } | } | 
 |  |  | 
| static SAMPLE resample_vibround(VOICE v, SAMPLE dst, SAMPLE dstterm) { | static SAMPLE VERMOUTHCL resample_vibround(VOICE v, SAMPLE dst, | 
|  | SAMPLE dstterm) { | 
 |  |  | 
 | SAMPLE  src; | SAMPLE  src; | 
 | SAMPLE  dstbreak; | SAMPLE  dstbreak; | 
| Line 212  rr_forward1:; | Line 215  rr_forward1:; | 
 | dstbreak += cnt; | dstbreak += cnt; | 
 | } while(dstbreak < dstterm); | } while(dstbreak < dstterm); | 
 | } | } | 
| v->vibrate.count = cnt - (dstterm - dst); | v->vibrate.count = cnt - (int)(dstterm - dst); | 
 | do { | do { | 
 | RESAMPLING(dst, src, pos); | RESAMPLING(dst, src, pos); | 
 | dst++; | dst++; | 
| Line 245  rr_backward1:; | Line 248  rr_backward1:; | 
 | dstbreak += cnt; | dstbreak += cnt; | 
 | } while(dstbreak < dstterm); | } while(dstbreak < dstterm); | 
 | } | } | 
| v->vibrate.count = cnt - (dstterm - dst); | v->vibrate.count = cnt - (int)(dstterm - dst); | 
 | do { | do { | 
 | RESAMPLING(dst, src, pos); | RESAMPLING(dst, src, pos); | 
 | dst++; | dst++; | 
| Line 269  rr_done: | Line 272  rr_done: | 
 |  |  | 
 | // ---- normal | // ---- normal | 
 |  |  | 
| static SAMPLE resample_normal(VOICE v, SAMPLE dst, SAMPLE dstterm) { | static SAMPLE VERMOUTHCL resample_normal(VOICE v, SAMPLE dst, SAMPLE dstterm) { | 
 |  |  | 
 | SAMPLE  src; | SAMPLE  src; | 
 | int             pos; | int             pos; | 
| Line 298  static SAMPLE resample_normal(VOICE v, S | Line 301  static SAMPLE resample_normal(VOICE v, S | 
 | return(dst); | return(dst); | 
 | } | } | 
 |  |  | 
| static SAMPLE resample_loop(VOICE v, SAMPLE dst, SAMPLE dstterm) { | static SAMPLE VERMOUTHCL resample_loop(VOICE v, SAMPLE dst, SAMPLE dstterm) { | 
 |  |  | 
 | SAMPLE  src; | SAMPLE  src; | 
 | int             pos; | int             pos; | 
| Line 321  static SAMPLE resample_loop(VOICE v, SAM | Line 324  static SAMPLE resample_loop(VOICE v, SAM | 
 | return(dst); | return(dst); | 
 | } | } | 
 |  |  | 
| static SAMPLE resample_round(VOICE v, SAMPLE dst, SAMPLE dstterm) { | static SAMPLE VERMOUTHCL resample_round(VOICE v, SAMPLE dst, SAMPLE dstterm) { | 
 |  |  | 
 | SAMPLE  src; | SAMPLE  src; | 
 | int             pos; | int             pos; | 
| Line 376  rr_done: | Line 379  rr_done: | 
 |  |  | 
 | // ---- | // ---- | 
 |  |  | 
| int envlope_setphase(VOICE v, int phase) { | int VERMOUTHCL envlope_setphase(VOICE v, int phase) { | 
 |  |  | 
 | do { | do { | 
 | if (phase >= 6) { | if (phase >= 6) { | 
| Line 402  int envlope_setphase(VOICE v, int phase) | Line 405  int envlope_setphase(VOICE v, int phase) | 
 | return(0); | return(0); | 
 | } | } | 
 |  |  | 
| void envelope_updates(VOICE v) { | void VERMOUTHCL envelope_updates(VOICE v) { | 
 |  |  | 
 | int             envl; | int             envl; | 
 | int             envr; | int             envr; | 
| Line 457  void envelope_updates(VOICE v) { | Line 460  void envelope_updates(VOICE v) { | 
 | } | } | 
 |  |  | 
 | #if defined(ENABLE_TREMOLO) | #if defined(ENABLE_TREMOLO) | 
| static void tremolo_update(VOICE v) { | static void VERMOUTHCL tremolo_update(VOICE v) { | 
 |  |  | 
 | int             depth; | int             depth; | 
 | int             cnt; | int             cnt; | 
 | int             vol; | int             vol; | 
 |  | int             pos; | 
 |  |  | 
 | depth = v->sample->tremolo_depth << 8; | depth = v->sample->tremolo_depth << 8; | 
 | if (v->tremolo.sweepstep) { | if (v->tremolo.sweepstep) { | 
| Line 476  static void tremolo_update(VOICE v) { | Line 480  static void tremolo_update(VOICE v) { | 
 | } | } | 
 | v->tremolo.count += v->tremolo.step; | v->tremolo.count += v->tremolo.step; | 
 | cnt = v->tremolo.count >> TRERATE_SHIFT; | cnt = v->tremolo.count >> TRERATE_SHIFT; | 
| vol = envsin12q[cnt & ((1 << (SINENT_BIT - 2)) - 1)]; | pos = cnt & ((1 << (SINENT_BIT - 2)) - 1); | 
 | if (cnt & (1 << (SINENT_BIT - 2))) { | if (cnt & (1 << (SINENT_BIT - 2))) { | 
| vol = (1 << 12) - vol; | pos ^= ((1 << (SINENT_BIT - 2)) - 1); | 
 | } | } | 
 |  | vol = envsin12q[pos]; | 
 | if (cnt & (1 << (SINENT_BIT - 1))) { | if (cnt & (1 << (SINENT_BIT - 1))) { | 
 | vol = 0 - vol; | vol = 0 - vol; | 
 | } | } | 
| Line 514  static int envelope_update(VOICE v) { | Line 519  static int envelope_update(VOICE v) { | 
 |  |  | 
 | // ---- release | // ---- release | 
 |  |  | 
| static void mixrel_normal(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixrel_normal(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | int             samples; | int             samples; | 
 | SINT32  voll; | SINT32  voll; | 
| Line 523  static void mixrel_normal(VOICE v, SINT3 | Line 529  static void mixrel_normal(VOICE v, SINT3 | 
 | SINT32  relr; | SINT32  relr; | 
 | _SAMPLE s; | _SAMPLE s; | 
 |  |  | 
| samples = srcterm - src; | samples = (int)(srcterm - src); | 
 | voll = v->envleft << RELBIT; | voll = v->envleft << RELBIT; | 
 | rell = -(voll / samples); | rell = -(voll / samples); | 
 | if (!rell) { | if (!rell) { | 
| Line 548  static void mixrel_normal(VOICE v, SINT3 | Line 554  static void mixrel_normal(VOICE v, SINT3 | 
 | } while(src < srcterm); | } while(src < srcterm); | 
 | } | } | 
 |  |  | 
| static void mixrel_left(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixrel_left(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | SINT32  vol; | SINT32  vol; | 
 | SINT32  rel; | SINT32  rel; | 
 | _SAMPLE s; | _SAMPLE s; | 
 |  |  | 
 | vol = v->envleft << RELBIT; | vol = v->envleft << RELBIT; | 
| rel = - (vol / (srcterm - src)); | rel = - (vol / (int)(srcterm - src)); | 
 | if (!rel) { | if (!rel) { | 
 | rel = -1; | rel = -1; | 
 | } | } | 
| Line 570  static void mixrel_left(VOICE v, SINT32 | Line 577  static void mixrel_left(VOICE v, SINT32 | 
 | } while(src < srcterm); | } while(src < srcterm); | 
 | } | } | 
 |  |  | 
| static void mixrel_right(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixrel_right(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | mixrel_left(v, dst + 1, src, srcterm); | mixrel_left(v, dst + 1, src, srcterm); | 
 | } | } | 
 |  |  | 
| static void mixrel_centre(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixrel_centre(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | SINT32  vol; | SINT32  vol; | 
 | SINT32  rel; | SINT32  rel; | 
| Line 583  static void mixrel_centre(VOICE v, SINT3 | Line 592  static void mixrel_centre(VOICE v, SINT3 | 
 | SINT32  d; | SINT32  d; | 
 |  |  | 
 | vol = v->envleft << RELBIT; | vol = v->envleft << RELBIT; | 
| rel = - (vol / (srcterm - src)); | rel = - (vol / (int)(srcterm - src)); | 
 | if (!rel) { | if (!rel) { | 
 | rel = -1; | rel = -1; | 
 | } | } | 
| Line 603  static void mixrel_centre(VOICE v, SINT3 | Line 612  static void mixrel_centre(VOICE v, SINT3 | 
 |  |  | 
 | // ---- normal | // ---- normal | 
 |  |  | 
| static void mixnor_normal(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixnor_normal(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | SINT32  voll; | SINT32  voll; | 
 | SINT32  volr; | SINT32  volr; | 
| Line 619  static void mixnor_normal(VOICE v, SINT3 | Line 629  static void mixnor_normal(VOICE v, SINT3 | 
 | } while(src < srcterm); | } while(src < srcterm); | 
 | } | } | 
 |  |  | 
| static void mixnor_left(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixnor_left(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | SINT32  vol; | SINT32  vol; | 
 | _SAMPLE s; | _SAMPLE s; | 
| Line 632  static void mixnor_left(VOICE v, SINT32 | Line 643  static void mixnor_left(VOICE v, SINT32 | 
 | } while(src < srcterm); | } while(src < srcterm); | 
 | } | } | 
 |  |  | 
| static void mixnor_right(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixnor_right(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | SINT32  vol; | SINT32  vol; | 
 | _SAMPLE s; | _SAMPLE s; | 
| Line 645  static void mixnor_right(VOICE v, SINT32 | Line 657  static void mixnor_right(VOICE v, SINT32 | 
 | } while(src < srcterm); | } while(src < srcterm); | 
 | } | } | 
 |  |  | 
| static void mixnor_centre(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixnor_centre(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | SINT32  vol; | SINT32  vol; | 
 | _SAMPLE s; | _SAMPLE s; | 
| Line 664  static void mixnor_centre(VOICE v, SINT3 | Line 677  static void mixnor_centre(VOICE v, SINT3 | 
 |  |  | 
 | // ---- env | // ---- env | 
 |  |  | 
| static void mixenv_normal(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixenv_normal(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | int             cnt; | int             cnt; | 
 | SINT32  voll; | SINT32  voll; | 
| Line 701  static void mixenv_normal(VOICE v, SINT3 | Line 715  static void mixenv_normal(VOICE v, SINT3 | 
 | } while(srcbreak < srcterm); | } while(srcbreak < srcterm); | 
 | } | } | 
 |  |  | 
| v->envcount = cnt - (srcterm - src); | v->envcount = cnt - (int)(srcterm - src); | 
 | do { | do { | 
 | s = *src++; | s = *src++; | 
 | dst[0] += SAMPMULVOL(s, voll); | dst[0] += SAMPMULVOL(s, voll); | 
| Line 710  static void mixenv_normal(VOICE v, SINT3 | Line 724  static void mixenv_normal(VOICE v, SINT3 | 
 | } while(src < srcterm); | } while(src < srcterm); | 
 | } | } | 
 |  |  | 
| static void mixenv_left(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixenv_left(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | int             cnt; | int             cnt; | 
 | SINT32  vol; | SINT32  vol; | 
| Line 743  static void mixenv_left(VOICE v, SINT32 | Line 758  static void mixenv_left(VOICE v, SINT32 | 
 | } while(srcbreak < srcterm); | } while(srcbreak < srcterm); | 
 | } | } | 
 |  |  | 
| v->envcount = cnt - (srcterm - src); | v->envcount = cnt - (int)(srcterm - src); | 
 | do { | do { | 
 | s = *src++; | s = *src++; | 
 | dst[0] += SAMPMULVOL(s, vol); | dst[0] += SAMPMULVOL(s, vol); | 
| Line 751  static void mixenv_left(VOICE v, SINT32 | Line 766  static void mixenv_left(VOICE v, SINT32 | 
 | } while(src < srcterm); | } while(src < srcterm); | 
 | } | } | 
 |  |  | 
| static void mixenv_right(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixenv_right(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | mixenv_left(v, dst + 1, src, srcterm); | mixenv_left(v, dst + 1, src, srcterm); | 
 | } | } | 
 |  |  | 
| static void mixenv_centre(VOICE v, SINT32 *dst, SAMPLE src, SAMPLE srcterm) { | static void VERMOUTHCL mixenv_centre(VOICE v, SINT32 *dst, SAMPLE src, | 
|  | SAMPLE srcterm) { | 
 |  |  | 
 | int             cnt; | int             cnt; | 
 | SINT32  vol; | SINT32  vol; | 
| Line 792  static void mixenv_centre(VOICE v, SINT3 | Line 809  static void mixenv_centre(VOICE v, SINT3 | 
 | } while(srcbreak < srcterm); | } while(srcbreak < srcterm); | 
 | } | } | 
 |  |  | 
| v->envcount = cnt - (srcterm - src); | v->envcount = cnt - (int)(srcterm - src); | 
 | do { | do { | 
 | s = *src++; | s = *src++; | 
 | d = SAMPMULVOL(s, vol); | d = SAMPMULVOL(s, vol); | 
| Line 812  static const RESPROC resproc[] = { | Line 829  static const RESPROC resproc[] = { | 
 | #endif | #endif | 
 | }; | }; | 
 |  |  | 
| void voice_setphase(VOICE v, BYTE phase) { | void VERMOUTHCL voice_setphase(VOICE v, UINT8 phase) { | 
 |  |  | 
 | int             proc; | int             proc; | 
 | int             mode; | int             mode; | 
| Line 843  static const MIXPROC mixproc[] = { | Line 860  static const MIXPROC mixproc[] = { | 
 | mixenv_normal,  mixenv_left,    mixenv_right,   mixenv_centre, | mixenv_normal,  mixenv_left,    mixenv_right,   mixenv_centre, | 
 | mixrel_normal,  mixrel_left,    mixrel_right,   mixrel_centre}; | mixrel_normal,  mixrel_left,    mixrel_right,   mixrel_centre}; | 
 |  |  | 
| void voice_setmix(VOICE v) { | void VERMOUTHCL voice_setmix(VOICE v) { | 
 |  |  | 
 | int             proc; | int             proc; | 
 |  |  |