| version 1.3, 2005/02/07 14:46: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; | 
| Line 516  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 525  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 550  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 572  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 585  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 605  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 621  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 634  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 647  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 666  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 703  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 712  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 745  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 753  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 794  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 814  static const RESPROC resproc[] = { | Line 829  static const RESPROC resproc[] = { | 
 | #endif | #endif | 
 | }; | }; | 
 |  |  | 
| void voice_setphase(VOICE v, UINT8 phase) { | void VERMOUTHCL voice_setphase(VOICE v, UINT8 phase) { | 
 |  |  | 
 | int             proc; | int             proc; | 
 | int             mode; | int             mode; | 
| Line 845  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; | 
 |  |  |