/*
TiMidity++ -- MIDI to WAVE converter and player
- Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
+ Copyright (C) 1999-2004 Masanao Izumo <iz@onicos.co.jp>
Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
This program is free software; you can redistribute it and/or modify
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
effect.c - To apply sound effects.
- Mainly written by Masanao Izumo <mo@goice.co.jp>
+ Mainly written by Masanao Izumo <iz@onicos.co.jp>
- * Interfaces:
- * void init_effect(void);
- * do_effect(int32* buf, int32 count);
- */
+ Interfaces:
+ void init_effect(void);
+ do_effect(int32* buf, int32 count);
+*/
#ifdef HAVE_CONFIG_H
#include "config.h"
static void ns_shaping8(int32 *, int32);
static void ns_shaping16(int32 *, int32);
static void ns_shaping16_trad(int32 *, int32);
-static void ns_shaping16_9(int32 *, int32);
static void do_soft_clipping1(int32 *, int32);
static void do_soft_clipping2(int32 *, int32);
+static void ns_shaping16_9(int32 *, int32);
static inline unsigned long frand(void);
static inline int32 my_mod(int32, int32);
default:
return;
}
- if (!(play_mode->encoding & PE_MONO))
+ if (! (play_mode->encoding & PE_MONO))
c *= 2;
for (i = 0; i < c; i++) {
/* applied noise-shaping filter */
static void ns_shaping16(int32 *lp, int32 c)
{
- if (!(play_mode->encoding & PE_MONO)) {c *= 2;}
+ if (! (play_mode->encoding & PE_MONO))
+ c *= 2;
switch (noise_sharp_type) {
case 1:
ns_shaping16_trad(lp, c);
break;
case 2:
- case 3:
- case 4:
- ns_shaping16_9(lp, c);
- break;
- case 5:
do_soft_clipping1(lp, c);
ns_shaping16_9(lp, c);
break;
- case 6:
+ case 3:
do_soft_clipping2(lp, c);
ns_shaping16_9(lp, c);
break;
- default: break;
+ case 4:
+ ns_shaping16_9(lp, c);
+ break;
+ default:
+ break;
}
}
}
}
+#define WS_AMP_MAX ((int32) 0x0fffffff)
+#define WS_AMP_MIN ((int32)-0x0fffffff)
+
+static void do_soft_clipping1(int32 *buf, int32 count)
+{
+ int32 i, x;
+ int32 ai = TIM_FSCALE(1.5f, 24), bi = TIM_FSCALE(0.5f, 24);
+
+ for (i = 0; i < count; i++) {
+ x = buf[i];
+ x = (x > WS_AMP_MAX) ? WS_AMP_MAX
+ : ((x < WS_AMP_MIN) ? WS_AMP_MIN : x);
+ x = imuldiv24(x, ai) - imuldiv24(imuldiv28(imuldiv28(x, x), x), bi);
+ buf[i] = x;
+ }
+}
+
+static void do_soft_clipping2(int32 *buf, int32 count)
+{
+ int32 i, x;
+
+ for (i = 0; i < count; i++) {
+ x = buf[i];
+ x = (x > WS_AMP_MAX) ? WS_AMP_MAX
+ : ((x < WS_AMP_MIN) ? WS_AMP_MIN : x);
+ x = signlong(x) * ((abs(x) << 1) - imuldiv28(x, x));
+ buf[i] = x;
+ }
+}
+
static void ns_shaping16_9(int32 *lp, int32 c)
{
int32 i, l, sample, output;
}
}
-#define WS_AMP_MAX ((int32) 0x0fffffff)
-#define WS_AMP_MIN ((int32)-0x0fffffff)
-
-static void do_soft_clipping1(int32 *buf, int32 count)
-{
- int32 i, x;
- int32 ai = TIM_FSCALE(1.5f, 24), bi = TIM_FSCALE(0.5f, 24);
- for (i = 0; i < count; i++) {
- x = buf[i];
- x = (x > WS_AMP_MAX) ? WS_AMP_MAX
- : (x < WS_AMP_MIN) ? WS_AMP_MIN : x;
- x = imuldiv24(x, ai) - imuldiv24(imuldiv28(imuldiv28(x, x), x), bi);
- buf[i] = x;
- }
-}
-
-static void do_soft_clipping2(int32 *buf, int32 count)
-{
- int32 i, x;
- for (i = 0; i < count; i++) {
- x = buf[i];
- x = (x > WS_AMP_MAX) ? WS_AMP_MAX
- : (x < WS_AMP_MIN) ? WS_AMP_MIN : x;
- x = signlong(x) * ((abs(x) << 1) - imuldiv28(x, x));
- buf[i] = x;
- }
-}
-
static inline unsigned long frand(void)
{
return genrand_int32();
/*
TiMidity++ -- MIDI to WAVE converter and player
- Copyright (C) 1999-2003 Masanao Izumo <mo@goice.co.jp>
+ Copyright (C) 1999-2004 Masanao Izumo <iz@onicos.co.jp>
Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
This program is free software; you can redistribute it and/or modify
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
" -EFvlpf=d Disable voice LPF" NLS
" -EFvlpf=c Enable Chamberlin resonant LPF (12dB/oct) (default)" NLS
" -EFvlpf=m Enable Moog resonant lowpass VCF (24dB/oct)" NLS
-" -EFns=n Enable the n th degree noise shaping filter" NLS
+" -EFns=n Enable the n th degree (type) noise shaping filter" NLS
" n:[0..4] (for 8-bit linear encoding, default is 4)" NLS
-" n:[0..2] (for 16-bit linear encoding, default is 2)" NLS, fp);
+" n:[0..4] (for 16-bit linear encoding, default is 4)" NLS, fp);
#ifndef FIXED_RESAMPLATION
fputs(
" -EFresamp=d Disable resamplation" NLS