--- np2/sound/vermouth/midvoice.c 2003/10/16 17:58:13 1.1.1.1 +++ np2/sound/vermouth/midvoice.c 2006/12/16 12:11:07 1.4 @@ -25,7 +25,7 @@ // ---- vibrate -static int vibrate_update(VOICE v) { +static int VERMOUTHCL vibrate_update(VOICE v) { int depth; int phase; @@ -52,7 +52,8 @@ static int vibrate_update(VOICE v) { 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 dstbreak; @@ -109,7 +110,8 @@ static SAMPLE resample_vibrate(VOICE v, 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 dstbreak; @@ -161,7 +163,8 @@ static SAMPLE resample_vibloop(VOICE v, 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 dstbreak; @@ -269,7 +272,7 @@ rr_done: // ---- normal -static SAMPLE resample_normal(VOICE v, SAMPLE dst, SAMPLE dstterm) { +static SAMPLE VERMOUTHCL resample_normal(VOICE v, SAMPLE dst, SAMPLE dstterm) { SAMPLE src; int pos; @@ -298,7 +301,7 @@ static SAMPLE resample_normal(VOICE v, S 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; int pos; @@ -321,7 +324,7 @@ static SAMPLE resample_loop(VOICE v, SAM 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; int pos; @@ -376,7 +379,7 @@ rr_done: // ---- -int envlope_setphase(VOICE v, int phase) { +int VERMOUTHCL envlope_setphase(VOICE v, int phase) { do { if (phase >= 6) { @@ -402,7 +405,7 @@ int envlope_setphase(VOICE v, int phase) return(0); } -void envelope_updates(VOICE v) { +void VERMOUTHCL envelope_updates(VOICE v) { int envl; int envr; @@ -457,11 +460,12 @@ void envelope_updates(VOICE v) { } #if defined(ENABLE_TREMOLO) -static void tremolo_update(VOICE v) { +static void VERMOUTHCL tremolo_update(VOICE v) { int depth; int cnt; int vol; + int pos; depth = v->sample->tremolo_depth << 8; if (v->tremolo.sweepstep) { @@ -476,10 +480,11 @@ static void tremolo_update(VOICE v) { } v->tremolo.count += v->tremolo.step; 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))) { - vol = (1 << 12) - vol; + pos ^= ((1 << (SINENT_BIT - 2)) - 1); } + vol = envsin12q[pos]; if (cnt & (1 << (SINENT_BIT - 1))) { vol = 0 - vol; } @@ -514,7 +519,8 @@ static int envelope_update(VOICE v) { // ---- 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; SINT32 voll; @@ -548,7 +554,8 @@ static void mixrel_normal(VOICE v, SINT3 } 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 rel; @@ -570,12 +577,14 @@ static void mixrel_left(VOICE v, SINT32 } 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); } -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 rel; @@ -603,7 +612,8 @@ static void mixrel_centre(VOICE v, SINT3 // ---- 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 volr; @@ -619,7 +629,8 @@ static void mixnor_normal(VOICE v, SINT3 } 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; _SAMPLE s; @@ -632,7 +643,8 @@ static void mixnor_left(VOICE v, SINT32 } 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; _SAMPLE s; @@ -645,7 +657,8 @@ static void mixnor_right(VOICE v, SINT32 } 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; _SAMPLE s; @@ -664,7 +677,8 @@ static void mixnor_centre(VOICE v, SINT3 // ---- 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; SINT32 voll; @@ -710,7 +724,8 @@ static void mixenv_normal(VOICE v, SINT3 } 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; SINT32 vol; @@ -751,12 +766,14 @@ static void mixenv_left(VOICE v, SINT32 } 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); } -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; SINT32 vol; @@ -812,7 +829,7 @@ static const RESPROC resproc[] = { #endif }; -void voice_setphase(VOICE v, BYTE phase) { +void VERMOUTHCL voice_setphase(VOICE v, UINT8 phase) { int proc; int mode; @@ -843,7 +860,7 @@ static const MIXPROC mixproc[] = { mixenv_normal, mixenv_left, mixenv_right, mixenv_centre, mixrel_normal, mixrel_left, mixrel_right, mixrel_centre}; -void voice_setmix(VOICE v) { +void VERMOUTHCL voice_setmix(VOICE v) { int proc;