[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#649274: Forming a new upstream for timidity (and reporting various issues with current deb pkg)



Package: timidity
Version: 2.13.2-39

Hi,

This is a bit unusual bug-report I'm afraid normally I would've
send this as an email to the Debian package maintainer of
timidity, but it seems that timidity is currently orphaned in
Debian :|

Quick self intro: I'm an open source developer / enthusiast for
10+ years. I've worked on / maintain various webcam and hardware
monitoring linux kernel drivers, libv4l (userspace video format
conversion library), v4l-utils, anaconda (the Red Hat installer),
parted and over 200 Fedora packages.

The reason I'm sending this mail is because one of the Fedora
packages I (co)maintain is timidity. Recently we got a number
of bugreports related to timidity, and one of the conclusions
was that timidity needs some love.

So I've created a new package for Fedora using the latest code
from the CVS repository hosted at sourceforge, and ported all
our patches on top of 2.13.2 to the latest code (where the
patches were still relevant, for things fixed already
in CVS I dropped the patches).

I also went through all the changes in the Debian package, and
were relevant have added those too. Note that I deliberately
did not include a few of the changes from Debian, as I believe
they are wrong! See below for details.

So now I've a nice and polished version of timidity, and given
that the latest official release has been 6 years ago I think
it would be good to do a new official release, hence I've
contacted the current admin and developers of the sf.net
timidity project, hopefully they will allow me to take over
the sf.net project, I would have loved to work together
with the Debian maintainer on forming a new upstream, but alas.

I've attached my current patches on top of sf.net CVS, note that
patches 0012 is missing, I've left this one out because it is
huge, and all it does is remove all the autoconf / automake
generated files (Makefile.in, configure. etc.).

###

So about the issues I've found while reviewing all the changes
the Debian pkgs make to the upstream tarbal:

--- timidity-2.13.2.orig/timidity/reverb.c
+++ timidity-2.13.2/timidity/reverb.c
@@ -1624,8 +1630,8 @@ static void do_ch_reverb_panning_delay(i
                buf[i] += r;
                buf[++i] += l;

-               if (++index0 == buf_size) {index0 = 0;}
-               if (++buf_index == buf_size) {buf_index = 0;}
+               if (index0++ == buf_size) {index0 = 0;}
+               if (buf_index++ == buf_size) {buf_index = 0;}
        }
        memset(reverb_effect_buffer, 0, sizeof(int32) * count);
        info->index[0] = index0;

This changes pre-increment to post increment, *at the end of a loop*,
causing index0 (and buf_index) to be ranged as:
0 <= index0 <= buf_index
which should of course be:
0 <= index0 < buf_index

So I believe this Debian patch to be wrong, and the original code to
be correct.


--- timidity-2.13.2.orig/timidity/playmidi.c
+++ timidity-2.13.2/timidity/playmidi.c
@@ -7980,7 +7980,7 @@ int play_event(MidiEvent *ev)
                channel[ch].temper_type = current_event->a;
                ctl_mode_event(CTLE_TEMPER_TYPE, 1, ch, channel[ch].temper_type
                if (temper_type_mute) {
-                       if (temper_type_mute & 1 << current_event->a
+                       if ((temper_type_mute & 1 << current_event->a)
                                        - ((current_event->a >= 0x40) ? 0x3c :
                                SET_CHANNELMASK(channel_mute, ch);
                                ctl_mode_event(CTLE_MUTE, 1, ch, 1);
@@ -8003,7 +8003,7 @@ int play_event(MidiEvent *ev)
                        ctl_mode_event(CTLE_TEMPER_TYPE, 1, i, channel[i].tempe
                }
                if (temper_type_mute) {
-                       if (temper_type_mute & 1 << current_event->a
+                       if ((temper_type_mute & 1 << current_event->a)
                                        - ((current_event->a >= 0x40) ? 0x3c :
                                FILL_CHANNELMASK(channel_mute);
                                for (i = 0; i < MAX_CHANNELS; i++)

I believe this patch is meant to fix a compiler warning, unfortunately
the patch does more then that, it actually changes the meaning of the code.
The original code calculates how much to shift the 1 by before masking
by seeing if a >= 0x40 and in that case shifting by (a - 0x3c), otherwise
it shifts by just a (actually (a - 0), but that is the same).

The precedence rules relevant here (for the original code) are, first do
the - op, then the << and then &. The added () change the order in which this
operations are done. Given that temper_type_mute is strictly a bitfield, doing
a - operation on it makes no sense, and I believe the old code is correct. Note
that my patchset has what I believe is a correct fix for the compiler warning
in patch 0010-Fix-silence-various-compiler-warnings.patch


--- timidity-2.13.2.orig/timidity/instrum.c
+++ timidity-2.13.2/timidity/instrum.c
@@ -1070,7 +1071,7 @@ Instrument *load_instrument(int dr, int
                }
                /* panning */
                if (ip != NULL && bank->tone[prog].pan != -1) {
-                       pan = ((int) bank->tone[prog].pan & 0x7f) - 64;
+                       pan = ((int) bank->tone[prog].pan & 0x7f); /* - 64 */;
                        for (i = 0; i < ip->samples; i++) {
                                panning = (int) ip->sample[i].panning + pan;
                                panning = (panning < 0) ? 0


This is (I believe) a fix for Debian bug 536252:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=536252

See the original bug for the rational of the fix. I believe this rationale
is wrong, as the code here is adding 2 pans together, so it is correct to
change one from 0-127 to -64 - 63 to get the desired effect.

Before looking at the Debian changes I spend an entire day tracking down
what I believe is the real cause for Debian bug 536252, after a similar
issue was reported in Fedora bug 710927:
https://bugzilla.redhat.com/show_bug.cgi?id=710927

What is going on (and a workaround-ish way to fix it) can be found in
0009-sndfont-Work-around-soundfonts-with-missing-links-be.patch


That rounds up the "wrong" (or so I believe) fixes in the Debian pkg.
As said I hope to do a new upstream release soon, amongst a lot of bugfixes
this will also include IPV6 support for the relevant bits of timidity.

Regards,

Hans
>From 50d412aaa58b0277303e6e215be6cc10bed6af54 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 10 Nov 2011 10:53:21 +0100
Subject: [PATCH 1/9] esd_a: Don't start ESD

Don't start ESD if it is not running yet, esp. not from detect() !

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 timidity/esd_a.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/timidity/esd_a.c b/timidity/esd_a.c
index 84f99fd..6338609 100644
--- a/timidity/esd_a.c
+++ b/timidity/esd_a.c
@@ -67,7 +67,7 @@ PlayMode dpm = {
     -1,
     {0}, /* default: get all the buffer fragments you can */
     "Enlightened sound daemon", 'e',
-    "/dev/dsp",
+    "esd",
     open_output,
     close_output,
     output_data,
@@ -93,7 +93,7 @@ static int try_open(void)
     /* Open the audio device */
     esdformat = (dpm.encoding & PE_16BIT) ? ESD_BITS16 : ESD_BITS8;
     esdformat |= (dpm.encoding & PE_MONO) ? ESD_MONO : ESD_STEREO;
-    return esd_play_stream_fallback(esdformat,dpm.rate,NULL,"timidity");
+    return esd_play_stream(esdformat,dpm.rate,NULL,"timidity");
 }
 
 
@@ -101,8 +101,7 @@ static int detect(void)
 {
     int fd;
 
-    /* FIXME: do we need to set this? */
-    /* setenv("ESD_NO_SPAWN", "1", 0); */
+    setenv("ESD_NO_SPAWN", "1", 0);
     fd = try_open();
     if (fd < 0)
 	return 0;
-- 
1.7.7.1

>From 3dc8c5a03e9cb0d61118a0c3109b33bcbca37576 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 10 Nov 2011 10:55:02 +0100
Subject: [PATCH 2/9] libao: Add a detect() function

Most Linux distros use pulseaudio by now, and libao is the best way to use
pulseaudio from timidity. This patch adds a detect function to libao, which
will make libao autodetect succeed only when pulse is available, so that
we can prefer libao in the probe order to get pulse, without also getting
libao on systems where we should be using alsa directly.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 timidity/ao_a.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/timidity/ao_a.c b/timidity/ao_a.c
index 8959b36..9a012f3 100644
--- a/timidity/ao_a.c
+++ b/timidity/ao_a.c
@@ -44,6 +44,7 @@ static int open_output(void); /* 0=success, 1=warning, -1=fatal error */
 static void close_output(void);
 static int output_data(char *buf, int32 nbytes);
 static int acntl(int request, void *arg);
+static int detect(void);
 
 /* export the playback mode */
 
@@ -58,7 +59,8 @@ PlayMode dpm = {
   open_output,
   close_output,
   output_data,
-  acntl
+  acntl,
+  detect
 };
 
 static ao_device *ao_device_ctx;
@@ -196,3 +198,30 @@ static int acntl(int request, void *arg)
   }
   return -1;
 }
+
+static int detect(void)
+{
+  int driver_id, result = 0;
+  ao_sample_format ao_sample_format_ctx;
+  ao_device *ao_device_ctx;
+
+  ao_initialize();
+
+  /* Only succeed in autodetect mode when pulseaudio is available! */
+  driver_id = ao_driver_id("pulse");
+
+  ao_sample_format_ctx.rate = 44100;
+  ao_sample_format_ctx.bits = 16;
+  ao_sample_format_ctx.channels = 2;
+  ao_sample_format_ctx.byte_format = AO_FMT_NATIVE;
+  ao_sample_format_ctx.matrix = NULL;
+
+  if ((ao_device_ctx = ao_open_live(driver_id, &ao_sample_format_ctx, NULL))) {
+    result = 1;
+    ao_close(ao_device_ctx);
+  }
+
+  ao_shutdown();
+
+  return result;
+}
-- 
1.7.7.1

>From 155989d6bce9dc2b01d1b9023e4b7394a5abe8a9 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 10 Nov 2011 10:58:31 +0100
Subject: [PATCH 3/9] Change audio output detection order

First try the various desktop daemons we support, and only when those
are not available use the systems native sound system. Also try ALSA before
the native sound system, since the native sound system on Linux is set to
OSS, and ALSA definitely is preferable over OSS.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 timidity/output.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/timidity/output.c b/timidity/output.c
index 69bb372..2b97bd9 100644
--- a/timidity/output.c
+++ b/timidity/output.c
@@ -138,17 +138,9 @@ extern PlayMode midi_play_mode;
 extern PlayMode modmidi_play_mode;
 
 PlayMode *play_mode_list[] = {
-#ifdef DEV_PLAY_MODE
-  DEV_PLAY_MODE,
-#endif
-
-#ifdef AU_ALSA
-  &alsa_play_mode,
-#endif /* AU_ALSA */
-
-#ifdef AU_HPUX_ALIB
-  &hpux_nplay_mode,
-#endif /* AU_HPUX_ALIB */
+#if defined(AU_AO) /* Try libao first as that will give us pulseaudio */
+  &ao_play_mode,
+#endif /* AU_AO */
 
 #if defined(AU_ARTS)
   &arts_play_mode,
@@ -158,6 +150,18 @@ PlayMode *play_mode_list[] = {
   &esd_play_mode,
 #endif /* AU_ESD */
 
+#ifdef AU_ALSA /* Try alsa (aka DEV_PLAY_MODE 2 on Linux) first */
+  &alsa_play_mode,
+#endif /* AU_ALSA */
+
+#ifdef DEV_PLAY_MODE /* OS dependent direct hardware access, OSS on Linux */
+  DEV_PLAY_MODE,
+#endif
+
+#ifdef AU_HPUX_ALIB
+  &hpux_nplay_mode,
+#endif /* AU_HPUX_ALIB */
+
 #if defined(AU_PORTAUDIO)
 #ifndef AU_PORTAUDIO_DLL
   &portaudio_play_mode,
@@ -180,10 +184,6 @@ PlayMode *play_mode_list[] = {
   &nas_play_mode,
 #endif /* AU_NAS */
 
-#if defined(AU_AO)
-  &ao_play_mode,
-#endif /* AU_PORTAUDIO */
-
 #ifndef __MACOS__
   &wave_play_mode,
   &raw_play_mode,
-- 
1.7.7.1

>From a19ae8c4802ef5190c8b2575d49cebdf6e5661f9 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 10 Nov 2011 11:07:50 +0100
Subject: [PATCH 4/9] Various man page fixes

courtesy of Debian
---
 doc/C/timidity.1               |   11 +++++------
 doc/C/timidity.cfg.5           |   14 ++++++--------
 doc/ja_JP.eucJP/timidity.cfg.5 |    2 --
 3 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/doc/C/timidity.1 b/doc/C/timidity.1
index 3288633..cf164b1 100644
--- a/doc/C/timidity.1
+++ b/doc/C/timidity.1
@@ -199,7 +199,7 @@ volume 90%, drum power 120%, compensation is on
 .RE
 .TP
 .B \-a, \-\-[no\-]anti\-alias
-Turns on antialiasing.  Samples are run through a lowpass filter
+Turns on anti-aliasing.  Samples are run through a lowpass filter
 before playing, which reduces aliasing noise at low resampling
 frequencies.
 .TP
@@ -269,7 +269,7 @@ understood as \fB41\fP, \fB43\fP and \fB7e\fP respectively.
 Sets the system manufacturer ID to \fIHH\fP (where \fIHH\fP are two
 hex\-digits).
 .br
-In this option, the manufacuture ID is set unchangable. Manufacuture
+In this option, the manufacture ID is set unchangeable. Manufacture
 ID from the input file would be ignored.
 .TP
 .BI b n ", \-\-default\-bank=" n
@@ -533,10 +533,10 @@ Launch \fBTiMidity++\fP as MIDI server.
 Launch \fBTiMidity++\fP as ALSA sequencer client.
 .TP
 .B \-iW
-Windodws synthesizer interface
+Windows synthesizer interface
 .TP
 .B \-iw
-Windodws GUI interface
+Windows GUI interface
 .TP
 .B \-iP
 PortMIDI synthesizer interface
@@ -1081,8 +1081,7 @@ Reserved for \fBTiMidity++\fP specification purposes
 \fBTiMidity++\fP Debug
 .RE
 .SH SEE ALSO
-lsmidiprog(1), mididump(1), patinfo(1), sf2text(1), wav2pat(1),
-timidity.cfg(5)
+sf2text(1), timidity.cfg(5)
 .SH COPYRIGHT
 Copyright (C) 1999\-2004 Masanao Izumo <iz@onicos.co.jp>
 .br
diff --git a/doc/C/timidity.cfg.5 b/doc/C/timidity.cfg.5
index 12c8151..b5fc59e 100644
--- a/doc/C/timidity.cfg.5
+++ b/doc/C/timidity.cfg.5
@@ -4,7 +4,7 @@ timidity.cfg \- configure file of TiMidity++
 .SH DESCRIPTION
 The file \fBtimidity.cfg\fP describes the runtime environments of
 timidity(1): that are the path of sound font, instruments
-configurations or else.
+configurations, etc.
 .br
 \fBTiMidity++\fP looks for the configuration file \fBtimidity.cfg\fP
 at startup, before processing any options.  If it can't be accessed,
@@ -30,7 +30,7 @@ $variable
 ${variable} # same as $variable
 .sp
 For the moment, the command which newly defines variables is not
-prepared.  The undifined variable is transposed to null string.
+prepared.  The undefined variable is transposed to null string.
 .br
 The variable defined as a regular variable is the next only one.
 .TP
@@ -89,13 +89,13 @@ that follow are set and displayed as the numbers from \fB1\fP to
 .BI "bank " "[MapID1] number"
 Selects the tone bank to modify.  Patch mappings that follow will
 affect this tone bank.  You can indicate specific map as a target, by
-specifing any ofthe following to \fIMapID1\fP: \fBgm2\fP, \fBsc55\fP,
+specifying any of the following to \fIMapID1\fP: \fBgm2\fP, \fBsc55\fP,
 \fBsc88\fP, \fBsc88pro\fP, \fBsc8850\fP, \fBxg\fP and \fBxgsfx64\fP.
 .TP
 .BI "drumset " "[MapID2] number"
 Selects the drum set to modify.  Patch mappings that follow will
 affect this drum set.  You can indicate specific map as a target, by
-specifing any ofthe following to \fIMapID2\fP: \fBgm2drum\fP,
+specifying any ofthe following to \fIMapID2\fP: \fBgm2drum\fP,
 \fBsc55drum\fP, \fBsc88drum\fP, \fBsc88prodrum\fP, \fBsc8850drum\fP,
 \fBxgdrum\fP and \fBxgsfx126\fP.
 .TP
@@ -363,7 +363,7 @@ These comments are displayed in the indicator line when
 .TP
 .BI "#extension timeout " "program second"
 Specifies the time\-out value of the \fIprogram\fP.  If any notes
-played with the tone number \fIprogram\fP are suspended more than
+played with the tone number \fIprogram\fP are suspended for more than
 \fIsecond\fP seconds, \fBTiMidity++\fP kills the notes.
 .TP
 .BI "#extension copydrumset " drumset
@@ -470,9 +470,7 @@ timidity 'cat fild.mid|'
 will read from the output of cat fild.mid.
 .SH FILES
 .TP
-.B /etc/timidity.cfg
-.TP
-.B /usr/local/share/timidity/timidity.cfg
+.B /etc/timidity/timidity.cfg
 .SH SEE ALSO
 timidity(1), lsmidiprog(1), mididump(1), patinfo(1), sf2text(1), wav2pat(1)
 .SH COPYRIGHT
diff --git a/doc/ja_JP.eucJP/timidity.cfg.5 b/doc/ja_JP.eucJP/timidity.cfg.5
index 6935896..010496b 100644
--- a/doc/ja_JP.eucJP/timidity.cfg.5
+++ b/doc/ja_JP.eucJP/timidity.cfg.5
@@ -466,8 +466,6 @@ timidity 'cat fild.mid|'
 .SH ¥Õ¥¡¥¤¥ë
 .TP
 .B /etc/timidity.cfg
-.TP
-.B /usr/local/share/timidity/timidity.cfg
 .SH ´ØÏ¢¹àÌÜ
 timidity(1), lsmidiprog(1), mididump(1), patinfo(1), sf2text(1), wav2pat(1)
 .SH Ãøºî¸¢
-- 
1.7.7.1

>From f393436b72b4f4d0b8dd8c9ea1039b5d84ba41f7 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 10 Nov 2011 11:26:59 +0100
Subject: [PATCH 5/9] Try /etc/timidity++.cfg first and then /etc/timidity.cfg

On most Linux systems timidity is not the only user of "timidity" patches nor
has it been for a long time. Various other softsynths, like the midi support
build into the SDL_mixer and allegro gaming library also need instrument patches
and they use /etc/timidity.cfg to get these patches.

Unlike timidity++, they only support GUS format .pat instrument patches, just
like the original timidity. timidity++ however also supports sf2 format
soundfonts, which are a lot better.

IOW the use of /etc/timidity.cfg has grown over time, changing its meaning
(under most Linux distributions) from "timidity's config file" to "config file
for apps / libs which need instrument patches for softsynth midi playback",
that together with the fact that some of those apps now support sf2 format
soundfonts where as most only support the old timidity.cfg syntax with GUS
patches, leads to problems, since for timidity itself sf2 sound fonts
are to be prefered over GUS patches, but using them in /etc/timidity.cfg
break the use of that file by other apps / libs to get instrument patches.

This patch fixes this by making timidity try /etc/timidity++.cfg first, the
intent hereby is to slightly change the meaning of the config files to:

/etc/timidity.cfg:
"config file for apps / libs which need instrument patches in GUS format for
softsynth midi playback"

/etc/timidity.cfg++:
"config file for apps / libs which need instrument patches for softsynth midi
playback and preferably in sf2 format"

Allowing apps which support and prefer sf2 format patches to co-exist with
ones which only want GUS format patches.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 timidity/mac_com.h  |    6 ++++--
 timidity/timidity.c |   10 +++++++---
 timidity/timidity.h |   19 ++++++++++++++-----
 3 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/timidity/mac_com.h b/timidity/mac_com.h
index cb6c4ae..cdaafee 100644
--- a/timidity/mac_com.h
+++ b/timidity/mac_com.h
@@ -39,8 +39,10 @@
 #undef  JAPANESE
 #define ANOTHER_MAIN
 #define DEFAULT_PATH	""
-#undef  CONFIG_FILE
-#define CONFIG_FILE DEFAULT_PATH "timidity.cfg"
+#undef  CONFIG_FILE1
+#define CONFIG_FILE1 DEFAULT_PATH "timidity++.cfg"
+#undef  CONFIG_FILE2
+#define CONFIG_FILE2 DEFAULT_PATH "timidity.cfg"
 #define MAC_SIGNATURE 'TIMI'
 #define MAC_STARTUP_FOLDER_NAME "\pStartup items"
 
diff --git a/timidity/timidity.c b/timidity/timidity.c
index 2431443..fa4a729 100644
--- a/timidity/timidity.c
+++ b/timidity/timidity.c
@@ -5358,7 +5358,9 @@ MAIN_INTERFACE int timidity_pre_load_configuration(void)
 
 #else
     /* UNIX */
-    if(!read_config_file(CONFIG_FILE, 0))
+    if(!read_config_file(CONFIG_FILE1, 0))
+		got_a_configuration = 1;
+    else if(!read_config_file(CONFIG_FILE2, 0))
 		got_a_configuration = 1;
 #endif
 
@@ -5430,7 +5432,9 @@ MAIN_INTERFACE int timidity_post_load_configuration(void)
 
     if(!got_a_configuration)
     {
-	if(try_config_again && !read_config_file(CONFIG_FILE, 0))
+	if(try_config_again && !read_config_file(CONFIG_FILE1, 0))
+	    got_a_configuration = 1;
+	else if(try_config_again && !read_config_file(CONFIG_FILE2, 0))
 	    got_a_configuration = 1;
     }
 
@@ -5893,7 +5897,7 @@ int main(int argc, char **argv)
 #else
 			ctl->cmsg(CMSG_FATAL, VERB_NORMAL,
 					"%s: Can't read any configuration file.\n"
-					"Please check " CONFIG_FILE, program_name);
+					"Please check " CONFIG_FILE1 " or " CONFIG_FILE2, program_name);
 #endif /* __W32__ */
 		} else
 			ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
diff --git a/timidity/timidity.h b/timidity/timidity.h
index 3978a31..6b1a0a9 100644
--- a/timidity/timidity.h
+++ b/timidity/timidity.h
@@ -41,14 +41,23 @@
 
 /* You could specify a complete path, e.g. "/etc/timidity.cfg", and
    then specify the library directory in the configuration file. */
-/* #define CONFIG_FILE "/etc/timidity.cfg" */
-#ifndef CONFIG_FILE
+/* #define CONFIG_FILE1 "/etc/timidity++.cfg" */
+#ifndef CONFIG_FILE1
 #  ifdef DEFAULT_PATH
-#    define CONFIG_FILE DEFAULT_PATH "/timidity.cfg"
+#    define CONFIG_FILE1 DEFAULT_PATH "/timidity++.cfg"
 #  else
-#    define CONFIG_FILE PKGDATADIR "/timidity.cfg"
+#    define CONFIG_FILE1 PKGDATADIR "/timidity++.cfg"
 #  endif /* DEFAULT_PATH */
-#endif /* CONFIG_FILE */
+#endif /* CONFIG_FILE1 */
+
+/* #define CONFIG_FILE2 "/etc/timidity.cfg" */
+#ifndef CONFIG_FILE2
+#  ifdef DEFAULT_PATH
+#    define CONFIG_FILE2 DEFAULT_PATH "/timidity.cfg"
+#  else
+#    define CONFIG_FILE2 PKGDATADIR "/timidity.cfg"
+#  endif /* DEFAULT_PATH */
+#endif /* CONFIG_FILE2 */
 
 
 /* Filename extension, followed by command to run decompressor so that
-- 
1.7.7.1

>From 0be5566addaa27bb3efdd45b988ba53f6ce21ed0 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 10 Nov 2011 11:48:05 +0100
Subject: [PATCH 6/9] Fork earlier when we're going to run deamonized in ALSA
 sequencer mode

If we're going to fork for daemon mode, we need to fork earlier, as
certain output libraries (pulseaudio) become unhappy if initialized
before forking and then being used from the child.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 interface/alsaseq_c.c |   17 -----------------
 timidity/timidity.c   |   23 +++++++++++++++++++++++
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/interface/alsaseq_c.c b/interface/alsaseq_c.c
index 11cda61..1785ab1 100644
--- a/interface/alsaseq_c.c
+++ b/interface/alsaseq_c.c
@@ -390,23 +390,6 @@ static int ctl_pass_playing_list(int n, char *args[])
 	j += note_key_offset, j -= floor(j / 12.0) * 12;
 	current_freq_table = j;
 
-	if (ctl.flags & CTLF_DAEMONIZE)
-	{
-		int pid = fork();
-		FILE *pidf;
-		switch (pid)
-		{
-			case 0:			// child is the daemon
-				break;
-			case -1:		// error status return
-				exit(7);
-			default:		// no error, doing well
-				if ((pidf = fopen( "/var/run/timidity.pid", "w" )) != NULL )
-					fprintf( pidf, "%d\n", pid );
-				exit(0);
-		}
-	}
-
 	for (;;) {
 		server_reset();
 		doit(&alsactx);
diff --git a/timidity/timidity.c b/timidity/timidity.c
index fa4a729..51a749f 100644
--- a/timidity/timidity.c
+++ b/timidity/timidity.c
@@ -5380,6 +5380,29 @@ MAIN_INTERFACE int timidity_post_load_configuration(void)
 {
     int i, cmderr = 0;
 
+    /* If we're going to fork for daemon mode, we need to fork now, as
+       certain output libraries (pulseaudio) become unhappy if initialized
+       before forking and then being used from the child. */
+    if (ctl->id_character == 'A' && (ctl->flags & CTLF_DAEMONIZE))
+    {
+	int pid = fork();
+	FILE *pidf;
+	switch (pid)
+	{
+	    case 0:		// child is the daemon
+		break;
+	    case -1:		// error status return
+		exit(7);
+	    default:		// no error, doing well
+		if ((pidf = fopen( "/var/run/timidity.pid", "w" )) != NULL )
+		{
+		    fprintf( pidf, "%d\n", pid );
+		    fclose( pidf );
+		}
+		exit(0);
+	}
+    }
+
     if(play_mode == &null_play_mode)
     {
 	char *output_id;
-- 
1.7.7.1

>From be0d048f2fc264b15d2d6fdadfd88e4e5713734a Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 10 Nov 2011 12:15:41 +0100
Subject: [PATCH 7/9] flac_a: Fix compiling with recent flac versions

The LEGACY_FLAC test was only succeeding on windows since the
FLAC/export.h was inside a windows #ifdef block.

While at it also fix various compiler warnings, including atleast
2 real bugs:
1) The missing include for common.h meant the safe_malloc prototype was
   missing, making the compiler assume it returns an int -> fail on
   64 bits
2) The | with FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA in the
   error handling test was missing () and it is the wrong thing to do
   in general since this is an enum not a flags field.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 timidity/flac_a.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/timidity/flac_a.c b/timidity/flac_a.c
index ad31251..cad02a2 100644
--- a/timidity/flac_a.c
+++ b/timidity/flac_a.c
@@ -33,6 +33,7 @@
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 #include <fcntl.h>
+#include "common.h"
 
 #ifdef __W32__
 #include <io.h>
@@ -41,13 +42,13 @@
 
 #if defined(AU_FLAC_DLL) || defined(AU_OGGFLAC_DLL)
 #include <windows.h>
-#include <FLAC/export.h> /* need export.h to figure out API version from FLAC_API_VERSION_CURRENT */
 #undef FLAC_API
 #undef OggFLAC_API
 #define FLAC_API
 #define OggFLAC_API
 #endif
 
+#include <FLAC/export.h> /* need export.h to figure out API version from FLAC_API_VERSION_CURRENT */
 /* by LEGACY_FLAC we mean before FLAC 1.1.3 */
 /* in FLAC 1.1.3, libOggFLAC is merged into libFLAC and all encoding layers are merged into the stream encoder */
 #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
@@ -171,7 +172,6 @@ FLAC_options flac_options = {
 	0,		/* seekable */
 };
 
-static long serial_number = 0;
 FLAC_ctx *flac_ctx = NULL;
 
 #if defined(LEGACY_FLAC) && defined(AU_OGGFLAC)
@@ -307,7 +307,7 @@ void flac_set_option_oggflac(int isogg)
 }
 #endif
 
-static int flac_session_close()
+static void flac_session_close()
 {
   FLAC_ctx *ctx = flac_ctx;
 
@@ -508,7 +508,7 @@ static int flac_output_open(const char *fname, const char *comment)
       FLAC__seekable_stream_encoder_set_metadata(ctx->encoder.flac.s_stream, metadata, num_metadata);
 
     /* set callback */
-/*    FLAC__seekable_stream_encoder_set_metadata_callback(ctx->encoder.flac.s_stream, flac_seekable_stream_encoder_metadata_callback); /* */
+/*  FLAC__seekable_stream_encoder_set_metadata_callback(ctx->encoder.flac.s_stream, flac_seekable_stream_encoder_metadata_callback); */
 #if (!defined(__BORLANDC__) && !defined(__POCC__))
     FLAC__stream_encoder_set_metadata_callback(ctx->encoder.flac.s_stream, flac_seekable_stream_encoder_metadata_callback); /* */
 #endif
@@ -896,8 +896,7 @@ static int output_data(char *buf, int32 nbytes)
 #else /* !LEGACY_FLAC */
   ctx->state.flac = FLAC__stream_encoder_get_state(ctx->encoder.flac.stream);
   if (ctx->state.flac != FLAC__STREAM_ENCODER_OK) {
-    if (ctx->state.flac == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR |
-	FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA) {
+    if (ctx->state.flac == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) {
       ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "FLAC stream verify error (%s)",
 		FLAC__StreamDecoderStateString[FLAC__stream_encoder_get_verify_decoder_state(ctx->encoder.flac.stream)]);
     }
-- 
1.7.7.1

>From bf04367d781a62e902ff8328441a1e219ca09a85 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 10 Nov 2011 12:32:10 +0100
Subject: [PATCH 8/9] Fix a bunch of: warning: implicit declaration of
 function ... warnings

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 timidity/controls.c |    5 +++++
 timidity/effect.c   |    2 ++
 timidity/oss_a.c    |    1 +
 timidity/playmidi.h |    1 +
 timidity/speex_a.c  |   10 ++++++++++
 timidity/wrd.h      |    2 ++
 6 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/timidity/controls.c b/timidity/controls.c
index 23dc35d..246f971 100644
--- a/timidity/controls.c
+++ b/timidity/controls.c
@@ -24,6 +24,11 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+
 #include "interface.h"
 #include "timidity.h"
 #include "controls.h"
diff --git a/timidity/effect.c b/timidity/effect.c
index 8b2ce77..ca32cb9 100644
--- a/timidity/effect.c
+++ b/timidity/effect.c
@@ -35,6 +35,8 @@
 #include <strings.h>
 #endif
 
+#include <stdlib.h>
+
 #include "mt19937ar.h"
 #define RAND_MAX 0xffffffff
 
diff --git a/timidity/oss_a.c b/timidity/oss_a.c
index 6809bf5..e72b74d 100644
--- a/timidity/oss_a.c
+++ b/timidity/oss_a.c
@@ -38,6 +38,7 @@
 #endif
 
 #if defined(HAVE_SYS_SOUNDCARD_H)
+#include <sys/ioctl.h>
 #include <sys/soundcard.h>
 #elif defined(linux)
 #include <sys/ioctl.h> /* new with 1.2.0? Didn't need this under 1.1.64 */
diff --git a/timidity/playmidi.h b/timidity/playmidi.h
index aa5261e..f5cb0f8 100644
--- a/timidity/playmidi.h
+++ b/timidity/playmidi.h
@@ -593,6 +593,7 @@ extern void playmidi_output_changed(int play_state);
 extern Instrument *play_midi_load_instrument(int dr, int bk, int prog);
 extern void midi_program_change(int ch, int prog);
 extern void free_voice(int v);
+extern void free_reverb_buffer(void);
 extern void play_midi_setup_drums(int ch,int note);
 
 /* For stream player */
diff --git a/timidity/speex_a.c b/timidity/speex_a.c
index 0dbe480..93627cf 100644
--- a/timidity/speex_a.c
+++ b/timidity/speex_a.c
@@ -33,6 +33,16 @@
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif  /* TIME_WITH_SYS_TIME */
 
 #include <speex/speex.h>
 #include <speex/speex_header.h>
diff --git a/timidity/wrd.h b/timidity/wrd.h
index 23b8161..294294e 100644
--- a/timidity/wrd.h
+++ b/timidity/wrd.h
@@ -140,6 +140,8 @@ extern void sry_encode_bindata( char *code, const char *org, int len);
 extern int sry_decode_bindata( char *data );
 extern int wrd_read_sherry;
 
+extern void free_wrd(void);
+
 static inline void print_ecmd(char*, int*, int);
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
-- 
1.7.7.1

>From b6c69d78e5ac4e7a5eeaeb59ac21e7fe613763e8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 10 Nov 2011 20:21:32 +0100
Subject: [PATCH 9/9] sndfont: Work around soundfonts with missing links
 between stereo samples

Some sf2 files have all their link ids between stereo samples set to 0,
this patch works around that, atleast for files which have 2 matching
the matched left + right samples directly after each other in the
instruments layers list.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 timidity/sndfont.c |   57 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/timidity/sndfont.c b/timidity/sndfont.c
index ad22e7f..e971c27 100644
--- a/timidity/sndfont.c
+++ b/timidity/sndfont.c
@@ -200,6 +200,7 @@ static void make_info(SFInfo *sf, SampleList *vp, LayerTable *tbl);
 static FLOAT_T calc_volume(LayerTable *tbl);
 static void set_sample_info(SFInfo *sf, SampleList *vp, LayerTable *tbl);
 static void set_init_info(SFInfo *sf, SampleList *vp, LayerTable *tbl);
+static void reset_last_sample_info(void);
 static int abscent_to_Hz(int abscents);
 static void set_rootkey(SFInfo *sf, SampleList *vp, LayerTable *tbl);
 static void set_rootfreq(SampleList *vp);
@@ -857,6 +858,8 @@ static int parse_layer(SFInfo *sf, int pridx, LayerTable *tbl, int level)
 	    (lay = inst->hdr.layer) == NULL)
 		return AWE_RET_SKIP;
 
+	reset_last_sample_info();
+
 	/* check global layer */
 	globalp = NULL;
 	if (is_global(lay)) {
@@ -881,6 +884,8 @@ static int parse_layer(SFInfo *sf, int pridx, LayerTable *tbl, int level)
 			rc = parse_layer(sf, pridx, &ctbl, level+1);
 			if (rc != AWE_RET_OK && rc != AWE_RET_SKIP)
 				return rc;
+
+			reset_last_sample_info();
 		} else {
 			init_and_merge_table(sf, &ctbl, tbl);
 			if (! sanity_range(&ctbl))
@@ -1328,6 +1333,11 @@ static void set_sample_info(SFInfo *sf, SampleList *vp, LayerTable *tbl)
 /*----------------------------------------------------------------*/
 
 /* set global information */
+static int last_sample_type;
+static int last_sample_instrument;
+static int last_sample_keyrange;
+static SampleList *last_sample_list;
+
 static void set_init_info(SFInfo *sf, SampleList *vp, LayerTable *tbl)
 {
     int val;
@@ -1366,12 +1376,41 @@ static void set_init_info(SFInfo *sf, SampleList *vp, LayerTable *tbl)
 
 	vp->v.sample_type = sample->sampletype;
 	vp->v.sf_sample_index = tbl->val[SF_sampleId];
-	if (sample->sampletype == SF_SAMPLETYPE_MONO) {
-		vp->v.sf_sample_link = -1;
-	} else {
-		vp->v.sf_sample_link = sample->samplelink;
+	vp->v.sf_sample_link = sample->samplelink;
+
+	/* Some sf2 files don't contain valid sample links, so see if the
+	   previous sample was a matching Left / Right sample with the
+	   link missing and add it */
+	switch (sample->sampletype) {
+	case SF_SAMPLETYPE_LEFT:
+		if (vp->v.sf_sample_link == 0 &&
+		    last_sample_type == SF_SAMPLETYPE_RIGHT &&
+		    last_sample_instrument == tbl->val[SF_instrument] &&
+		    last_sample_keyrange == tbl->val[SF_keyRange]) {
+		    	/* The previous sample was a matching right sample
+		    	   set the link */
+		    	vp->v.sf_sample_link = last_sample_list->v.sf_sample_index;
+		}
+		break;
+	case SF_SAMPLETYPE_RIGHT:
+		if (last_sample_list &&
+		    last_sample_list->v.sf_sample_link == 0 &&
+		    last_sample_type == SF_SAMPLETYPE_LEFT &&
+		    last_sample_instrument == tbl->val[SF_instrument] &&
+		    last_sample_keyrange == tbl->val[SF_keyRange]) {
+		    	/* The previous sample was a matching left sample
+		    	   set the link on the previous sample*/
+		    	last_sample_list->v.sf_sample_link = tbl->val[SF_sampleId];
+		}
+		break;
 	}
 
+	/* Remember this sample in case the next one is a match */
+	last_sample_type = sample->sampletype;;
+	last_sample_instrument = tbl->val[SF_instrument];
+	last_sample_keyrange = tbl->val[SF_keyRange];
+	last_sample_list = vp;
+
 	/* panning position: 0 to 127 */
 	val = (int)tbl->val[SF_panEffectsSend];
     if(sample->sampletype == SF_SAMPLETYPE_MONO || val != 0) {	/* monoSample = 1 */
@@ -1447,6 +1486,16 @@ static void set_init_info(SFInfo *sf, SampleList *vp, LayerTable *tbl)
 #endif
 }
 
+static void reset_last_sample_info(void)
+{
+    last_sample_list = NULL;
+    last_sample_type = 0;
+    /* Set last instrument and keyrange to a value which cannot be represented
+       by LayerTable.val (which is a short) */
+    last_sample_instrument = 0x80000000;
+    last_sample_keyrange   = 0x80000000;
+}
+
 static int abscent_to_Hz(int abscents)
 {
 	return (int)(8.176 * pow(2.0, (double)abscents / 1200.0));
-- 
1.7.7.1

>From 8c50f98cd8e9b07babb7892b6ccadb7ad3d8815d Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 17 Nov 2011 20:44:35 +0100
Subject: [PATCH 10/17] Fix / silence various compiler warnings

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 interface/gtk_i.c    |   39 +++---
 interface/server_c.c |   12 +-
 interface/tk_c.c     |    7 +-
 interface/wrdt_tty.c |    4 +-
 interface/x_sherry.c |    4 +-
 interface/xaw_c.c    |   29 +++--
 interface/xaw_i.c    |   32 +++---
 interface/xskin_c.c  |   14 ++-
 libarc/unlzh.c       |    1 +
 libunimod/load_far.c |    4 +-
 libunimod/load_it.c  |    6 +-
 libunimod/mloader.c  |    4 +-
 libunimod/mlutil.c   |    4 +-
 timidity/ao_a.c      |    3 +-
 timidity/calcnewt.c  |   10 +-
 timidity/common.c    |   13 ++-
 timidity/effect.c    |    1 -
 timidity/esd_a.c     |    2 +-
 timidity/freq.c      |   14 +--
 timidity/instrum.c   |    3 +-
 timidity/loadtab.c   |    2 +-
 timidity/m2m.c       |   44 ++++----
 timidity/miditrace.c |    3 +-
 timidity/output.c    |    5 +-
 timidity/playmidi.c  |   19 ++--
 timidity/readmidi.c  |    5 +-
 timidity/recache.c   |    2 +-
 timidity/resample.c  |    2 +-
 timidity/reverb.c    |  336 +++++++++++++++++++++++++++++---------------------
 timidity/smplfile.c  |   10 +-
 timidity/speex_a.c   |    7 +-
 timidity/timidity.c  |   42 ++++---
 utils/net.c          |    2 +-
 utils/nkflib.c       |   18 ++-
 34 files changed, 391 insertions(+), 312 deletions(-)

diff --git a/interface/gtk_i.c b/interface/gtk_i.c
index d72217a..9df56f5 100644
--- a/interface/gtk_i.c
+++ b/interface/gtk_i.c
@@ -107,8 +107,8 @@ static GtkTextMark *mark;
 static void
 generic_cb(GtkWidget *widget, gpointer data)
 {
-    gtk_pipe_int_write((int)data);
-    if((int)data == GTK_PAUSE) {
+    gtk_pipe_int_write(GPOINTER_TO_INT(data));
+    if(GPOINTER_TO_INT(data) == GTK_PAUSE) {
 	gtk_label_set(GTK_LABEL(cnt_lbl), "Pause");
     }
 }
@@ -134,20 +134,20 @@ open_file_cb(GtkWidget *widget, gpointer data)
 #ifdef HAVE_GTK_2
 	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button),
 			   "clicked",
-			   G_CALLBACK (filer_cb), (gpointer)1);
+			   G_CALLBACK (filer_cb), GINT_TO_POINTER(1));
 #else
 	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button),
 			   "clicked",
-			   GTK_SIGNAL_FUNC (filer_cb), (gpointer)1);
+			   GTK_SIGNAL_FUNC (filer_cb), GINT_TO_POINTER(1));
 #endif
 #ifdef HAVE_GTK_2
 	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
 			   "clicked",
-			   G_CALLBACK (filer_cb), (gpointer)0);
+			   G_CALLBACK (filer_cb), GINT_TO_POINTER(0));
 #else
 	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
 			   "clicked",
-			   GTK_SIGNAL_FUNC (filer_cb), (gpointer)0);
+			   GTK_SIGNAL_FUNC (filer_cb), GINT_TO_POINTER(0));
 #endif
     }
 
@@ -167,7 +167,7 @@ filer_cb(GtkWidget *widget, gpointer data)
 #endif
     glob_t pglob;
 
-    if((int)data == 1) {
+    if(GPOINTER_TO_INT(data) == 1) {
 	patt = gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel));
 	if(glob(patt, GLOB_BRACE|GLOB_NOMAGIC|GLOB_TILDE, NULL, &pglob))
 	    return;
@@ -195,11 +195,11 @@ generic_scale_cb(GtkAdjustment *adj, gpointer data)
     if(local_adjust)
 	return;
 
-    gtk_pipe_int_write((int)data);
+    gtk_pipe_int_write(GPOINTER_TO_INT(data));
 
     /* This is a bit of a hack as the volume scale (a GtkVScale) seems
        to have it's minimum at the top which is counter-intuitive. */
-    if((int)data == GTK_CHANGE_VOLUME) {
+    if(GPOINTER_TO_INT(data) == GTK_CHANGE_VOLUME) {
 	gtk_pipe_int_write(MAX_AMPLIFICATION - adj->value);
     }
     else {
@@ -259,7 +259,7 @@ playlist_cb(GtkWidget *widget, guint data)
     gtk_window_set_title(GTK_WINDOW(plfilesel), ((char)data == 'l')?
 			 "Load Playlist":
 			 "Save Playlist");
-    gtk_object_set_user_data(GTK_OBJECT(plfilesel), (gpointer)data);
+    gtk_object_set_user_data(GTK_OBJECT(plfilesel), GINT_TO_POINTER(data));
     gtk_file_selection_complete(GTK_FILE_SELECTION(plfilesel), "*.tpl");
 
     gtk_widget_show(plfilesel);
@@ -269,7 +269,8 @@ static void
 playlist_op(GtkWidget *widget, guint data)
 {
     int		i;
-    gchar	*filename[2], action, *rowdata, fname[BUFSIZ], *tmp;
+    const gchar	*filename[2];
+    gchar	action, *rowdata, fname[BUFSIZ], *tmp;
     FILE	*plfp;
 
     gtk_widget_hide(plfilesel);
@@ -277,7 +278,7 @@ playlist_op(GtkWidget *widget, guint data)
     if(!data)
 	return;
 
-    action = (gchar)(int)gtk_object_get_user_data(GTK_OBJECT(plfilesel));
+    action = GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(plfilesel)));
     filename[0] = gtk_file_selection_get_filename(GTK_FILE_SELECTION(plfilesel));
 
     if(action == 'l') {
@@ -286,6 +287,7 @@ playlist_op(GtkWidget *widget, guint data)
 	    return;
 	}
 	while(fgets(fname, BUFSIZ, plfp) != NULL) {
+            gchar *filename[2];
 	    if(fname[strlen(fname) - 1] == '\n')
 		fname[strlen(fname) - 1] = '\0';
 	    filename[0] = fname;
@@ -600,7 +602,7 @@ create_button_with_pixmap(GtkWidget *window, gchar **bits, gint data, gchar *the
     gtk_container_add(GTK_CONTAINER(button), pw);
     gtk_signal_connect(GTK_OBJECT(button), "clicked",
 			      GTK_SIGNAL_FUNC(generic_cb),
-			      (gpointer)data);
+			      GINT_TO_POINTER(data));
     gtk_widget_show(button);
     gtk_tooltips_set_tip(ttip, button, thelp, NULL);
 
@@ -672,15 +674,16 @@ create_menubar(void)
 static GtkTooltips *
 create_yellow_tooltips()
 {
-    GdkColor	*t_back;
     GtkTooltips	*tip;
 
-    t_back = (GdkColor*)g_malloc( sizeof(GdkColor));
-
     /* First create a default Tooltip */
     tip = gtk_tooltips_new();
 
 #ifndef HAVE_GTK_2
+    GdkColor	*t_back;
+
+    t_back = (GdkColor*)g_malloc( sizeof(GdkColor));
+
     /* Try to get the colors */
     if ( gdk_color_parse("linen", t_back)){
 	if(gdk_colormap_alloc_color(gdk_colormap_get_system(),
@@ -781,7 +784,7 @@ handle_input(gpointer client_data, gint source, GdkInputCondition ic)
     case FILE_LIST_MESSAGE:
 	{
 	    gchar filename[255], *fnames[2];
-	    gint i, number_of_files, row;
+	    gint i, number_of_files;
 
 	    /* reset the playing list : play from the start */
 	    file_number_to_play = -1;
@@ -792,7 +795,7 @@ handle_input(gpointer client_data, gint source, GdkInputCondition ic)
 		gtk_pipe_string_read(filename);
 		fnames[0] = filename;
 		fnames[1] = NULL;
-		row = gtk_clist_append(GTK_CLIST(clist), fnames);
+		gtk_clist_append(GTK_CLIST(clist), fnames);
 	    }
 	    gtk_clist_columns_autosize(GTK_CLIST(clist));
 	}
diff --git a/interface/server_c.c b/interface/server_c.c
index 676aa23..196ea7d 100644
--- a/interface/server_c.c
+++ b/interface/server_c.c
@@ -416,7 +416,7 @@ static void server_reset(void);
 
 static int ctl_pass_playing_list(int n, char *args[])
 {
-    int sock;
+    int sock = 0;
 
     if(n != 2 && n != 1)
     {
@@ -609,6 +609,7 @@ static void add_tick(int tick)
     seq_play_event(&ev);
 }
 
+#if 0
 static int tick2sample(int tick)
 {
     int32 samples, cum;
@@ -619,6 +620,7 @@ static int tick2sample(int tick)
 	samples += ((sample_cum >> 16) & 0xFFFF);
     return samples;
 }
+#endif
 
 int time2tick(double sec)
 {
@@ -650,7 +652,6 @@ static void do_timing(uint8 *);
 static void do_sysex(uint8 *, int len);
 static void do_extended(uint8 *);
 static void do_timeout(void);
-static void server_seq_sync(double tm);
 
 static uint8 data_buffer[BUFSIZ];
 static int data_buffer_len;
@@ -824,6 +825,7 @@ static int data_flush(int discard)
     return 0;
 }
 
+#if 0
 static void server_seq_sync(double tm)
 {
     double t;
@@ -832,6 +834,7 @@ static void server_seq_sync(double tm)
     if(t > tm)
 	usleep((unsigned long)((t - tm) * 1000000));
 }
+#endif
 
 static void server_reset(void)
 {
@@ -856,7 +859,7 @@ static int do_control_command(void)
 {
     int status;
     char *params[MAX_GETCMD_PARAMS];
-    int nparams;
+    int nparams = 0;
     int i;
 
     if((status = control_getcmd(params, &nparams)) == -1)
@@ -1130,7 +1133,7 @@ static int do_control_command_nonblock(void)
 
 static int fdgets(char *buff, size_t buff_size, struct fd_read_buffer *p)
 {
-    int n, len, count, size, fd;
+    int n, count, size, fd;
     char *buff_endp = buff + buff_size - 1, *pbuff, *beg;
 
     fd = p->fd;
@@ -1142,7 +1145,6 @@ static int fdgets(char *buff, size_t buff_size, struct fd_read_buffer *p)
 	return 0;
     }
 
-    len = 0;
     count = p->count;
     size = p->size;
     pbuff = p->buff;
diff --git a/interface/tk_c.c b/interface/tk_c.c
index 7acab67..c5c9074 100644
--- a/interface/tk_c.c
+++ b/interface/tk_c.c
@@ -757,8 +757,8 @@ static void k_pipe_puts(char *str)
 	int len;
 	char lf = '\n';
 	len = line_strlen(str);
-	write(fpip_out, str, len);
-	write(fpip_out, &lf, 1);
+	ssize_t dummy = write(fpip_out, str, len);
+	dummy = write(fpip_out, &lf, 1);
 }
 
 
@@ -771,7 +771,8 @@ int k_pipe_gets(char *str, int maxlen)
 	/* at least 5 letters (4+\n) command */
 	len = 0;
 	for (p = str; len < maxlen - 1; p++) {
-		read(fpip_in, p, 1);
+		ssize_t dummy = read(fpip_in, p, 1);
+		dummy += 1;
 		if (*p == '\n')
 			break;
 		len++;
diff --git a/interface/wrdt_tty.c b/interface/wrdt_tty.c
index 93b7905..d30e324 100644
--- a/interface/wrdt_tty.c
+++ b/interface/wrdt_tty.c
@@ -292,7 +292,7 @@ static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[])
 	  fillbuf[0]=0x1b;
 	  fillbuf[1]='7';
 	  fillbuf[2]=0;
-	  printf(fillbuf);
+	  printf("%s", fillbuf);
 
 	  /* 0-7: normal, 8-16: reverse */
 	  if(wrd_args[4] <= 7)
@@ -308,7 +308,7 @@ static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[])
 	  fillbuf[0]=0x1b;
 	  fillbuf[1]='8';
 	  fillbuf[2]=0;
-	  printf(fillbuf);
+	  printf("%s", fillbuf);
 	  printf("\033[%dm",txtclr_preserve);
 	  fflush(stdout);
 	}
diff --git a/interface/x_sherry.c b/interface/x_sherry.c
index b54a731..59f658a 100644
--- a/interface/x_sherry.c
+++ b/interface/x_sherry.c
@@ -827,7 +827,7 @@ static void sry_load_png(uint8 *data)
 
     screen = SRY_GET_SHORT(data) & 0xffff;
     vpalette = SRY_GET_SHORT(data + 2) & 0xffff;
-    filename = data + 4;
+    filename = (char *)data + 4;
 
 #ifdef SRY_DEBUG
     printf("Load png: %s: scr=%d pal=%d\n", filename, screen, vpalette);
@@ -845,7 +845,7 @@ static void sry_load_png(uint8 *data)
 	err_to_stop = 1;
 	return;
     }
-    if(png_sig_cmp(sig, 0, sizeof(sig)))
+    if(png_sig_cmp((unsigned char*)sig, 0, sizeof(sig)))
     {
 	ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Not a png file", filename);
 	err_to_stop = 1;
diff --git a/interface/xaw_c.c b/interface/xaw_c.c
index 5ab58d5..97bee41 100644
--- a/interface/xaw_c.c
+++ b/interface/xaw_c.c
@@ -767,21 +767,26 @@ a_pipe_write(const char *fmt, ...) {
   /* char local_buf[PIPE_LENGTH]; */
   int len;
   va_list ap;
+  ssize_t dummy;
 
   va_start(ap, fmt);
   len = vsnprintf(local_buf, sizeof(local_buf), fmt, ap);
   if ((len < 0) || (len > PIPE_LENGTH))
-    write(pipe_out_fd, local_buf, PIPE_LENGTH);
-  else write(pipe_out_fd, local_buf, len);
-  write(pipe_out_fd, "\n", 1);
+    dummy = write(pipe_out_fd, local_buf, PIPE_LENGTH);
+  else
+    dummy = write(pipe_out_fd, local_buf, len);
+  dummy += write(pipe_out_fd, "\n", 1);
   va_end(ap);
 }
 
 static void
 a_pipe_write_buf(char *buf, int len) {
-  if ((len < 0) || (len > PIPE_LENGTH)) write(pipe_out_fd, buf, PIPE_LENGTH);
-  else write(pipe_out_fd, buf, len);
-  write(pipe_out_fd, "\n", 1);
+  ssize_t dummy;
+  if ((len < 0) || (len > PIPE_LENGTH))
+    dummy = write(pipe_out_fd, buf, PIPE_LENGTH);
+  else
+    dummy = write(pipe_out_fd, buf, len);
+  dummy += write(pipe_out_fd, "\n", 1);
 }
 
 static int
@@ -834,6 +839,7 @@ a_pipe_sync(void) {
 static void
 a_pipe_write_msg(char *msg) {
     size_t msglen;
+    ssize_t dummy;
     char buf[2 + sizeof(size_t)], *p, *q;
 
     /* convert '\r' to '\n', but strip '\r' from '\r\n' */
@@ -849,14 +855,15 @@ a_pipe_write_msg(char *msg) {
     buf[1] = '\n';
 
     memcpy(buf + 2, &msglen, sizeof(size_t));
-    write(pipe_out_fd, buf, sizeof(buf));
-    write(pipe_out_fd, msg, msglen - 1);
-    write(pipe_out_fd, "\n", 1);
+    dummy  = write(pipe_out_fd, buf, sizeof(buf));
+    dummy += write(pipe_out_fd, msg, msglen - 1);
+    dummy += write(pipe_out_fd, "\n", 1);
 }
 
 static void
 a_pipe_write_msg_nobr(char *msg) {
     size_t msglen;
+    ssize_t dummy;
     char buf[2 + sizeof(size_t)], *p, *q;
 
     /* convert '\r' to '\n', but strip '\r' from '\r\n' */
@@ -872,8 +879,8 @@ a_pipe_write_msg_nobr(char *msg) {
     buf[1] = '\n';
 
     memcpy(buf + 2, &msglen, sizeof(size_t));
-    write(pipe_out_fd, buf, sizeof(buf));
-    write(pipe_out_fd, msg, msglen);
+    dummy  = write(pipe_out_fd, buf, sizeof(buf));
+    dummy += write(pipe_out_fd, msg, msglen);
 }
 
 static void
diff --git a/interface/xaw_i.c b/interface/xaw_i.c
index 00fa5ef..10fba5e 100644
--- a/interface/xaw_i.c
+++ b/interface/xaw_i.c
@@ -688,7 +688,7 @@ aboutACT(Widget w, XEvent *e, String *v, Cardinal *n) {
   char s[12], *p;
   char lbuf[30];
   int i;
-  Widget popup_about, popup_abox, popup_aok, about_lbl[5];
+  Widget popup_about, popup_abox, popup_aok;
 
   char *info[] = {"TiMidity++ %s%s - Xaw interface",
                   "- MIDI to WAVE converter and player -",
@@ -711,7 +711,7 @@ aboutACT(Widget w, XEvent *e, String *v, Cardinal *n) {
     snprintf(lbuf, sizeof(lbuf), p,
     		(strcmp(timidity_version, "current")) ? "version " : "",
     		timidity_version);
-    about_lbl[i] = XtVaCreateManagedWidget(s,labelWidgetClass,popup_abox,
+    XtVaCreateManagedWidget(s,labelWidgetClass,popup_abox,
                                 XtNlabel,lbuf, XtNwidth,320, XtNresize,False,
                                 XtNfontSet,app_resources.label_font,
                                 XtNforeground,textcolor, XtNborderWidth,0,
@@ -767,7 +767,7 @@ popdownopt:
 
 static Widget
 warnCB(Widget w, char *mesname, Boolean destroy) {
-  Widget popup_warning, popup_wbox, popup_message, popup_wok;
+  Widget popup_warning, popup_wbox, popup_wok;
 
   if (mesname == NULL) return None;
   popup_warning = XtVaCreatePopupShell("popup_warning",
@@ -775,7 +775,7 @@ warnCB(Widget w, char *mesname, Boolean destroy) {
   popup_wbox = XtVaCreateManagedWidget("popup_wbox", boxWidgetClass,
 				  popup_warning, XtNbackground,bgcolor,
                                   XtNorientation,XtorientVertical, NULL);
-  popup_message = XtVaCreateManagedWidget(mesname, labelWidgetClass,
+  XtVaCreateManagedWidget(mesname, labelWidgetClass,
                                           popup_wbox,
                                           XtNfontSet,app_resources.label_font,
                                           XtNforeground,textcolor,
@@ -2976,10 +2976,10 @@ addOneFile(int max_files, long curr_num, char *fname) {
 
 static void
 createOptions(void) {
-  Widget modul_b, modul_bb, modul_l, porta_b, porta_bb, porta_l, nrpnv_b,
-         nrpnv_bb, nrpnv_l, reverb_b, reverb_bb, reverb_l, chorus_bb, chorus_l,
-         chpressure_b, chpressure_bb, chpressure_l, overlapv_b, overlapv_bb,
-         overlapv_l, txtmeta_b, txtmeta_bb, txtmeta_l,
+  Widget modul_b, modul_bb, porta_b, porta_bb, nrpnv_b,
+         nrpnv_bb, reverb_b, reverb_bb, chorus_bb,
+         chpressure_b, chpressure_bb, overlapv_b, overlapv_bb,
+         txtmeta_b, txtmeta_bb,
          popup_optform, lowBox, popup_olabel, popup_ook, popup_ocancel;
   Dimension x, y;
 
@@ -2997,7 +2997,7 @@ createOptions(void) {
   modul_b = XtVaCreateManagedWidget("modul_button",toggleWidgetClass,modul_bb,
                        XtNbitmap,off_mark, XtNforeground,togglecolor,
                        XtNbackground,buttonbgcolor, NULL);
-  modul_l = XtVaCreateManagedWidget("modul_lbl",labelWidgetClass,modul_bb,
+  XtVaCreateManagedWidget("modul_lbl",labelWidgetClass,modul_bb,
                        XtNforeground,textcolor, XtNbackground,bgcolor, NULL);
   porta_bb = XtVaCreateManagedWidget("porta_box",boxWidgetClass,popup_optform,
                        XtNfromVert,modul_bb, 
@@ -3006,7 +3006,7 @@ createOptions(void) {
   porta_b = XtVaCreateManagedWidget("porta_button",toggleWidgetClass,porta_bb,
                        XtNforeground,togglecolor, XtNbackground,buttonbgcolor,
                        XtNbitmap,off_mark, XtNfromVert,modul_b, NULL);
-  porta_l = XtVaCreateManagedWidget("porta_lbl",labelWidgetClass,porta_bb,
+  XtVaCreateManagedWidget("porta_lbl",labelWidgetClass,porta_bb,
                        XtNforeground,textcolor, XtNbackground,bgcolor, NULL);
   nrpnv_bb = XtVaCreateManagedWidget("nrpnv_box",boxWidgetClass,popup_optform,
                        XtNfromVert,porta_bb, 
@@ -3015,7 +3015,7 @@ createOptions(void) {
   nrpnv_b = XtVaCreateManagedWidget("nrpnv_button",toggleWidgetClass,nrpnv_bb,
                        XtNforeground,togglecolor, XtNbackground,buttonbgcolor,
                        XtNbitmap,off_mark, XtNfromVert,porta_b, NULL);
-  nrpnv_l = XtVaCreateManagedWidget("nrpnv_lbl",labelWidgetClass,nrpnv_bb,
+  XtVaCreateManagedWidget("nrpnv_lbl",labelWidgetClass,nrpnv_bb,
                        XtNforeground,textcolor, XtNbackground,bgcolor, NULL);
   reverb_bb = XtVaCreateManagedWidget("reverb_box",boxWidgetClass,
                        popup_optform, XtNfromVert,nrpnv_bb,
@@ -3025,7 +3025,7 @@ createOptions(void) {
                        reverb_bb, XtNbitmap,off_mark, XtNfromVert,nrpnv_b,
                        XtNforeground,togglecolor, XtNbackground,buttonbgcolor,
                        NULL);
-  reverb_l = XtVaCreateManagedWidget("reverb_lbl",labelWidgetClass,reverb_bb,
+  XtVaCreateManagedWidget("reverb_lbl",labelWidgetClass,reverb_bb,
                        XtNforeground,textcolor, XtNbackground,bgcolor, NULL);
   chorus_bb = XtVaCreateManagedWidget("chorus_box",boxWidgetClass,
                        popup_optform, XtNorientation,XtorientHorizontal,
@@ -3035,7 +3035,7 @@ createOptions(void) {
                        chorus_bb, XtNbitmap,off_mark, XtNfromVert,reverb_b,
                        XtNforeground,togglecolor, XtNbackground,buttonbgcolor,
                        NULL);
-  chorus_l = XtVaCreateManagedWidget("chorus_lbl",labelWidgetClass,chorus_bb,
+  XtVaCreateManagedWidget("chorus_lbl",labelWidgetClass,chorus_bb,
                        XtNforeground,textcolor, XtNbackground,bgcolor, NULL);
   chpressure_bb = XtVaCreateManagedWidget("chpressure_box",boxWidgetClass,
                        popup_optform, XtNorientation,XtorientHorizontal,
@@ -3045,7 +3045,7 @@ createOptions(void) {
                        toggleWidgetClass,chpressure_bb, XtNbitmap,off_mark,
                        XtNfromVert,chorus_b, XtNforeground,togglecolor,
                        XtNbackground,buttonbgcolor, NULL);
-  chpressure_l = XtVaCreateManagedWidget("chpressure_lbl",labelWidgetClass,
+  XtVaCreateManagedWidget("chpressure_lbl",labelWidgetClass,
                        chpressure_bb, XtNforeground,textcolor,
                        XtNbackground,bgcolor, NULL);
   overlapv_bb = XtVaCreateManagedWidget("overlapvoice_box",boxWidgetClass,
@@ -3056,7 +3056,7 @@ createOptions(void) {
                        toggleWidgetClass,overlapv_bb, XtNbitmap,off_mark, 
                        XtNfromVert,chpressure_b, XtNforeground,togglecolor,
                        XtNbackground,buttonbgcolor, NULL);
-  overlapv_l = XtVaCreateManagedWidget("overlapv_lbl",labelWidgetClass,
+  XtVaCreateManagedWidget("overlapv_lbl",labelWidgetClass,
                        overlapv_bb, XtNforeground,textcolor,
                        XtNbackground,bgcolor, NULL);
   txtmeta_bb = XtVaCreateManagedWidget("txtmeta_box",boxWidgetClass,
@@ -3067,7 +3067,7 @@ createOptions(void) {
                        txtmeta_bb, XtNbitmap,off_mark, XtNfromVert,overlapv_b,
                        XtNforeground,togglecolor, XtNbackground,buttonbgcolor,
                        NULL);
-  txtmeta_l = XtVaCreateManagedWidget("txtmeta_lbl",labelWidgetClass,
+  XtVaCreateManagedWidget("txtmeta_lbl",labelWidgetClass,
                        txtmeta_bb, XtNforeground,textcolor,
                        XtNbackground,bgcolor, NULL);
 
diff --git a/interface/xskin_c.c b/interface/xskin_c.c
index b97cdf1..e3394e1 100644
--- a/interface/xskin_c.c
+++ b/interface/xskin_c.c
@@ -57,7 +57,6 @@ static int ctl_read(int32 *valp);
 static int cmsg(int type, int verbosity_level, char *fmt, ...);
 static int ctl_pass_playing_list(int number_of_files, char *list_of_files[]);
 static void ctl_event(CtlEvent *e);
-static void ctl_speana_data(double *val, int size);
 static void initialize_exp_hz_table( void );
 
 static void xskin_pipe_open(void);
@@ -229,6 +228,7 @@ static void ctl_lyric(int lyricid)
     }
 }
 
+#if 0
 static void ctl_speana_data(double *val, int size) {
 
   /* 0 <= val[n] <= (AMP*NCOLOR) */
@@ -280,6 +280,7 @@ static void ctl_speana_data(double *val, int size) {
 
   return;
 }
+#endif
 
 /*ARGSUSED*/
 static int ctl_open(int using_stdin, int using_stdout) {
@@ -354,7 +355,8 @@ static int ctl_pass_playing_list(int number_of_files, char *list_of_files[]) {
 
   /* Wait prepare 'interface' */
   xskin_pipe_read(local_buf,sizeof(local_buf));
-  if (strcmp("READY",local_buf)) return;
+  if (strcmp("READY",local_buf))
+    return 0;
   xskin_ready = 1;
 
   /* receive shared memory buffer */
@@ -490,8 +492,8 @@ static void xskin_pipe_open(void) {
 }
 
 void xskin_pipe_write(char *buf) {
-  write(pipe_out_fd,buf,strlen(buf));
-  write(pipe_out_fd,"\n",1);
+  ssize_t dummy = write(pipe_out_fd,buf,strlen(buf));
+  dummy += write(pipe_out_fd,"\n",1);
 }
 
 static int xskin_pipe_ready(void) {
@@ -515,7 +517,7 @@ int xskin_pipe_read(char *buf,int bufsize) {
 
   bufsize--;
   for (i=0;i<bufsize;i++) {
-    read(pipe_in_fd,buf+i,1);
+    ssize_t dummy = read(pipe_in_fd,buf+i,1); ++dummy;
     if (buf[i]=='\n') break;
   }
   buf[i]=0;
@@ -524,7 +526,7 @@ int xskin_pipe_read(char *buf,int bufsize) {
 
 int xskin_pipe_read_direct(int32 *buf, int bufsize) {
 
-  read( pipe_in_fd, buf, bufsize );
+  ssize_t dummy = read( pipe_in_fd, buf, bufsize ); ++dummy;
 
   return 0;
 }
diff --git a/libarc/unlzh.c b/libarc/unlzh.c
index 152e886..1634271 100644
--- a/libarc/unlzh.c
+++ b/libarc/unlzh.c
@@ -68,6 +68,7 @@
 #define MAGIC5 19
 #define INBUFSIZ BUFSIZ
 
+#undef MIN
 #define MIN(a,b)  ((a) < (b) ? (a) : (b))
 
 struct _UNLZHHandler
diff --git a/libunimod/load_far.c b/libunimod/load_far.c
index 0503186..9026433 100644
--- a/libunimod/load_far.c
+++ b/libunimod/load_far.c
@@ -250,13 +250,13 @@ FAR_Load (BOOL curious)
 
   for (t = 0; t < of.numpat; t++)
     {
-      UBYTE rows = 0, tempo;
+      UBYTE rows = 0;
 
       memset (pat, 0, 256 * 16 * 4 * sizeof (FARNOTE));
       if (mh2->patsiz[t])
 	{
 	  rows = _mm_read_UBYTE (modreader);
-	  tempo = _mm_read_UBYTE (modreader);
+	  /* tempo = */ _mm_read_UBYTE (modreader);
 
 	  crow = pat;
 	  /* file often allocates 64 rows even if there are less in pattern */
diff --git a/libunimod/load_it.c b/libunimod/load_it.c
index 510e544..cb12b40 100644
--- a/libunimod/load_it.c
+++ b/libunimod/load_it.c
@@ -497,7 +497,6 @@ IT_Load (BOOL curious)
   int t, u, lp;
   INSTRUMENT *d;
   SAMPLE *q;
-  BOOL compressed = 0;
 
   numtrk = 0;
   filters = 0;
@@ -741,7 +740,6 @@ IT_Load (BOOL curious)
       if ((s.flag & 8) && (mh->cwt >= 0x214))
 	{
 	  q->flags |= SF_ITPACKED;
-	  compressed = 1;
 	}
       if (s.flag & 16)
 	q->flags |= SF_LOOP;
@@ -1076,8 +1074,6 @@ IT_Load (BOOL curious)
 
   for (t = 0; t < of.numpat; t++)
     {
-      UWORD packlen;
-
       /* seek to pattern position */
       if (!paraptr[mh->insnum + mh->smpnum + t])
 	{			/* 0 -> empty 64 row pattern */
@@ -1095,7 +1091,7 @@ IT_Load (BOOL curious)
       else
 	{
 	  _mm_fseek (modreader, ((long) paraptr[mh->insnum + mh->smpnum + t]), SEEK_SET);
-	  packlen = _mm_read_I_UWORD (modreader);
+	  /* packlen = */ _mm_read_I_UWORD (modreader);
 	  of.pattrows[t] = _mm_read_I_UWORD (modreader);
 	  _mm_read_I_ULONG (modreader);
 	  if (!IT_ReadPattern (of.pattrows[t]))
diff --git a/libunimod/mloader.c b/libunimod/mloader.c
index bea58df..7b2c873 100644
--- a/libunimod/mloader.c
+++ b/libunimod/mloader.c
@@ -309,8 +309,8 @@ SL_LoadInternal (void *buffer, UWORD infmt, UWORD outfmt, int scalefactor, ULONG
   int stodo, t, u;
 
   int result, c_block = 0;	/* compression bytes until next block */
-  ITPACK status;
-  UWORD incnt;
+  ITPACK status = { 0,0,0,0 };
+  UWORD incnt = 0;
 
   while (length)
     {
diff --git a/libunimod/mlutil.c b/libunimod/mlutil.c
index e147e8a..7a4dfe3 100644
--- a/libunimod/mlutil.c
+++ b/libunimod/mlutil.c
@@ -354,10 +354,10 @@ void S3MIT_CreateOrders(BOOL curious)
 /* handles S3M and IT effects */
 void S3MIT_ProcessCmd(UBYTE cmd,UBYTE inf,BOOL oldeffect)
 {
-	UBYTE hi,lo;
+	UBYTE lo;
 
 	lo=inf&0xf;
-	hi=inf>>4;
+	/* hi=inf>>4; */
 
 	/* process S3M / IT specific command structure */
 
diff --git a/timidity/ao_a.c b/timidity/ao_a.c
index 9a012f3..ee62b39 100644
--- a/timidity/ao_a.c
+++ b/timidity/ao_a.c
@@ -90,12 +90,11 @@ static void show_ao_device_info(FILE *fp)
 
 static int open_output(void)
 {
-  int driver_id, ret;
+  int driver_id, ret = 0;
 
   int driver_count;
   ao_info **devices;
   int i;
-  char buf[256];
 
   ao_initialize();
 
diff --git a/timidity/calcnewt.c b/timidity/calcnewt.c
index 4e00223..fdf287d 100644
--- a/timidity/calcnewt.c
+++ b/timidity/calcnewt.c
@@ -53,9 +53,13 @@ int main(int argc, const char *argv[])
 	    fprintf(fp, "(float)%2.32g,\n", newt_coeffs[i][j]);
 	fclose(fp);
 #else
-    for (i = 0; i <= n; i++)
-	for (j = 0; j <= n; j++)
-	    printf("%2.32g,\n", newt_coeffs[i][j]);
+	for (i = 0; i <= n; i++) {
+		printf("{\n");
+		for (j = 0; j <= n; j++) {
+			printf("%2.32g,\n", newt_coeffs[i][j]);
+		}
+		printf("},\n");
+	}
 #endif
     return 0;
 }
diff --git a/timidity/common.c b/timidity/common.c
index 76b13aa..f24dd9a 100644
--- a/timidity/common.c
+++ b/timidity/common.c
@@ -210,8 +210,9 @@ url_dumpfile(URL url, const char *ext)
     return NULL;
   }
 
-  while((n = url_read(url, buff, sizeof(buff))) > 0)
-    fwrite(buff, 1, n, fp);
+  while((n = url_read(url, buff, sizeof(buff))) > 0) {
+    size_t dummy = fwrite(buff, 1, n, fp); ++dummy;
+  }
   fclose(fp);
   return safe_strdup(filename);
 }
@@ -431,7 +432,7 @@ struct timidity_file *open_file(char *name, int decompress, int noise_mode)
 	if (!is_abs_path(name))
 		while (plp) {	/* Try along the path then */
 			*current_filename = 0;
-			if(l = strlen(plp->path)) {
+			if((l = strlen(plp->path))) {
 				strncpy(current_filename, plp->path,
 						sizeof(current_filename));
 				if (!IS_PATH_SEP(current_filename[l - 1])
@@ -509,7 +510,7 @@ struct timidity_file *open_file_r(char *name, int decompress, int noise_mode)
 	if (!is_abs_path(name))
 		while (plp) {	/* Try along the path then */
 			*current_filename = 0;
-			if(l = strlen(plp->path)) {
+			if((l = strlen(plp->path))) {
 				strncpy(current_filename, plp->path,
 						sizeof(current_filename));
 				if (!IS_PATH_SEP(current_filename[l - 1])
@@ -662,6 +663,7 @@ void *safe_malloc(size_t count)
 #endif /* ABORT_AT_FATAL */
     safe_exit(10);
     /*NOTREACHED*/
+	return 0;
 }
 
 void *safe_large_malloc(size_t count)
@@ -688,6 +690,7 @@ void *safe_large_malloc(size_t count)
 #endif /* ABORT_AT_FATAL */
     safe_exit(10);
     /*NOTREACHED*/
+	return 0;
 }
 
 void *safe_realloc(void *ptr, size_t count)
@@ -724,6 +727,7 @@ void *safe_realloc(void *ptr, size_t count)
 #endif /* ABORT_AT_FATAL */
     safe_exit(10);
     /*NOTREACHED*/
+	return 0;
 }
 
 /* This'll allocate memory or die. */
@@ -748,6 +752,7 @@ char *safe_strdup(const char *s)
 #endif /* ABORT_AT_FATAL */
     safe_exit(10);
     /*NOTREACHED*/
+	return 0;
 }
 
 /* free ((void **)ptr_list)[0..count-1] and ptr_list itself */
diff --git a/timidity/effect.c b/timidity/effect.c
index ca32cb9..2e566c6 100644
--- a/timidity/effect.c
+++ b/timidity/effect.c
@@ -38,7 +38,6 @@
 #include <stdlib.h>
 
 #include "mt19937ar.h"
-#define RAND_MAX 0xffffffff
 
 #include "timidity.h"
 #include "instrum.h"
diff --git a/timidity/esd_a.c b/timidity/esd_a.c
index 6338609..24d97f4 100644
--- a/timidity/esd_a.c
+++ b/timidity/esd_a.c
@@ -27,6 +27,7 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 #define _GNU_SOURCE
+#include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -78,7 +79,6 @@ PlayMode dpm = {
 
 static int try_open(void)
 {
-    int fd, tmp, i;
     int include_enc, exclude_enc;
     esd_format_t esdformat;
 
diff --git a/timidity/freq.c b/timidity/freq.c
index 3f54dda..140db3e 100644
--- a/timidity/freq.c
+++ b/timidity/freq.c
@@ -144,10 +144,10 @@ float pitch_freq_lb_table[129] = {
    (f)ifth,		rotate back 1,	rotate back 2
 */
 int chord_table[4][3][3] = {
-    0, 4, 7,     -5, 0, 4,     -8, -5, 0,
-    0, 3, 7,     -5, 0, 3,     -9, -5, 0,
-    0, 3, 6,     -6, 0, 3,     -9, -6, 0,
-    0, 5, 7,     -5, 0, 5,     -7, -5, 0
+ { { 0, 4, 7, }, { -5, 0, 4, }, { -8, -5, 0, }, },
+ { { 0, 3, 7, }, { -5, 0, 3, }, { -9, -5, 0, }, },
+ { { 0, 3, 6, }, { -6, 0, 3, }, { -9, -6, 0, }, },
+ { { 0, 5, 7, }, { -5, 0, 5, }, { -7, -5, 0, }, },
 };
 
 /* write the chord type to *chord, returns the root note of the chord */
@@ -160,7 +160,6 @@ int assign_chord(double *pitchbins, int *chord,
     int prune_pitches[10] = {0};
     int i, j, k, n, n2;
     double val, cutoff, max;
-    int start = 0;
     int root_flag;
 
     *chord = -1;
@@ -330,14 +329,14 @@ float freq_fourier(Sample *sp, int *chord)
     uint32 length, length0;
     int32 maxoffset, minoffset, minoffset1, minoffset2;
     int32 minbin, maxbin;
-    int32 bin, largest_peak;
+    int32 bin;
     int32 i, j, n, total;
     unsigned int rate;
     int pitch, bestpitch, minpitch, maxpitch, maxpitch2;
     sample_t *origdata;
     float f0, mag, maxmag;
     int16 amp, oldamp, maxamp;
-    int32 maxpos;
+    int32 maxpos = 0;
     double sum, weightsum, maxsum;
     double f0_inv;
     float freq, newfreq, bestfreq, freq_inc;
@@ -494,7 +493,6 @@ float freq_fourier(Sample *sp, int *chord)
 	if (sum > maxsum)
 	{
 	    maxsum = sum;
-	    largest_peak = i;
 	}
     }
 
diff --git a/timidity/instrum.c b/timidity/instrum.c
index 91f4a78..c250190 100644
--- a/timidity/instrum.c
+++ b/timidity/instrum.c
@@ -1043,7 +1043,7 @@ Instrument *load_instrument(int dr, int b, int prog)
 	char infomsg[256];
 	
 #ifndef CFG_FOR_SF
-	if (play_system_mode == GS_SYSTEM_MODE && (b == 64 || b == 65))
+	if (play_system_mode == GS_SYSTEM_MODE && (b == 64 || b == 65)) {
 		if (! dr)	/* User Instrument */
 			recompute_userinst(b, prog);
 		else {		/* User Drumset */
@@ -1052,6 +1052,7 @@ Instrument *load_instrument(int dr, int b, int prog)
 				return ip;
 			}
 		}
+        }
 #endif
 	if (bank->tone[prog].instype == 1 || bank->tone[prog].instype == 2) {
 		if (bank->tone[prog].instype == 1) {	/* Font extention */
diff --git a/timidity/loadtab.c b/timidity/loadtab.c
index 36a48e7..409fe6c 100644
--- a/timidity/loadtab.c
+++ b/timidity/loadtab.c
@@ -60,7 +60,7 @@ int load_table(char *file)
 				fclose(fp);
 				return 0;
 			}
-		} while (value = strtok(NULL, ", \n"));
+		} while ((value = strtok(NULL, ", \n")));
 	}
 	fclose(fp);
 	return 0;
diff --git a/timidity/m2m.c b/timidity/m2m.c
index c763de4..8417bf6 100644
--- a/timidity/m2m.c
+++ b/timidity/m2m.c
@@ -169,25 +169,25 @@ static char chord_letters[4] = { 'M', 'm', 'd', 'f' };
  * lookup_table[mod_vol][expression, volume]
  */
 static char vol_nonlin_to_lin[128][2] = {
-      0, 127,   7, 125,  11, 120,  14, 121,  16, 126,  19, 121,  21, 122,
-     23, 122,  25, 122,  26, 126,  28, 125,  30, 123,  31, 126,  33, 124,
-     34, 126,  36, 124,  37, 125,  38, 126,  40, 124,  41, 125,  42, 126,
-     43, 127,  45, 125,  46, 125,  47, 126,  48, 126,  49, 127,  50, 127,
-     52, 125,  53, 125,  54, 125,  55, 125,  56, 126,  57, 126,  58, 126,
-     59, 126,  60, 126,  61, 126,  62, 126,  63, 126,  64, 126,  65, 126,
-     66, 126,  67, 125,  68, 125,  69, 125,  69, 127,  70, 127,  71, 126,
-     72, 126,  73, 126,  74, 126,  75, 126,  76, 125,  76, 127,  77, 127,
-     78, 126,  79, 126,  80, 126,  81, 126,  81, 127,  82, 126,  83, 126,
-     84, 126,  85, 126,  85, 127,  86, 126,  87, 126,  88, 126,  88, 127,
-     89, 127,  90, 126,  91, 126,  91, 127,  92, 127,  93, 126,  94, 126,
-     94, 127,  95, 127,  96, 126,  97, 126,  97, 127,  98, 126,  99, 126,
-    100, 126, 100, 127, 101, 126, 102, 126, 102, 127, 103, 126, 104, 126,
-    104, 127, 105, 127, 106, 126, 106, 127, 107, 127, 108, 126, 108, 127,
-    109, 127, 110, 126, 110, 127, 111, 127, 112, 126, 112, 127, 113, 127,
-    114, 126, 114, 127, 115, 127, 116, 126, 116, 127, 117, 126, 118, 126,
-    118, 127, 119, 126, 120, 126, 120, 127, 121, 126, 121, 127, 122, 126,
-    123, 126, 123, 127, 124, 126, 124, 127, 125, 127, 126, 126, 126, 127,
-    127, 126, 127, 127 };
+     { 0, 127, },{  7, 125,  },{11, 120, },{ 14, 121, },{ 16, 126, },{ 19, 121, },{ 21, 122,},
+     { 23, 122, },{ 25, 122, },{ 26, 126,  },{28, 125, },{ 30, 123, },{ 31, 126, },{ 33, 124,},
+     { 34, 126, },{ 36, 124, },{ 37, 125, },{ 38, 126, },{ 40, 124, },{ 41, 125, },{ 42, 126, },
+     { 43, 127, },{ 45, 125, },{ 46, 125, },{ 47, 126, },{ 48, 126, },{ 49, 127, },{ 50, 127, },
+     { 52, 125, },{ 53, 125, },{ 54, 125, },{ 55, 125, },{ 56, 126, },{ 57, 126, },{ 58, 126, },
+     { 59, 126, },{ 60, 126, },{ 61, 126, },{ 62, 126, },{ 63, 126,  },{64, 126, },{ 65, 126, },
+     { 66, 126, },{ 67, 125, },{ 68, 125, },{ 69, 125, },{ 69, 127, },{ 70, 127, },{ 71, 126, },
+     { 72, 126, },{ 73, 126, },{ 74, 126, },{ 75, 126, },{ 76, 125, },{ 76, 127, },{ 77, 127, },
+     { 78, 126, },{ 79, 126, },{ 80, 126, },{ 81, 126, },{ 81, 127, },{ 82, 126, },{ 83, 126, },
+     { 84, 126, },{ 85, 126, },{ 85, 127, },{ 86, 126, },{ 87, 126, },{ 88, 126, },{ 88, 127, },
+     { 89, 127, },{ 90, 126, },{ 91, 126, },{ 91, 127, },{ 92, 127, },{ 93, 126, },{ 94, 126, },
+     { 94, 127, },{ 95, 127, },{ 96, 126, },{ 97, 126, },{ 97, 127, },{ 98, 126, },{ 99, 126, },
+    { 100, 126, },{100, 127, },{101, 126, },{102, 126, },{102, 127, },{103, 126, },{104, 126, },
+    { 104, 127, },{105, 127, },{106, 126, },{106, 127, },{107, 127, },{108, 126, },{108, 127, },
+    { 109, 127, },{110, 126, },{110, 127, },{111, 127, },{112, 126, },{112, 127, },{113, 127, },
+    { 114, 126, },{114, 127, },{115, 127, },{116, 126, },{116, 127, },{117, 126, },{118, 126, },
+    { 118, 127, },{119, 126, },{120, 126, },{120, 127, },{121, 126, },{121, 127, },{122, 126, },
+    { 123, 126, },{123, 127, },{124, 126, },{124, 127, },{125, 127, },{126, 126, },{126, 127, },
+    { 127, 126, }, { 127, 127 }, };
 
 /*
  * Uses the volume curve specified by the -V or --volume-curve option.
@@ -587,13 +587,13 @@ void scan_ahead_for_m2m_tweaks(MidiEvent * ev, int midi_ch, int midi_note,
     int32 bend = 0, lowbend = 0, highbend = 0;
     int32 pb_offset1 = 0, pb_offset2 = 0;
     int note_offset1 = 0, note_offset2 = 0;
-    uint32 init_time, cur_time, old_time, cut_time = 0;
+    uint32 cur_time, old_time, cut_time = 0;
     Sample *sp;
     double a, bent_length = 0, delta_length;
     uint32 length;
     float root_freq, pitch, freq;
 
-    init_time = cur_time = old_time = ev->time;
+    cur_time = old_time = ev->time;
     init_ch = ev->channel;
     init_note = ev->a;
     init_velocity = ev->b;
@@ -964,7 +964,7 @@ void m2m_process_events(MidiEvent * ev)
     uint32 oldtime = 0, deltatime;
     double time = 0;
     int chord, chord_type, chord_subtype;
-    int ch, n, old_ch, newnote, mod_sample, expression;
+    int ch, n, old_ch, newnote, mod_sample=0, expression=0;
     int extra;
 
     /* go through the list for real this time */
diff --git a/timidity/miditrace.c b/timidity/miditrace.c
index 982edbb..4f6e852 100644
--- a/timidity/miditrace.c
+++ b/timidity/miditrace.c
@@ -236,7 +236,7 @@ void push_midi_time_vp(int32 start, void (*f)(void *), void *vp)
 
 int32 trace_loop(void)
 {
-    int32 cur, start;
+    int32 cur;
     int ctl_update;
     static int lasttime = -1;
 
@@ -250,7 +250,6 @@ int32 trace_loop(void)
 	cur = 0x7fffffff; /* apply all trace event */
 
     ctl_update = 0;
-    start = midi_trace.head->start;
     while(midi_trace.head && cur >= midi_trace.head->start
 	  && cur > 0) /* privent flying start */
     {
diff --git a/timidity/output.c b/timidity/output.c
index 2b97bd9..2fec198 100644
--- a/timidity/output.c
+++ b/timidity/output.c
@@ -452,9 +452,7 @@ int32 general_output_convert(int32 *buf, int32 count)
 int validate_encoding(int enc, int include_enc, int exclude_enc)
 {
     const char *orig_enc_name, *enc_name;
-    int orig_enc;
 
-    orig_enc = enc;
     orig_enc_name = output_encoding_string(enc);
     enc |= include_enc;
     enc &= ~exclude_enc;
@@ -643,7 +641,7 @@ char *create_auto_output_name(const char *input_filename, char *ext_str, char *o
 	  *p = '_';
 
     if(mode==2){
-      char *p1,*p2,*p3;
+      char *p1,*p2;
 #ifndef __W32__
       p = strrchr(output_filename+dir_len,PATH_SEP);
 #else
@@ -654,6 +652,7 @@ char *create_auto_output_name(const char *input_filename, char *ext_str, char *o
 #endif
       p1 = STRRCHR(output_filename+dir_len,'/');
       p2 = STRRCHR(output_filename+dir_len,'\\');
+      char *p3;
       p3 = STRRCHR(output_filename+dir_len,':');
 #undef STRRCHR
       p1>p2 ? (p1>p3 ? (p = p1) : (p = p3)) : (p2>p3 ? (p = p2) : (p = p3));
diff --git a/timidity/playmidi.c b/timidity/playmidi.c
index 727f1ad..6a1e147 100644
--- a/timidity/playmidi.c
+++ b/timidity/playmidi.c
@@ -302,7 +302,6 @@ static int16 get_midi_controller_amp_depth(midi_controller *);
 /* Rx. ~ (Rcv ~) */
 static void init_rx(int);
 static void set_rx(int, int32, int);
-static int32 get_rx(int, int32);
 static void init_rx_drum(struct DrumParts *);
 static void set_rx_drum(struct DrumParts *, int32, int);
 static int32 get_rx_drum(struct DrumParts *, int32);
@@ -2157,8 +2156,8 @@ static int find_voice(MidiEvent *e)
 			else if (altassign && find_altassign(altassign, voice[i].note))
 				kill_note(i);
 			else if (voice[i].note == note && (channel[ch].assign_mode == 0
-					|| channel[ch].assign_mode == 1
-					&& voice[i].proximate_flag == 0))
+					|| (channel[ch].assign_mode == 1 &&
+					    voice[i].proximate_flag == 0)))
 				kill_note(i);
 		}
 	for (i = 0; i < upper_voices; i++)
@@ -6727,7 +6726,7 @@ static void do_compute_data_midi(int32 count)
 
 	for (i = 0; i < uv; i++) {
 		if (voice[i].status != VOICE_FREE) {
-			int32 *vpb;
+			int32 *vpb = NULL;
 			int8 flag;
 			
 			if (channel_effect) {
@@ -7304,7 +7303,7 @@ static int compute_data(int32 count)
 	  {
 	      if(filled <= last_filled)
 	      {
-	          int v, kill_nv, temp_nv;
+	          int kill_nv, temp_nv;
 
 		  /* set bounds on "good" and "bad" nv */
 		  if (! opt_realtime_playing && rate > 20 &&
@@ -7355,7 +7354,7 @@ static int compute_data(int32 count)
 		  }
 
 		  for(i = 0; i < kill_nv; i++)
-		      v = reduce_voice();
+		      reduce_voice();
 
 		  /* lower max # of allowed voices to let the buffer recover */
 		  if (auto_reduce_polyphony) {
@@ -8023,8 +8022,8 @@ int play_event(MidiEvent *ev)
 		channel[ch].temper_type = current_event->a;
 		ctl_mode_event(CTLE_TEMPER_TYPE, 1, ch, channel[ch].temper_type);
 		if (temper_type_mute) {
-			if (temper_type_mute & 1 << current_event->a
-					- ((current_event->a >= 0x40) ? 0x3c : 0)) {
+			if (temper_type_mute & (1 << (current_event->a
+					- ((current_event->a >= 0x40) ? 0x3c : 0)))) {
 				SET_CHANNELMASK(channel_mute, ch);
 				ctl_mode_event(CTLE_MUTE, 1, ch, 1);
 			} else {
@@ -8046,8 +8045,8 @@ int play_event(MidiEvent *ev)
 			ctl_mode_event(CTLE_TEMPER_TYPE, 1, i, channel[i].temper_type);
 		}
 		if (temper_type_mute) {
-			if (temper_type_mute & 1 << current_event->a
-					- ((current_event->a >= 0x40) ? 0x3c : 0)) {
+			if (temper_type_mute & (1 << (current_event->a
+					- ((current_event->a >= 0x40) ? 0x3c : 0)))) {
 				FILL_CHANNELMASK(channel_mute);
 				for (i = 0; i < MAX_CHANNELS; i++)
 					ctl_mode_event(CTLE_MUTE, 1, i, 1);
diff --git a/timidity/readmidi.c b/timidity/readmidi.c
index aba7f2e..158388a 100644
--- a/timidity/readmidi.c
+++ b/timidity/readmidi.c
@@ -5460,8 +5460,9 @@ int midi_file_save_as(char *in_name, char *out_name)
 	return -1;
     }
 
-    while((n = tf_read(buff, 1, sizeof(buff), tf)) > 0)
-	fwrite(buff, 1, n, ofp);
+    while((n = tf_read(buff, 1, sizeof(buff), tf)) > 0) {
+	size_t dummy = fwrite(buff, 1, n, ofp); ++dummy;
+	}
     ctl->cmsg(CMSG_INFO, VERB_NORMAL, "Save as %s...Done", out_name);
 
     fclose(ofp);
diff --git a/timidity/recache.c b/timidity/recache.c
index 4f4030c..2efb448 100644
--- a/timidity/recache.c
+++ b/timidity/recache.c
@@ -59,7 +59,7 @@
 #define MAX_EXPANDLEN (1024 * 32)
 #define CACHE_DATA_LEN (allocate_cache_size / sizeof(sample_t))
 
-#define sp_hash(sp, note) ((unsigned int) (sp) + (unsigned int) (note))
+#define sp_hash(sp, note) ((unsigned long) (sp) + (unsigned int) (note))
 #define CACHE_RESAMPLING_OK 0
 #define CACHE_RESAMPLING_NOTOK 1
 #define SORT_THRESHOLD 20
diff --git a/timidity/resample.c b/timidity/resample.c
index b84469e..cd6b8e6 100644
--- a/timidity/resample.c
+++ b/timidity/resample.c
@@ -255,7 +255,7 @@ static sample_t *newt_old_src = NULL;
 static resample_t resample_newton(sample_t *src, splen_t ofs, resample_rec_t *rec)
 {
     int n_new, n_old;
-    int32 v1, v2, diff;
+    int32 v1, v2, diff = 0;
     sample_t *sptr;
     double y, xd;
     int32 left, right, temp_n;
diff --git a/timidity/reverb.c b/timidity/reverb.c
index 5393855..2d3ac4d 100644
--- a/timidity/reverb.c
+++ b/timidity/reverb.c
@@ -274,6 +274,7 @@ static inline int32 do_lfo(lfo *lfo)
 	return val;
 }
 
+#if 0
 /*! modulated delay with allpass interpolation (for Chorus Effect,...) */
 static void free_mod_delay(mod_delay *delay)
 {
@@ -282,7 +283,9 @@ static void free_mod_delay(mod_delay *delay)
 		delay->buf = NULL;
 	}
 }
+#endif
 
+#if 0
 static void set_mod_delay(mod_delay *delay, int32 ndelay, int32 depth)
 {
 	int32 size = ndelay + depth + 1;
@@ -297,6 +300,7 @@ static void set_mod_delay(mod_delay *delay, int32 ndelay, int32 depth)
 	delay->size = size;
 	memset(delay->buf, 0, sizeof(int32) * delay->size);
 }
+#endif
 
 static inline void do_mod_delay(int32 *stream, int32 *buf, int32 size, int32 *rindex, int32 *windex,
 								int32 ndelay, int32 depth, int32 lfoval, int32 *hist)
@@ -679,6 +683,7 @@ static inline void do_filter_biquad(int32 *stream, int32 a1, int32 a2, int32 b1,
 	*stream = t1;
 }
 
+#if 0
 static void do_biquad_filter_stereo(int32* buf, int32 count, filter_biquad *p)
 {
 	int32 i;
@@ -694,6 +699,7 @@ static void do_biquad_filter_stereo(int32* buf, int32 count, filter_biquad *p)
 	p->x1l = x1l, p->x2l = x2l, p->y1l = y1l, p->y2l = y2l,
 		p->x1r = x1r, p->x2r = x2r, p->y1r = y1r, p->y2r = y2r;
 }
+#endif
 
 void init_filter_shelving(filter_shelving *p)
 {
@@ -2751,7 +2757,6 @@ void do_dual_od(int32 *buf, int32 count, EffectList *ef)
 	filter_moog *svfl = &(info->svfl), *svfr = &(info->svfr);
 	filter_biquad *lpf1 = &(info->lpf1);
 	void (*do_amp_siml)(int32 *, int32) = info->amp_siml,
-		(*do_amp_simr)(int32 *, int32) = info->amp_simr,
 		(*do_odl)(int32 *, int32) = info->odl,
 		(*do_odr)(int32 *, int32) = info->odr;
 	int32 i, inputl, inputr, high, levelli = info->levelli, levelri = info->levelri,
@@ -4074,6 +4079,7 @@ enum {	/* width * length * height */
 	ER_EOF,
 };
 
+#if 0
 struct early_reflection_param_t {
 	int8 character;
 	int16 time_left[20];	/* in ms */
@@ -4083,154 +4089,200 @@ struct early_reflection_param_t {
 };
 
 static struct early_reflection_param_t early_reflection_param[] = {
-	ER_SMALL_ROOM, 461, 487, 505, 530, 802, 818, 927, 941, 1047, 1058, 1068, 1070, 1076, 1096, 1192, 1203, 1236, 1261, 1321, 1344,
-	0.1594, 0.1328, 0.1197, 0.1025, 0.0285, 0.0267, 0.0182, 0.0173, 0.0098, 0.0121, 0.0092, 0.0116, 0.0090, 0.0085, 0.0084, 0.0081, 0.0059, 0.0055, 0.0048, 0.0045,
-	381, 524, 621, 636, 718, 803, 890, 906, 975, 1016, 1026, 1040, 1137, 1166, 1212, 1220, 1272, 1304, 1315, 1320,
-	0.1896, 0.0706, 0.0467, 0.0388, 0.0298, 0.0211, 0.0137, 0.0181, 0.0144, 0.0101, 0.0088, 0.0118, 0.0072, 0.0081, 0.0073, 0.0071, 0.0062, 0.0042, 0.0057, 0.0024,
-	ER_MEDIUM_ROOM, 461, 802, 927, 1047, 1236, 1321, 1345, 1468, 1497, 1568, 1609, 1642, 1713, 1744, 1768, 1828, 1835, 1864, 1893, 1923,
-	0.3273, 0.0586, 0.0374, 0.0201, 0.0120, 0.0098, 0.0152, 0.0090, 0.0109, 0.0095, 0.0068, 0.0034, 0.0073, 0.0041, 0.0027, 0.0024, 0.0059, 0.0034, 0.0054, 0.0035,
-	381, 636, 906, 1026, 1040, 1315, 1320, 1415, 1445, 1556, 1588, 1628, 1637, 1663, 1693, 1768, 1788, 1824, 1882, 1920,
-	0.1896, 0.0706, 0.0467, 0.0388, 0.0298, 0.0211, 0.0137, 0.0181, 0.0144, 0.0101, 0.0088, 0.0118, 0.0072, 0.0081, 0.0073, 0.0071, 0.0062, 0.0042, 0.0057, 0.0024,
-	ER_LARGE_ROOM, 577, 875, 1665, 1713, 1784, 1790, 1835, 1913, 1954, 2023, 2062, 2318, 2349, 2371, 2405, 2409, 2469, 2492, 2534, 2552,
-	0.2727, 0.0752, 0.0070, 0.0110, 0.0083, 0.0056, 0.0089, 0.0079, 0.0051, 0.0066, 0.0043, 0.0019, 0.0035, 0.0023, 0.0038, 0.0017, 0.0015, 0.0029, 0.0027, 0.0032,
-	381, 636, 1485, 1570, 1693, 1768, 1875, 1895, 1963, 2066, 2128, 2220, 2277, 2309, 2361, 2378, 2432, 2454, 2497, 2639,
-	0.5843, 0.1197, 0.0117, 0.0098, 0.0032, 0.0028, 0.0042, 0.0022, 0.0020, 0.0038, 0.0035, 0.0043, 0.0040, 0.0022, 0.0028, 0.0035, 0.0033, 0.0018, 0.0010, 0.0008,
-	ER_MEDIUM_HALL, 1713, 1835, 2534, 2618, 2780, 2849, 2857, 3000, 3071, 3159, 3226, 3338, 3349, 3407, 3413, 3465, 3594, 3669, 3714, 3728,
-	0.0146, 0.0118, 0.0036, 0.0033, 0.0033, 0.0030, 0.0031, 0.0013, 0.0012, 0.0023, 0.0021, 0.0018, 0.0016, 0.0015, 0.0016, 0.0016, 0.0015, 0.0013, 0.0006, 0.0012,
-	381, 636, 1693, 1768, 2066, 2128, 2362, 2416, 2454, 2644, 2693, 2881, 2890, 2926, 2957, 3036, 3185, 3328, 3385, 3456,
-	0.7744, 0.1586, 0.0042, 0.0037, 0.0051, 0.0046, 0.0036, 0.0034, 0.0024, 0.0018, 0.0017, 0.0024, 0.0015, 0.0023, 0.0008, 0.0012, 0.0013, 0.0005, 0.0012, 0.0005,
-	ER_LARGE_HALL, 1713, 1835, 2534, 2618, 3159, 3226, 3669, 3728, 4301, 4351, 4936, 5054, 5097, 5278, 5492, 5604, 5631, 5714, 5751, 5800,
-	0.0150, 0.0121, 0.0037, 0.0034, 0.0023, 0.0022, 0.0013, 0.0012, 0.0005, 0.0005, 0.0006, 0.0002, 0.0002, 0.0004, 0.0004, 0.0004, 0.0004, 0.0002, 0.0002, 0.0003,
-	381, 636, 1693, 1768, 2066, 2128, 2644, 2693, 3828, 3862, 4169, 4200, 4792, 5068, 5204, 5231, 5378, 5460, 5485, 5561,
-	0.7936, 0.1625, 0.0043, 0.0038, 0.0052, 0.0047, 0.0018, 0.0017, 0.0008, 0.0008, 0.0007, 0.0007, 0.0003, 0.0001, 0.0003, 0.0002, 0.0002, 0.0002, 0.0001, 0.0003,
-	ER_EOF, 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, 
+	{ ER_SMALL_ROOM,
+		{ 461, 487, 505, 530, 802, 818, 927, 941, 1047, 1058, 1068, 1070, 1076, 1096, 1192, 1203, 1236, 1261, 1321, 1344, },
+		{ 0.1594, 0.1328, 0.1197, 0.1025, 0.0285, 0.0267, 0.0182, 0.0173, 0.0098, 0.0121, 0.0092, 0.0116, 0.0090, 0.0085, 0.0084, 0.0081, 0.0059, 0.0055, 0.0048, 0.0045, },
+		{ 381, 524, 621, 636, 718, 803, 890, 906, 975, 1016, 1026, 1040, 1137, 1166, 1212, 1220, 1272, 1304, 1315, 1320,},
+		{ 0.1896, 0.0706, 0.0467, 0.0388, 0.0298, 0.0211, 0.0137, 0.0181, 0.0144, 0.0101, 0.0088, 0.0118, 0.0072, 0.0081, 0.0073, 0.0071, 0.0062, 0.0042, 0.0057, 0.0024, },
+	},
+	{ ER_MEDIUM_ROOM,
+		{ 461, 802, 927, 1047, 1236, 1321, 1345, 1468, 1497, 1568, 1609, 1642, 1713, 1744, 1768, 1828, 1835, 1864, 1893, 1923,},
+		{ 0.3273, 0.0586, 0.0374, 0.0201, 0.0120, 0.0098, 0.0152, 0.0090, 0.0109, 0.0095, 0.0068, 0.0034, 0.0073, 0.0041, 0.0027, 0.0024, 0.0059, 0.0034, 0.0054, 0.0035,},
+		{ 381, 636, 906, 1026, 1040, 1315, 1320, 1415, 1445, 1556, 1588, 1628, 1637, 1663, 1693, 1768, 1788, 1824, 1882, 1920,},
+		{ 0.1896, 0.0706, 0.0467, 0.0388, 0.0298, 0.0211, 0.0137, 0.0181, 0.0144, 0.0101, 0.0088, 0.0118, 0.0072, 0.0081, 0.0073, 0.0071, 0.0062, 0.0042, 0.0057, 0.0024, },
+	},
+	{ ER_LARGE_ROOM, 
+		{ 577, 875, 1665, 1713, 1784, 1790, 1835, 1913, 1954, 2023, 2062, 2318, 2349, 2371, 2405, 2409, 2469, 2492, 2534, 2552, },
+		{ 0.2727, 0.0752, 0.0070, 0.0110, 0.0083, 0.0056, 0.0089, 0.0079, 0.0051, 0.0066, 0.0043, 0.0019, 0.0035, 0.0023, 0.0038, 0.0017, 0.0015, 0.0029, 0.0027, 0.0032,},
+		{ 381, 636, 1485, 1570, 1693, 1768, 1875, 1895, 1963, 2066, 2128, 2220, 2277, 2309, 2361, 2378, 2432, 2454, 2497, 2639,},
+		{ 0.5843, 0.1197, 0.0117, 0.0098, 0.0032, 0.0028, 0.0042, 0.0022, 0.0020, 0.0038, 0.0035, 0.0043, 0.0040, 0.0022, 0.0028, 0.0035, 0.0033, 0.0018, 0.0010, 0.0008, },
+	},
+	{ ER_MEDIUM_HALL, 
+		{ 1713, 1835, 2534, 2618, 2780, 2849, 2857, 3000, 3071, 3159, 3226, 3338, 3349, 3407, 3413, 3465, 3594, 3669, 3714, 3728,},
+		{ 0.0146, 0.0118, 0.0036, 0.0033, 0.0033, 0.0030, 0.0031, 0.0013, 0.0012, 0.0023, 0.0021, 0.0018, 0.0016, 0.0015, 0.0016, 0.0016, 0.0015, 0.0013, 0.0006, 0.0012,},
+		{ 381, 636, 1693, 1768, 2066, 2128, 2362, 2416, 2454, 2644, 2693, 2881, 2890, 2926, 2957, 3036, 3185, 3328, 3385, 3456,},
+		{ 0.7744, 0.1586, 0.0042, 0.0037, 0.0051, 0.0046, 0.0036, 0.0034, 0.0024, 0.0018, 0.0017, 0.0024, 0.0015, 0.0023, 0.0008, 0.0012, 0.0013, 0.0005, 0.0012, 0.0005, },
+	},
+	{ ER_LARGE_HALL, 
+		{ 1713, 1835, 2534, 2618, 3159, 3226, 3669, 3728, 4301, 4351, 4936, 5054, 5097, 5278, 5492, 5604, 5631, 5714, 5751, 5800,},
+		{ 0.0150, 0.0121, 0.0037, 0.0034, 0.0023, 0.0022, 0.0013, 0.0012, 0.0005, 0.0005, 0.0006, 0.0002, 0.0002, 0.0004, 0.0004, 0.0004, 0.0004, 0.0002, 0.0002, 0.0003,},
+		{ 381, 636, 1693, 1768, 2066, 2128, 2644, 2693, 3828, 3862, 4169, 4200, 4792, 5068, 5204, 5231, 5378, 5460, 5485, 5561,},
+		{ 0.7936, 0.1625, 0.0043, 0.0038, 0.0052, 0.0047, 0.0018, 0.0017, 0.0008, 0.0008, 0.0007, 0.0007, 0.0003, 0.0001, 0.0003, 0.0002, 0.0002, 0.0002, 0.0001, 0.0003, },
+	},
+	{ ER_EOF, { 0, }, { 0, }, { 0, }, { 0, }, },
 };
+#endif
 
 struct _EffectEngine effect_engine[] = {
-	EFFECT_NONE, "None", NULL, NULL, NULL, 0,
-	EFFECT_STEREO_EQ, "Stereo-EQ", do_stereo_eq, conv_gs_stereo_eq, NULL, sizeof(InfoStereoEQ),
-	EFFECT_EQ2, "2-Band EQ", do_eq2, conv_gs_eq2, conv_xg_eq2, sizeof(InfoEQ2),
-	EFFECT_EQ3, "3-Band EQ", do_eq3, NULL, conv_xg_eq3, sizeof(InfoEQ3),
-	EFFECT_OVERDRIVE1, "Overdrive", do_overdrive1, conv_gs_overdrive1, NULL, sizeof(InfoOverdrive1),
-	EFFECT_DISTORTION1, "Distortion", do_distortion1, conv_gs_overdrive1, NULL, sizeof(InfoOverdrive1),
-	EFFECT_OD1OD2, "OD1/OD2", do_dual_od, conv_gs_dual_od, NULL, sizeof(InfoOD1OD2),
-	EFFECT_HEXA_CHORUS, "Hexa-Chorus", do_hexa_chorus, conv_gs_hexa_chorus, NULL, sizeof(InfoHexaChorus),
-	EFFECT_CHORUS, "Chorus", do_chorus, NULL, conv_xg_chorus, sizeof(InfoChorus),
-	EFFECT_FLANGER, "Flanger", do_chorus, NULL, conv_xg_flanger, sizeof(InfoChorus),
-	EFFECT_SYMPHONIC, "Symphonic", do_chorus, NULL, conv_xg_symphonic, sizeof(InfoChorus),
-	EFFECT_CHORUS_EQ3, "3-Band EQ (XG Chorus built-in)", do_eq3, NULL, conv_xg_chorus_eq3, sizeof(InfoEQ3),
-	EFFECT_STEREO_OVERDRIVE, "Stereo Overdrive", do_stereo_od, NULL, conv_xg_overdrive, sizeof(InfoStereoOD),
-	EFFECT_STEREO_DISTORTION, "Stereo Distortion", do_stereo_od, NULL, conv_xg_distortion, sizeof(InfoStereoOD),
-	EFFECT_STEREO_AMP_SIMULATOR, "Amp Simulator", do_stereo_od, NULL, conv_xg_amp_simulator, sizeof(InfoStereoOD),
-	EFFECT_OD_EQ3, "2-Band EQ (XG OD built-in)", do_eq3, NULL, conv_xg_od_eq3, sizeof(InfoEQ3),
-	EFFECT_DELAY_LCR, "Delay L,C,R", do_delay_lcr, NULL, conv_xg_delay_lcr, sizeof(InfoDelayLCR),
-	EFFECT_DELAY_LR, "Delay L,R", do_delay_lr, NULL, conv_xg_delay_lr, sizeof(InfoDelayLR),
-	EFFECT_ECHO, "Echo", do_echo, NULL, conv_xg_echo, sizeof(InfoEcho),
-	EFFECT_CROSS_DELAY, "Cross Delay", do_cross_delay, NULL, conv_xg_cross_delay, sizeof(InfoCrossDelay),
-	EFFECT_DELAY_EQ2, "2-Band EQ (XG Delay built-in)", do_eq2, NULL, conv_xg_delay_eq2, sizeof(InfoEQ2),
-	EFFECT_LOFI, "Lo-Fi", do_lofi, NULL, conv_xg_lofi, sizeof(InfoLoFi),
-	EFFECT_LOFI1, "Lo-Fi 1", do_lofi1, conv_gs_lofi1, NULL, sizeof(InfoLoFi1),
-	EFFECT_LOFI2, "Lo-Fi 2", do_lofi2, conv_gs_lofi2, NULL, sizeof(InfoLoFi2),
-	EFFECT_XG_AUTO_WAH, "Auto Wah", do_xg_auto_wah, NULL, conv_xg_auto_wah, sizeof(InfoXGAutoWah),
-	EFFECT_XG_AUTO_WAH_EQ2, "2-Band EQ (Auto Wah built-in)", do_eq2, NULL, conv_xg_auto_wah_eq2, sizeof(InfoEQ2),
-	EFFECT_XG_AUTO_WAH_OD, "OD (Auto Wah built-in)", do_xg_auto_wah_od, NULL, conv_xg_auto_wah_od, sizeof(InfoXGAutoWahOD),
-	EFFECT_XG_AUTO_WAH_OD_EQ3, "2-Band EQ (Auto Wah OD built-in)", do_eq3, NULL, conv_xg_auto_wah_od_eq3, sizeof(InfoEQ3),
-	-1, "EOF", NULL, NULL, NULL, 0, 
+{	EFFECT_NONE, "None", NULL, NULL, NULL, 0,},
+{	EFFECT_STEREO_EQ, "Stereo-EQ", do_stereo_eq, conv_gs_stereo_eq, NULL, sizeof(InfoStereoEQ),},
+{	EFFECT_EQ2, "2-Band EQ", do_eq2, conv_gs_eq2, conv_xg_eq2, sizeof(InfoEQ2),},
+{	EFFECT_EQ3, "3-Band EQ", do_eq3, NULL, conv_xg_eq3, sizeof(InfoEQ3),},
+{	EFFECT_OVERDRIVE1, "Overdrive", do_overdrive1, conv_gs_overdrive1, NULL, sizeof(InfoOverdrive1),},
+{	EFFECT_DISTORTION1, "Distortion", do_distortion1, conv_gs_overdrive1, NULL, sizeof(InfoOverdrive1),},
+{	EFFECT_OD1OD2, "OD1/OD2", do_dual_od, conv_gs_dual_od, NULL, sizeof(InfoOD1OD2),},
+{	EFFECT_HEXA_CHORUS, "Hexa-Chorus", do_hexa_chorus, conv_gs_hexa_chorus, NULL, sizeof(InfoHexaChorus),},
+{	EFFECT_CHORUS, "Chorus", do_chorus, NULL, conv_xg_chorus, sizeof(InfoChorus),},
+{	EFFECT_FLANGER, "Flanger", do_chorus, NULL, conv_xg_flanger, sizeof(InfoChorus),},
+{	EFFECT_SYMPHONIC, "Symphonic", do_chorus, NULL, conv_xg_symphonic, sizeof(InfoChorus),},
+{	EFFECT_CHORUS_EQ3, "3-Band EQ (XG Chorus built-in)", do_eq3, NULL, conv_xg_chorus_eq3, sizeof(InfoEQ3),},
+{	EFFECT_STEREO_OVERDRIVE, "Stereo Overdrive", do_stereo_od, NULL, conv_xg_overdrive, sizeof(InfoStereoOD),},
+{	EFFECT_STEREO_DISTORTION, "Stereo Distortion", do_stereo_od, NULL, conv_xg_distortion, sizeof(InfoStereoOD),},
+{	EFFECT_STEREO_AMP_SIMULATOR, "Amp Simulator", do_stereo_od, NULL, conv_xg_amp_simulator, sizeof(InfoStereoOD),},
+{	EFFECT_OD_EQ3, "2-Band EQ (XG OD built-in)", do_eq3, NULL, conv_xg_od_eq3, sizeof(InfoEQ3),},
+{	EFFECT_DELAY_LCR, "Delay L,C,R", do_delay_lcr, NULL, conv_xg_delay_lcr, sizeof(InfoDelayLCR),},
+{	EFFECT_DELAY_LR, "Delay L,R", do_delay_lr, NULL, conv_xg_delay_lr, sizeof(InfoDelayLR),},
+{	EFFECT_ECHO, "Echo", do_echo, NULL, conv_xg_echo, sizeof(InfoEcho),},
+{	EFFECT_CROSS_DELAY, "Cross Delay", do_cross_delay, NULL, conv_xg_cross_delay, sizeof(InfoCrossDelay),},
+{	EFFECT_DELAY_EQ2, "2-Band EQ (XG Delay built-in)", do_eq2, NULL, conv_xg_delay_eq2, sizeof(InfoEQ2),},
+{	EFFECT_LOFI, "Lo-Fi", do_lofi, NULL, conv_xg_lofi, sizeof(InfoLoFi),},
+{	EFFECT_LOFI1, "Lo-Fi 1", do_lofi1, conv_gs_lofi1, NULL, sizeof(InfoLoFi1),},
+{	EFFECT_LOFI2, "Lo-Fi 2", do_lofi2, conv_gs_lofi2, NULL, sizeof(InfoLoFi2),},
+{	EFFECT_XG_AUTO_WAH, "Auto Wah", do_xg_auto_wah, NULL, conv_xg_auto_wah, sizeof(InfoXGAutoWah),},
+{	EFFECT_XG_AUTO_WAH_EQ2, "2-Band EQ (Auto Wah built-in)", do_eq2, NULL, conv_xg_auto_wah_eq2, sizeof(InfoEQ2),},
+{	EFFECT_XG_AUTO_WAH_OD, "OD (Auto Wah built-in)", do_xg_auto_wah_od, NULL, conv_xg_auto_wah_od, sizeof(InfoXGAutoWahOD),},
+{	EFFECT_XG_AUTO_WAH_OD_EQ3, "2-Band EQ (Auto Wah OD built-in)", do_eq3, NULL, conv_xg_auto_wah_od_eq3, sizeof(InfoEQ3),},
+{	-1, "EOF", NULL, NULL, NULL, 0, },
 };
 
 struct effect_parameter_xg_t effect_parameter_xg[] = {
-	0, 0, "NO EFFECT", 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,
-	0x05, 0, "DELAY L,C,R", 0x1A, 0x0D, 0x27, 0x27, 0, 0, 0, 0, 0, 0,
-	0x05, 0x03, 0x08, 0x08, 74, 100, 10, 0, 0, 32, 0, 0, 28, 64, 46, 64, 9,
-	0x06, 0, "DELAY L,R", 0x13, 0x1D, 0x1D, 0x1D, 0, 0, 0, 0, 0, 0,
-	0x44, 0x26, 0x28, 0x26, 87, 10, 0, 0, 0, 32, 0, 0, 28, 64, 46, 64, 9,
-	0x07, 0, "ECHO", 0x0D, 0, 0x0D, 0, 0, 0x0D, 0x0D, 0, 0, 0,
-	0x24, 80, 0x74, 80, 10, 0x24, 0x74, 0, 0, 40, 0, 0, 28, 64, 46, 64, 9,
-	0x08, 0, "CROSS DELAY", 0x0D, 0x0D, 0, 0, 0, 0, 0, 0, 0, 0,
-	0x24, 0x56, 111, 1, 10, 0, 0, 0, 0, 32, 0, 0, 28, 64, 46, 64, 9,
-	0x41, 0, "CHORUS 1", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	6, 54, 77, 106, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0, 9,
-	0x41, 0x01, "CHORUS 2", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	8, 63, 64, 30, 0, 28, 62, 42, 58, 64, 46, 64, 10, 0, 0, 0, 9,
-	0x41, 0x02, "CHORUS 3", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	4, 44, 64, 110, 0, 28, 64, 46, 66, 64, 46, 64, 10, 0, 0, 0, 9,
-	0x41, 0x03, "GM CHORUS 1", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	9, 10, 64, 109, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0, 9,
-	0x41, 0x04, "GM CHORUS 2", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	28, 34, 67, 105, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0, 9,
-	0x41, 0x05, "GM CHORUS 3", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	9, 34, 69, 105, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0, 9,
-	0x41, 0x06, "GM CHORUS 4", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	26, 29, 75, 102, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0, 9,
-	0x41, 0x07, "FB CHORUS", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	6, 43, 107, 111, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0, 9,
-	0x41, 0x08, "CHORUS 4", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	9, 32, 69, 104, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 1, 0, 9,
-	0x42, 0, "CELESTE 1", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	12, 32, 64, 0, 0, 28, 64, 46, 64, 127, 40, 68, 10, 0, 0, 0, 9,
-	0x42, 0x01, "CELESTE 2", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	28, 18, 90, 2, 0, 28, 62, 42, 60, 84, 40, 68, 10, 0, 0, 0, 9,
-	0x42, 0x02, "CELESTE 3", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	4, 63, 44, 2, 0, 28, 64, 46, 68, 127, 40, 68, 10, 0, 0, 0, 9,
-	0x42, 0x08, "CELESTE 4", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	8, 29, 64, 0, 0, 28, 64, 51, 66, 127, 40, 68, 10, 0, 1, 0, 9,
-	0x43, 0, "FLANGER 1", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	14, 14, 104, 2, 0, 28, 64, 46, 64, 96, 40, 64, 10, 4, 0, 0, 9, 
-	0x43, 0x01, "FLANGER 2", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	32, 17, 26, 2, 0, 28, 64, 46, 60, 96, 40, 64, 10, 4, 0, 0, 9, 
-	0x43, 0x07, "GM FLANGER", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	3, 21, 120, 1, 0, 28, 64, 46, 64, 96, 40, 64, 10, 4, 0, 0, 9, 
-	0x43, 0x08, "FLANGER 3", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	4, 109, 109, 2, 0, 28, 64, 46, 64, 127, 40, 64, 10, 4, 0, 0, 9, 
-	0x44, 0, "SYMPHONIC", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	12, 25, 16, 0, 0, 28, 64, 46, 64, 127, 46, 64, 10, 0, 0, 0, 9,
-	0x49, 0, "DISTORTION", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	40, 20, 72, 53, 48, 0, 43, 74, 10, 127, 120, 0, 0, 0, 0, 0, 0, 
-	0x49, 0x08, "STEREO DISTORTION", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	18, 27, 71, 48, 84, 0, 32, 66, 10, 127, 105, 0, 0, 0, 0, 0, 0, 
-	0x4A, 0, "OVERDRIVE", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	29, 24, 68, 45, 55, 0, 41, 72, 10, 127, 104, 0, 0, 0, 0, 0, 0, 
-	0x4A, 0x08, "STEREO OVERDRIVE", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	10, 24, 69, 46, 105, 0, 41, 66, 10, 127, 104, 0, 0, 0, 0, 0, 0, 
-	0x4B, 0, "AMP SIMULATOR", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	39, 1, 48, 55, 0, 0, 0, 0, 0, 127, 112, 0, 0, 0, 0, 0, 0, 
-	0x4B, 0x08, "STEREO AMP SIMULATOR", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	16, 2, 46, 119, 0, 0, 0, 0, 0, 127, 106, 0, 0, 0, 0, 0, 0, 
-	0x4C, 0, "3-BAND EQ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	70, 34, 60, 10, 70, 28, 46, 0, 0, 127, 0, 0, 0, 0, 0, 0, -1, 
-	0x4D, 0, "2-BAND EQ", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	28, 70, 46, 70, 0, 0, 0, 0, 0, 127, 0, 0, 0, 0, 0, 0, -1, 
-	0x4E, 0, "AUTO WAH", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	70, 56, 39, 25, 0, 28, 66, 46, 64, 127, 0, 0, 0, 0, 0, 0, 2, 
-	0x4E, 0x01, "AUTO WAH+DISTORTION", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	40, 73, 26, 29, 0, 28, 66, 46, 64, 127, 30, 72, 74, 53, 48, 0, 2, 
-	0x4E, 0x02, "AUTO WAH+OVERDRIVE", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	48, 64, 32, 23, 0, 28, 66, 46, 64, 127, 29, 68, 72, 45, 55, 0, 2, 
-	0x5E, 0, "LO-FI", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	2, 60, 6, 54, 5, 10, 1, 1, 0, 127, 0, 0, 0, 0, 1, 0, 9, 
-	-1, -1, "EOF", 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, "NO EFFECT",
+	{ 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, },
+
+{	0x05, 0, "DELAY L,C,R", { 0x1A, 0x0D, 0x27, 0x27, 0, 0, 0, 0, 0, 0,},{
+	0x05, 0x03, 0x08, 0x08, 74, 100, 10, 0, 0, 32, 0, 0, 28, 64, 46, 64,}, 9,},
+
+{	0x06, 0, "DELAY L,R", { 0x13, 0x1D, 0x1D, 0x1D, 0, 0, 0, 0, 0, 0,},{
+	0x44, 0x26, 0x28, 0x26, 87, 10, 0, 0, 0, 32, 0, 0, 28, 64, 46, 64, },9,},
+
+{	0x07, 0, "ECHO", { 0x0D, 0, 0x0D, 0, 0, 0x0D, 0x0D, 0, 0, 0,},{
+	0x24, 80, 0x74, 80, 10, 0x24, 0x74, 0, 0, 40, 0, 0, 28, 64, 46, 64,}, 9,},
+
+{	0x08, 0, "CROSS DELAY", { 0x0D, 0x0D, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	0x24, 0x56, 111, 1, 10, 0, 0, 0, 0, 32, 0, 0, 28, 64, 46, 64,}, 9,},
+
+{	0x41, 0, "CHORUS 1", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	6, 54, 77, 106, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0,}, 9,},
+
+{	0x41, 0x01, "CHORUS 2",{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	8, 63, 64, 30, 0, 28, 62, 42, 58, 64, 46, 64, 10, 0, 0, 0,}, 9,},
+
+{	0x41, 0x02, "CHORUS 3",{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	4, 44, 64, 110, 0, 28, 64, 46, 66, 64, 46, 64, 10, 0, 0, 0,}, 9,},
+
+{	0x41, 0x03, "GM CHORUS 1",{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	9, 10, 64, 109, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0,}, 9,},
+
+{	0x41, 0x04, "GM CHORUS 2", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	28, 34, 67, 105, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0,}, 9,},
+
+{	0x41, 0x05, "GM CHORUS 3", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	9, 34, 69, 105, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0,}, 9,},
+
+{	0x41, 0x06, "GM CHORUS 4", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	26, 29, 75, 102, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0,}, 9,},
+
+{	0x41, 0x07, "FB CHORUS", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	6, 43, 107, 111, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 0, 0,}, 9,},
+
+{	0x41, 0x08, "CHORUS 4", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	9, 32, 69, 104, 0, 28, 64, 46, 64, 64, 46, 64, 10, 0, 1, 0,}, 9,},
+
+{	0x42, 0, "CELESTE 1", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	12, 32, 64, 0, 0, 28, 64, 46, 64, 127, 40, 68, 10, 0, 0, 0,}, 9,},
+
+{	0x42, 0x01, "CELESTE 2", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	28, 18, 90, 2, 0, 28, 62, 42, 60, 84, 40, 68, 10, 0, 0, 0,}, 9,},
+
+{	0x42, 0x02, "CELESTE 3", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	4, 63, 44, 2, 0, 28, 64, 46, 68, 127, 40, 68, 10, 0, 0,0,}, 9,},
+
+{	0x42, 0x08, "CELESTE 4", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	8, 29, 64, 0, 0, 28, 64, 51, 66, 127, 40, 68, 10, 0, 1, 0,}, 9,},
+
+{	0x43, 0, "FLANGER 1", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	14, 14, 104, 2, 0, 28, 64, 46, 64, 96, 40, 64, 10, 4, 0, 0,}, 9, },
+
+{	0x43, 0x01, "FLANGER 2", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	32, 17, 26, 2, 0, 28, 64, 46, 60, 96, 40, 64, 10, 4, 0, 0,}, 9, },
+
+{	0x43, 0x07, "GM FLANGER", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	3, 21, 120, 1, 0, 28, 64, 46, 64, 96, 40, 64, 10, 4, 0, 0,}, 9, },
+
+{	0x43, 0x08, "FLANGER 3", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	4, 109, 109, 2, 0, 28, 64, 46, 64, 127, 40, 64, 10, 4, 0, 0,}, 9, },
+
+{	0x44, 0, "SYMPHONIC", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	12, 25, 16, 0, 0, 28, 64, 46, 64, 127, 46, 64, 10, 0, 0, 0,}, 9,},
+
+{	0x49, 0, "DISTORTION", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	40, 20, 72, 53, 48, 0, 43, 74, 10, 127, 120, 0, 0, 0, 0,0,}, 0,}, 
+
+{	0x49, 0x08, "STEREO DISTORTION", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	18, 27, 71, 48, 84, 0, 32, 66, 10, 127, 105, 0, 0, 0, 0, 0,}, 0,}, 
+
+{	0x4A, 0, "OVERDRIVE", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	29, 24, 68, 45, 55, 0, 41, 72, 10, 127, 104, 0, 0, 0, 0, 0,}, 0,}, 
+
+{	0x4A, 0x08, "STEREO OVERDRIVE", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	10, 24, 69, 46, 105, 0, 41, 66, 10, 127, 104, 0, 0, 0, 0, 0,}, 0,}, 
+
+{	0x4B, 0, "AMP SIMULATOR", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	39, 1, 48, 55, 0, 0, 0, 0, 0, 127, 112, 0, 0, 0, 0, 0,}, 0,}, 
+
+{	0x4B, 0x08, "STEREO AMP SIMULATOR", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	16, 2, 46, 119, 0, 0, 0, 0, 0, 127, 106, 0, 0, 0, 0, 0,}, 0,}, 
+
+{	0x4C, 0, "3-BAND EQ", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	70, 34, 60, 10, 70, 28, 46, 0, 0, 127, 0, 0, 0, 0, 0, 0,}, -1,}, 
+
+{	0x4D, 0, "2-BAND EQ", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	28, 70, 46, 70, 0, 0, 0, 0, 0, 127, 0, 0, 0, 0, 0, 0,}, -1,}, 
+
+{	0x4E, 0, "AUTO WAH", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	70, 56, 39, 25, 0, 28, 66, 46, 64, 127, 0, 0, 0, 0, 0, 0,}, 2, },
+
+{	0x4E, 0x01, "AUTO WAH+DISTORTION", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	40, 73, 26, 29, 0, 28, 66, 46, 64, 127, 30, 72, 74, 53, 48, 0,}, 2, },
+
+{	0x4E, 0x02, "AUTO WAH+OVERDRIVE", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	48, 64, 32, 23, 0, 28, 66, 46, 64, 127, 29, 68, 72, 45, 55, 0,}, 2, },
+
+{	0x5E, 0, "LO-FI",{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},{
+	2, 60, 6, 54, 5, 10, 1, 1, 0, 127, 0, 0, 0, 0, 1, 0,}, 9, },
+
+{	-1, -1, "EOF",{ 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,},
 };
 
 struct effect_parameter_gs_t effect_parameter_gs[] = {
-	0, 0, "None", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0x01, 0x00, "Stereo-EQ", 1, 0x45, 1, 0x34, 0x48, 0, 0x48, 0x38, 0, 0x48,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 19, -1,
-	0x01, 0x10, "Overdrive", 48, 1, 1, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0x40, 0x40, 0x40, 96, 0, 18,
-	0x01, 0x11, "Distrotion", 76, 3, 1, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0x40, 0x38, 0x40, 84, 0, 18, 
-	0x11, 0x03, "OD1/OD2", 0, 48, 1, 1, 0, 1, 76, 3, 1, 0,
-	0, 0, 0, 0, 0, 0x40, 96, 0x40, 84, 127, 1, 6, 
-	0x01, 0x40, "Hexa Chorus", 0x18, 0x08, 127, 5, 66, 16, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0x40, 0x40, 64, 112, 1, 15, 
-	0x01, 0x72, "Lo-Fi 1", 2, 6, 2, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 127, 0x40, 0x40, 64, 127, 15, 18, 
-	0x01, 0x73, "Lo-Fi 2", 2, 1, 0x20, 0, 64, 1, 127, 0, 0, 127,
-	0, 0, 127, 0, 1, 127, 0x40, 0x40, 64, 127, 3, 15, 
-	-1, -1, "EOF", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+{	0, 0, "None", { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, 0, 0,},
+{	0x01, 0x00, "Stereo-EQ", { 1, 0x45, 1, 0x34, 0x48, 0, 0x48, 0x38, 0, 0x48,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 127,}, 19, -1,},
+{	0x01, 0x10, "Overdrive",{  48, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0x40, 0x40, 0x40, 96,}, 0, 18,},
+{	0x01, 0x11, "Distrotion",{  76, 3, 1, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0x40, 0x38, 0x40, 84,}, 0, 18, },
+{	0x11, 0x03, "OD1/OD2",{  0, 48, 1, 1, 0, 1, 76, 3, 1, 0,
+	0, 0, 0, 0, 0, 0x40, 96, 0x40, 84, 127,}, 1, 6, },
+{	0x01, 0x40, "Hexa Chorus",{  0x18, 0x08, 127, 5, 66, 16, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0x40, 0x40, 64, 112,}, 1, 15, },
+{	0x01, 0x72, "Lo-Fi 1",{  2, 6, 2, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 127, 0x40, 0x40, 64, 127,}, 15, 18, },
+{	0x01, 0x73, "Lo-Fi 2",{  2, 1, 0x20, 0, 64, 1, 127, 0, 0, 127,
+	0, 0, 127, 0, 1, 127, 0x40, 0x40, 64, 127,}, 3, 15, },
+{	-1, -1, "EOF",{  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, 0, 0,},
 };
diff --git a/timidity/smplfile.c b/timidity/smplfile.c
index f24413b..cab2727 100755
--- a/timidity/smplfile.c
+++ b/timidity/smplfile.c
@@ -318,11 +318,11 @@ static int import_wave_load(char *sample_file, Instrument *inst)
 	struct timidity_file	*tf;
 	char			buf[12];
 	int				state;		/* initial > fmt_read > data_read */
-	int				i, chunk_size, type_index, type_size, samples;
+	int				i, chunk_size, type_index, type_size, samples = 0;
 	int32			chunk_flags;
 	Sample			*sample;
-	WAVFormatChunk	format;
-	WAVSamplerChunk	samplerc;
+	WAVFormatChunk	format = {0,};
+	WAVSamplerChunk	samplerc = {0,};
 	GeneralInstrumentInfo	instc;
 	
 	if ((tf = open_file(sample_file, 1, OF_NORMAL)) == NULL)
@@ -400,7 +400,7 @@ static int import_wave_load(char *sample_file, Instrument *inst)
 	{
 		uint8		modes;
 		int32		sample_rate, root_freq;
-		uint32		loopStart, loopEnd;
+		uint32		loopStart = 0, loopEnd = 0;
 		
 		sample_rate = samplerc.dwSamplePeriod == 0 ? 0 : 1000000000 / samplerc.dwSamplePeriod;
 		root_freq = freq_table[samplerc.dwMIDIUnityNote];
@@ -605,7 +605,7 @@ static int import_aiff_load(char *sample_file, Instrument *inst)
 	AIFFCommonChunk	common;
 	AIFFSoundDataChunk	sound;
 	GeneralInstrumentInfo	inst_info;
-	AIFFLoopInfo	loop_info;
+	AIFFLoopInfo	loop_info = {0,0,0};
 	AIFFMarkerData	*marker_data;
 	
 	if ((tf = open_file(sample_file, 1, OF_NORMAL)) == NULL)
diff --git a/timidity/speex_a.c b/timidity/speex_a.c
index 93627cf..d8b0dd1 100644
--- a/timidity/speex_a.c
+++ b/timidity/speex_a.c
@@ -94,7 +94,7 @@ typedef struct {
   /* Speex */
   SpeexHeader      header;
   SpeexBits        bits;
-  SpeexMode*       mode;
+  const SpeexMode* mode;
   void*            state;
   int              frame_size;
   int              nframes;
@@ -475,7 +475,7 @@ static int output_data(char *buf, int32 nbytes)
   Speex_ctx *ctx = speex_ctx;
   int nbBytes;
   int16 *s;
-  int i, j;
+  int i;
   int ret;
   int nbytes_left;
 
@@ -626,8 +626,7 @@ static void close_output(void)
     free(speex_ctx->input);
 
     ctl->cmsg(CMSG_INFO, VERB_NORMAL, "Wrote %lu/%lu bytes(%g%% compressed)",
-	      ctx->out_bytes, ctx->in_bytes, ((double)ctx->out_bytes / (double)ctx->in_bytes)) * 100.;
-
+	      ctx->out_bytes, ctx->in_bytes, ((double)ctx->out_bytes / (double)ctx->in_bytes) * 100.0);
 
     speex_ctx->input = NULL;
     free(speex_ctx);
diff --git a/timidity/timidity.c b/timidity/timidity.c
index 51a749f..57f8fd1 100644
--- a/timidity/timidity.c
+++ b/timidity/timidity.c
@@ -2701,16 +2701,16 @@ MAIN_INTERFACE int set_tim_opt_short(int c, char *optarg)
 	return 0;
 }
 
+#ifdef __W32__
 MAIN_INTERFACE int set_tim_opt_short_cfg(int c, char *optarg)
 {
-	int err = 0;
-	
 	switch (c) {
 	case 'c':
 		return parse_opt_c(optarg);
 	}
 	return 0;
 }
+#endif
 
 /* -------- getopt_long -------- */
 MAIN_INTERFACE int set_tim_opt_long(int c, char *optarg, int index)
@@ -2950,6 +2950,7 @@ MAIN_INTERFACE int set_tim_opt_long(int c, char *optarg, int index)
 	}
 }
 
+#ifdef __W32__
 MAIN_INTERFACE int set_tim_opt_long_cfg(int c, char *optarg, int index)
 {
 	const struct option *the_option = &(longopts[index]);
@@ -2968,6 +2969,7 @@ MAIN_INTERFACE int set_tim_opt_long_cfg(int c, char *optarg, int index)
 		return parse_opt_c(arg);
 	}
 }
+#endif
 
 static inline int parse_opt_A(const char *arg)
 {
@@ -3918,7 +3920,7 @@ static int parse_opt_h(const char *arg)
 			if (*(strchr(h, '%') + 1) != '%')
 				fprintf(fp, h, help_args[j++]);
 			else
-				fprintf(fp, h);
+				fprintf(fp, "%s", h);
 		} else
 			fputs(h, fp);
 		fputs(NLS, fp);
@@ -4099,7 +4101,7 @@ static inline void list_dyna_interface(FILE *fp, char *path, char *mark)
 {
     URL dir;
     char fname[NAME_MAX];
-    int cwd;
+    int cwd, dummy;
 	if ((dir = url_dir_open(path)) == NULL)
 		return;
 	cwd = open(".", 0);
@@ -4108,17 +4110,17 @@ static inline void list_dyna_interface(FILE *fp, char *path, char *mark)
 	while (url_gets(dir, fname, sizeof(fname)) != NULL)
 		if (strncmp(fname, "if_", 3) == 0) {
 			void* handle = NULL;
-			if(handle = dl_load_file(fname)) {
+			if((handle = dl_load_file(fname))) {
 				ControlMode *(* loader)(void);
 				char c = CHAR_MAX;
 				loader = NULL;
 				do {
 					char buf[20]; /* enough */
-					if(mark[c]) continue;
+					if(mark[(int)c]) continue;
 					sprintf(buf, "interface_%c_loader", c);
-					if(loader = dl_find_symbol(handle, buf)) {
+					if((loader = dl_find_symbol(handle, buf))) {
 						fprintf(fp, "  -i%c          %s" NLS, c, loader()->id_name);
-						mark[c] = 1;
+						mark[(int)c] = 1;
 						goto cleanup;
 					}
 				} while (--c != CHAR_MAX); /* round-trip detection */
@@ -4126,17 +4128,17 @@ static inline void list_dyna_interface(FILE *fp, char *path, char *mark)
 				dl_free(handle);
 			}
 		}
-	fchdir(cwd);
-	close(cwd);
+	dummy = fchdir(cwd);
+	dummy += close(cwd);
 	url_close(dir);
 }
 
 ControlMode *dynamic_interface_module(int id_char)
 {
 	URL url;
-	char fname[BUFSIZ], name[16], *info;
+	char fname[BUFSIZ];
 	ControlMode *ctl = NULL;
-	int cwd;
+	int cwd, dummy;
 	void *handle;
 	ControlMode *(* inferface_loader)(void);
 
@@ -4161,8 +4163,8 @@ ControlMode *dynamic_interface_module(int id_char)
 				break;
 		}
 	}
-	fchdir(cwd);
-	close(cwd);
+	dummy = fchdir(cwd);
+	dummy += close(cwd);
 	url_close(url);
 	return ctl;
 }
@@ -4171,9 +4173,8 @@ ControlMode *dynamic_interface_module(int id_char)
 static inline int parse_opt_i(const char *arg)
 {
 	/* interface mode */
-	ControlMode *cmp, **cmpp, *cmp2, **cmpp2;
+	ControlMode *cmp, **cmpp;
 	int found = 0;
-	char name[16] = "\0";
 	
 	for (cmpp = ctl_list; (cmp = *cmpp) != NULL; cmpp++) {
 		if (cmp->id_character == *arg) {
@@ -5145,16 +5146,17 @@ static void interesting_message(void)
 static RETSIGTYPE sigterm_exit(int sig)
 {
     char s[4];
+    ssize_t dummy;
 
     /* NOTE: Here, fprintf is dangerous because it is not re-enterance
      * function.  It is possible coredump if the signal is called in printf's.
      */
 
-    write(2, "Terminated sig=0x", 17);
+    dummy = write(2, "Terminated sig=0x", 17);
     s[0] = "0123456789abcdef"[(sig >> 4) & 0xf];
     s[1] = "0123456789abcdef"[sig & 0xf];
     s[2] = '\n';
-    write(2, s, 3);
+    dummy += write(2, s, 3);
 
     safe_exit(1);
 }
@@ -5765,7 +5767,7 @@ int main(int argc, char **argv)
 	int c, err, i;
 	int nfiles;
 	char **files;
-	char *files_nbuf;
+	char *files_nbuf = NULL;
 	int main_ret;
 	int longind;
 #if defined(DANGEROUS_RENICE) && !defined(__W32__) && !defined(main)
@@ -5818,7 +5820,7 @@ int main(int argc, char **argv)
 	dl_init(argc, argv);
 }
 #endif /* IA_DYNAMIC */
-	if (program_name = pathsep_strrchr(argv[0]))
+	if ((program_name = pathsep_strrchr(argv[0])))
 		program_name++;
 	else
 		program_name = argv[0];
diff --git a/utils/net.c b/utils/net.c
index ddef895..8bcc3af 100644
--- a/utils/net.c
+++ b/utils/net.c
@@ -69,7 +69,7 @@ extern FREEADDRINFO ws2_freeaddrinfo;
 
 SOCKET open_socket(char *host, unsigned short port)
 {
-    SOCKET fd;
+    SOCKET fd = -1;
     struct addrinfo hints, *result, *rp;
     char service[NI_MAXSERV];
     int s;
diff --git a/utils/nkflib.c b/utils/nkflib.c
index 34f2d01..d5c8ba3 100644
--- a/utils/nkflib.c
+++ b/utils/nkflib.c
@@ -306,7 +306,9 @@ extern POINT _BufferSize;
 
 /*      function prototype  */
 
+#if 0
 static  int     noconvert(SFILE *f);
+#endif
 static  int     kanji_convert(SFILE *f);
 static  int     h_conv(SFILE *f,int c2,int c1);
 static  int     push_hold_buf(int c2,int c1);
@@ -319,16 +321,22 @@ static  int     pre_convert(int c1,int c2);
 static  int     mime_begin(SFILE *f);
 static  int     mime_getc(SFILE *f);
 static  int     mime_ungetc(unsigned int c);
+#ifdef STRICT_MIME
 static  int     mime_integrity(SFILE *f,unsigned char *p);
+#endif
 static  int     base64decode(int c);
+#if 0
 static  int     usage(void);
 static  void    arguments(char *c);
+#endif
 static  void    reinit();
 
 /* buffers */
 
+#if 0
 static char            stdibuf[IOBUF_SIZE];
 static char            stdobuf[IOBUF_SIZE];
+#endif
 static unsigned char   hold_buf[HOLD_SIZE*2];
 static int             hold_count;
 
@@ -340,7 +348,9 @@ static int             hold_count;
 static unsigned char           mime_buf[MIME_BUF_SIZE];
 static unsigned int            mime_top = 0;
 static unsigned int            mime_last = 0;  /* decoded */
+#ifdef STRICT_MIME
 static unsigned int            mime_input = 0; /* undecoded */
+#endif
 
 /* flags */
 static int             unbuf_f = FALSE;
@@ -853,7 +863,6 @@ static void fix_euc_code(unsigned char *s, int len)
 static int             file_out = FALSE;
 static int             add_cr = FALSE;
 static int             del_cr = FALSE;
-static int             end_check;
 
 #if 0
 #ifndef PERL_XS
@@ -962,6 +971,7 @@ main(argc, argv)
 }
 #endif
 
+#if 0
 void
 arguments(char *cp) 
 {
@@ -1095,7 +1105,9 @@ arguments(char *cp)
     }
 }
 #endif
+#endif
 
+#if 0
 int
 noconvert(f)
     SFILE  *f;
@@ -1106,9 +1118,7 @@ noconvert(f)
       sputchar(c);
     return 1;
 }
-
-
-
+#endif
 
 int
 kanji_convert(SFILE  *f)
-- 
1.7.7.3

>From af4798c1752d7a867ed370b6e2731c785e5909cf Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 17 Nov 2011 20:49:42 +0100
Subject: [PATCH 11/17] Make shebang paths /usr/bin/foo rather then
 /usr/local/bin/foo

This makes life easier for packagers, people who want to use non standard
paths will need to fix this up themselves...

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 interface/timidity.el   |    2 +-
 interface/tkmidity.ptcl |    2 +-
 interface/tkpanel.tcl   |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/interface/timidity.el b/interface/timidity.el
index f03ba25..31abeff 100644
--- a/interface/timidity.el
+++ b/interface/timidity.el
@@ -35,7 +35,7 @@
 
 ;; Configuration parameters.
 ; Absolute path of timidity.
-(defvar timidity-prog-path "/usr/local/bin/timidity")
+(defvar timidity-prog-path "/usr/bin/timidity")
 
 ; String list for timidity program options.
 (defvar timidity-default-options nil)
diff --git a/interface/tkmidity.ptcl b/interface/tkmidity.ptcl
index caf5e0a..7168bc4 100755
--- a/interface/tkmidity.ptcl
+++ b/interface/tkmidity.ptcl
@@ -1,4 +1,4 @@
-#!/usr/local/bin/wishx -f
+#!/usr/bin/wish -f
 #
 # TiMidity++ -- MIDI to WAVE converter and player
 # Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
diff --git a/interface/tkpanel.tcl b/interface/tkpanel.tcl
index 0a392b1..e826c54 100755
--- a/interface/tkpanel.tcl
+++ b/interface/tkpanel.tcl
@@ -1,4 +1,4 @@
-#!/usr/local/bin/wishx -f
+#!/usr/bin/wish -f
 #
 # TiMidity++ -- MIDI to WAVE converter and player
 # Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
-- 
1.7.7.3

>From 524dc6b96f467dcee0e6b4467c4388dfe0f6ba2e Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 19 Nov 2011 11:10:40 +0100
Subject: [PATCH 13/17] rename INSTALL INSTALL.en

To get it out of the way for autoreconf.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 INSTALL    |  631 ------------------------------------------------------------
 INSTALL.en |  631 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 631 insertions(+), 631 deletions(-)
 delete mode 100644 INSTALL
 create mode 100644 INSTALL.en

diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 7937bc8..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,631 +0,0 @@
-======================================================================
-	TiMidity++ Installation guide
-
-					Masanao Izumo
-					<iz@onicos.co.jp>
-					Mar.01.2004
-					version 2.13.0 or later
-======================================================================
-
-This document describes how to install TiMidity++ for your UNIX-like
-machine.
-
-You can configure and make timidity.exe on the Cygwin environment of
-Windows 95/98/Me/NT/2000/XP/2003.  If you are in Windows, install
-Cygwin (or mingw) if you do not have them.
-
-Today's Macintosh has FreeBSD userland, so things described here would
-fly.  Methods for older Macintosh ("Classic") are not described here.
-
-======================================================================
-Basic Installation
-======================================================================
-
-TiMidity++ uses GNU autotools to build.  So the simplest way to
-compile this package is:
-
-1. "cd" to the directory containing TiMidity++'s source code and type
-   "./configure" to configure the package for your system.  If you are
-   using csh on an old version of System V, you might need to type
-   "/bin/sh configure" instead to prevent csh from trying to execute
-   configure itself.  Running configure takes a while.  While running,
-   it prints some messages telling which features it is checking for.
-2. Type "make" to compile the package.
-   NOTE: this make method requires GNU make.  So if your system has it
-         as gamke, type "gmake" instead.
-3. Type "make install" to install the programs and any data files and
-   documentation.
-
-======================================================================
-More complecated way
-======================================================================
-
-The full installation process is:
-
-1. configre
-2. edit common.makefile, Makefile, timidity.h if necessery
-3. make
-4. installation
-5. set up voice data
-
-Each processes are explained in following sections.  Note that % is
-the shell prompt.
-
-======================================================================
-Configure
-======================================================================
-
-First, execute the following command:
-
-% /bin/sh configure --help
-
-Many options of configure will be displayed.  Most of them, such as
---help, --prefix=PREFIX, and so on are the regular ones.  They exisits
-on most package that uses autoconf and you do not have to worry about
-their behavior.
-
-There also exists some options that is typical to TiMidity++.  Main of
-these are the following:
-
---enable-debug
-  Enables debug.  Things will be compiled with debugging methods/
-  informations.
-
---without-x
-  TiMidity++ uses X by default.  So you must specify this option to
-  prevent linker from linking X libraries.
-
---enable-audio[=audio_list]
-  Enables TiMidity++ to play MIDI files.  If --enable-audio=no,
-  TiMidity++ acts as a MIDI-to-WAVE converter.
-
-  You can specify one or more audio-device listed below.
-
-  * default: Automatically select audio device.
-  * oss: OSS /dev/dsp
-  * sun: SunOS /dev/audio
-  * hpux: hp-ux /dev/audio
-  * irix: IRIX audio library
-  * mme: OSF/1 MME
-  * sb_dsp: BSD/OS 2.0 /dev/sb_dsp
-  * w32: Windows MMS
-  * darwin: darwin(Mac OS X)'s CoreAudio frameowrk
-  * alsa: ALSA pcm device
-  * alib: hp-ux network audio (Alib)
-  * nas: NAS
-  * portaudio: PortAudio
-  * jack: JACK
-  * arts: aRts
-  * esd: EsounD
-  * vorbis: ogg vorbis
-  * gogo: mp3 Gogo-No-Coder (Windows only)
-
---enable-interface[=interface_list]
---enable-dynamic[=interface_list]
-  Specify which interface to use.  If you use --enable-dynamic instead
-  of --enable-interface, the interfaces specified will be linked
-  dynamically and the binary size would become a bit smaller.
-
-  You can select one or more interfaces listed below.
-
-  * ncurses: ncurses interface.
-  * slang: S-Lang interface.
-  * motif: Motif interface.  Motif interface also works under Lestiff.
-  * tcltk: Tcl/Tk interface.
-  * emacs: Emacs front-end.  Type M-x timidity to invoke.
-  * vt100: The full-screen interface using vt100 terminal control codes.
-  * xaw: X Athena Widget interface.
-  * xskin: X skin interface.
-  * gtk: GTK+ interface.
-  * w32gui: Build as Windows GUI binary.
-  * winsyn: Build as TiMidity++ Windows Synthesizer server.
-  * alsaseq: Build as ALSA sequencer client.
-
-  Note that
-  --enable-interface=INTERFACE1,INTERFACE2,...
-  equals as
-  --enable-INTERFACE1=yes --enable-INTERFACE2=yes ...
-  and for the same way,
-  --enable-dynamic=INTERFACE1,INTERFACE2,...
-  equals as
-  --enable-INTERFACE1=dynamic --enable-INTERFACE2=dynamic ...
-
---enable-network
-  Enables network support.  This will allow TiMidity++ to open a MIDI
-  file via network.  You can specify the location of MIDI files by
-  http://foo.com.tw/bar/baz.mid - like format.
-
---enable-spectrogram
-  With this option specified, TiMidity++ can open a window on X and
-  show sound-spectrogram there.
-
---enable-wrd
-  WRD is a Japanese local lyric-contents format.  This option enables
-  WRD interface.
-
-* Environment variables and flags to pass to configure
-
-Some MIDI files eat too much CPU power.  If you choose correct
-optimizing method, TiMidity++ can play such MIDI files smoothly.
-
-You can tell configure which optimizing method to use by following
-environmental variables:
-
-CC
-  the C compiler command e.g. "/usr/bin/gcc"
-
-CFLAGS
-  flags to pass to ${CC} e.g. "-O2 -pipe"
-
-LDFLAGS
-  flags to pass to linker e.g. "-L/usr/gnu/lib"
-
-CPPFLAGS
-  flags to pass to preprocessor e.g. "-traditional-cpp"
-
-Your compiler may have many optimization flags.  For example, in case
-of ultrasparc/gcc, you can specify:
-
-% env CFLAGS='-O3 -Wall -mv8 -funroll-all-loops -fomit-frame-pointer \
-	-mcpu=ultrasparc' /bin/sh configure [configure-options]...
-
-and the binary will (hopefully) run faster.
-
-======================================================================
-Edit some files
-======================================================================
-
-If make fails, or if you want to change some parameters, edit
-common.makefile, Makefile, or timidity.h manually.
-
-* Parameters in timidity.h
-
-There are some options that are hard-coded into timidity binary.  They
-are # define-ed in timidity.h.  You have to change things there if you
-want to change these flags.
-
-** CONFIG_FILE
-
-Edit CONFIG_FILE to your convenience.  By default,
-
-#define CONFIG_FILE DEFAULT_PATH "/timidity.cfg"
-
-are recommended.  DEFAULT_PATH is the same as TIMID_DIR in Makefile.
-
-If you want to place it to another path, specify as the following:
-
-#define CONFIG_FILE "/etc/timidity.cfg"
-
-** DECOMPRESSOR_LIST
-
-The file extractor (please ignore in Windows).  By default:
-
-#define DECOMPRESSOR_LIST { \
-		".gz", "gunzip -c %s", \
-		".bz2", "bunzip2 -c %s", \
-		".Z", "zcat %s", \
-		".zip", "unzip -p %s", \
-		".lha", "lha -pq %s", \
-		".lzh", "lha -pq %s", \
-		".shn", "shorten -x %s -", \
-		0 }
-
-TiMidity++ can handle some of archive format directly.  But other
-format will use this extractor.
-
-** PATCH_CONVERTERS
-
-Configuration of of patch file converter (please ignore in Windows).
-By default:
-
-#define PATCH_CONVERTERS { \
-		".wav", "wav2pat %s", \
-		0 }
-
-** PATCH_EXT_LIST
-
-Configuration of extensions of GUS/patch file.  If specified in this
-configuration, the extension can omit in all *.cfg.  By default:
-
-#define PATCH_EXT_LIST { \
-		".pat", \
-		".shn", ".pat.shn", \
-		".gz", ".pat.gz", \
-		".bz2", ".pat.bz2", \
-		0 }
-
-** DEFAULT_PROGRAM
-
-Configuration of default instrument.  By default:
-
-#define DEFAULT_PROGRAM 0
-
-If no Program Change event, this program name are adopted.  Usually 0
-is Piano.
-
-** DEFAULT_DRUMCHANNELS
-
-Configuration of drum channel.  By default:
-
-#define DEFAULT_DRUMCHANNELS {10, -1}
-
-Numbers are the list of drum channels, and -1 is the terminator.  For
-example, if you wish to default drum channel be 10 and 16,
-
-#define DEFAULT_DRUMCHANNELS {10, 16, -1}
-
-This channel can change in command line option.
-
-** FLOAT_T
-
-Type of floating point number.  Choose one of these:
-
-* typedef double FLOAT_T;
-* typedef float FLOAT_T;
-
-Many machine which has FPU results faster operations with double than
-that with float.  But some machine results contrary.
-
-** (MAX|MIN)_OUTPUT_RATE
-
-Minimum/maximum range of playing sample rate.  By default:
-
-#define MIN_OUTPUT_RATE 4000
-#define MAX_OUTPUT_RATE 65000
-
-** DEFAULT_AMPLIFICATION
-
-Default value of master volume.  By default:
-
-#define DEFAULT_AMPLIFICATION 70
-
-This number is the percentage of max volume.  This default value will
-be nice in any occasions.  This number can specify in command line
-option (-A).
-
-** DEFAULT_RATE
-
-Default sampling rate.  By default:
-
-#define DEFAULT_RATE 44100
-
-If you have much CPU power, DAT quality GUS/patch and want to listen
-funny sound,
-
-#define DEFAULT_RATE 48000
-
-is good solution.
-
-** DEFAULT_VOICES
-
-Configuration of default polyphony numbers.  By default:
-
-#define DEFAULT_VOICES 256
-
-DEFAULT_VOICE is the polyphony number in boot-time.  This value is
-configurable by the command line option (-p) from 1 to until memory is
-allowed.  If your machine has much CPU power,
-
-#define DEFAULT_VOICES 512
-
-enables good harmony.
-
-** AUDIO_BUFFER_BITS
-
-Size of internal buffer.  By default:
-
-#define AUDIO_BUFFER_BITS 12
-
-I guess this values no need to change.
-
-** CONTROLS_PER_SECOND
-
-TiMidity++ do not calculate every envelope changes, but calculate some
-samples at one time.  Small controls yields better quality sound, but
-also eat much CPU time.  By default:
-
-#define CONTROLS_PER_SECOND 1000
-
-This can be changed from command line.  Leave as it is.
-
-** DEFAULT_RESAMPLATION
-
-Type of interpolation engine.  By default:
-
-#define DEFAULT_RESAMPLATION resample_gauss
-
-This definition cause TiMidity++ to Gauss-like interpolation in re-
-sampling, and the quality of sound would be nice.  But it eats CPU
-powers.  I recommend define it if your machine has much power.  Other
-choices are (sorted by their speed):
-
-#define DEFAULT_RESAMPLATION resample_none
-#define DEFAULT_RESAMPLATION resample_linear
-#define DEFAULT_RESAMPLATION resample_lagrange
-#define DEFAULT_RESAMPLATION resample_cspline
-#define DEFAULT_RESAMPLATION resample_gauss
-#define DEFAULT_RESAMPLATION resample_newton
-
-Interpolation methods are changeable from the command line.  If you
-want to prevent users from doing so, uncomment next line and define as
-this:
-
-#define FIXED_RESAMPLATION
-
-** USE_DSP_EFFECT
-
-Configuration of USE_DSP_EFFECT to refine chorus, delay, EQ and
-insertion effect.  Default enabled.
-
-** LOOKUP_HACK
-
-Configuration of LOOKUP_HACK.  By default, this features are undefined
-like this:
-
-/* #define LOOKUP_HACK */
-/* #define LOOKUP_INTERPOLATION */
-
-This option saves a little CPU power, but sound quality would decrease
-noticeably.  If your machine suffers from lack of CPU power, enable
-it.
-
-** SMOOTH_MIXING
-
-Defining this greatly reduces popping due to large volume/pan changes.
-This is definitely worth the slight increase in CPU usage.
-
-** FAST_DECAY
-
-Configuration of FAST_DECAY.  By default:
-
-/* #define FAST_DECAY */
-
-This option makes envelopes twice as fast and saves CPU power.  But
-since the release time of voices is shorten, the sound would be poor.
-This feature is controllable in command line option.
-
-** FRACTION_BITS
-
-TiMidity++ uses fixed-point calculation.  Its default is
-
-#define FRACTION_BITS 12
-
-and you don't have to change this value.
-
-** ADJUST_SAMPLE_VOLUMES
-
-Configuration of adjusting amplitude of GUS/patch.  By default:
-
-#define ADJUST_SAMPLE_VOLUMES
-
-This option makes TiMidity to adjust amplitudes of each GUS/patch to
-same volume.
-
-** DENGEROUS_RENICE
-
-By default this feature is disabled:
-
-/* #define DANGEROUS_RENICE -15 */
-
-If you want to increase process priority of TiMidity++ by using setuid
-root enable this option.  This option is only available in UNIX.  Once
-you enabled this option, you should install timidity with the follow-
-ing procedure:
-
-# chown root /usr/local/bin/timidity
-# chmod u+s /usr/local/bin/timidity
-
-Note: You should not set setuid to timidity if DANGEROUS_RENICE isn't
-      enabled.
-
-** MAX_DIE_TIME
-
-If this value is too small, click noise would be come.  Default is:
-
-#define MAX_DIE_TIME 20
-
-and I recommend this value leave to this.
-
-** LOOKUP_SINE
-
-#define LOOKUP_SINE
-
-On some machines (especially PCs without math coprocessors), looking
-up sine values in a table will be significantly faster than computing
-them on the fly.  I recommend define it.
-
-** PRECALC_LOOPS
-
-Configuration of optimizing re-sampling.  By default:
-
-#define PRECALC_LOOPS
-
-These may not in fact be faster on your particular machine and
-compiler.
-
-** USE_LDEXP
-
-Configuration of use of ldexp().  By default this feature is disabled:
-
-/* #define USE_LDEXP */
-
-If your machine can multiply floating point number with ldexp() faster
-than other method, enable this option.
-
-** DEFAULT_CACHE_DATA_SIZE
-
-Size of pre-re-sampling cache.  By default:
-
-#define DEFAULT_CACHE_DATA_SIZE (2*1024*1024)
-
-This can be changed from command line, so you don't have to change
-here.
-
-* Configurations about network
-
-TiMidity++ can access any files via networks with URL.  This feature
-are configurable in Makefile.  If you have enabled this feature in
-Makefile (configure --enable-network), configure the following macros:
-
-** MAIL_DOMAIN
-
-specifies domain name of your name address.  If your name address is
-"iz@onicos.co.jp" set the macro:
-
-#define MAIL_DOMAIN "@onicos.co.jp"
-
-** MAIL_NAME
-
-specifies mail name of yours if in Windows.  In UNIX, uncomment it.
-For example, your name address is "iz@onicos.co.jp" set the macro:
-
-#define MAIL_NAME "iz"
-
-** TMPDIR
-
-Configuration of temporary directory.  By default, this option is
-disabled:
-
-/* #define TMPDIR "/var/tmp" */
-
-In UNIX, if this option is disabled TiMidity++ creates temporary files
-in the path specified by the environment variable TMPDIR.  If environ-
-ment variable TMPDIR also isn't defined, TiMidity++ creates temporary
-files in /tmp.  In Windows, TMPDIR variable are ignored.  So you
-should specify the temporary path with this macro.
-
-** GS_DRUMPART
-
-Recognizing GS drum part by GS exclusive message.
-
-#define GS_DRUMPART
-
-enables to recognize GS exclusive message to set drum part.
-
-/* #define GS_DRUMPART */
-
-disables this feature.
-
-* Japanese-text-handling related options
-
-There are some options for Japanese handling.
-
-** JAPANESE
-
-If your system is in Japanese environment, define
-
-#define JAPANESE
-
-otherwise comment it out like
-
-/* #define JAPANESE */
-
-** OUTPUT_TEXT_CODE
-
-specifies output text code (in Japanese environment).  You should
-specify appropriate code name to OUTPUT_TEXT_CODE macro.  The follow-
-ing strings are available:
-
-AUTO
-  Auto conversion by `LANG' environment variable (UNIX only)
-ASCII
-  Convert unreadable characters to '.' (0x2e)
-NOCNV
-  No conversion
-1251
-  Convert from windows-1251 to koi8-r
-EUC
-  eucJP
-JIS
-  JIS
-SJIS
-  shift-JIS
-
-In Japanized UNIX system, all of above are available.  In Windows,
-"ASCII", "NOCNV", "SJIS" are available.  If your environment cannot
-handle Japanese, specify "ASCII" or "NOCNV" alternatively.
-
-** MODULATION_WHEEL_ALLOW
-** PORTAMENTO_ALLOW
-** NRPN_VIBRATO_ALLOW
-** REVERB_CONTROL_ALLOW
-** FREEVERB_CONTROL_ALLOW
-** CHORUS_CONTROL_ALLOW
-** SURROUND_CHORUS_ALLOW
-** GM_CHANNEL_PRESSURE_ALLOW
-** VOICE_CHAMBERLIN_LPF_ALLOW
-** VOICE_MOOG_LPF_ALLOW
-** MODULATION_ENVELOPE_ALLOW
-** ALWAYS_TRACE_TEXT_META_EVENT
-** OVERLAP_VOICE_ALLOW
-** TEMPER_CONTROL_ALLOW
-
-Controllers of MIDI actions.  By default:
-
-#define MODULATION_WHEEL_ALLOW
-#define PORTAMENTO_ALLOW
-#define NRPN_VIBRATO_ALLOW
-/* #define REVERB_CONTROL_ALLOW */
-#define FREEVERB_CONTROL_ALLOW
-#define CHORUS_CONTROL_ALLOW
-/* #define SURROUND_CHORUS_ALLOW */
-/* #define GM_CHANNEL_PRESSURE_ALLOW */
-#define VOICE_CHAMBERLIN_LPF_ALLOW
-/* #define VOICE_MOOG_LPF_ALLOW */
-/* #define MODULATION_ENVELOPE_ALLOW */
-/* #define ALWAYS_TRACE_TEXT_META_EVENT */
-#define OVERLAP_VOICE_ALLOW
-#define TEMPER_CONTROL_ALLOW
-
-These values are configurable in command line options.  So you may
-leave these in default value.
-
-======================================================================
-Make
-======================================================================
-
-Make section has nothing particular to write.  Just say "make"
-
-...Oops, almost forgot, TiMidity++'s Makefile needs GNU version of
-make.  If you do not have, get one first.  If you have one in a
-different name than "make", type its true name instead.
-
-Installation
-
-On UNIX and clones, you can type "make install" to install all files.
-Or you can select following targets:
-
-install.bin
-  installs executable filles
-install.tk
-  installs Tcl/Tk interface
-install.el
-  installs Emacs interface
-install.man
-  installs man files
-install
-  installs everything
-
-I strongly recommend you to check the install destinations and files
-by setteing -n flag like
-
-% make -n
-
-======================================================================
-Search for voice data
-======================================================================
-
-TiMidity++ uses Either GUS/patch, or SoundFont(, or both) as the voice
-data to play.  You must get a SoundFont or GUS/patch files, and make
-the configuration file.  You must make the configuration file (*.cfg).
-By default, timidity.cfg is /usr/local/share/timidity/timidity.cfg (or
-C:\WINDOWS\TIMIDITY.CFG on Windows).  And please check the following
-sites for many voice(patch) data:
-
-* http://www.onicos.com/staff/iz/timidity/link.html#gus
-* http://www.onicos.com/staff/iz/timidity/dist/cfg/ (Some sample *.cfg's)
-* http://www.i.h.kyoto-u.ac.jp/~shom/timidity/ (10M and 4M patches)
-* ftp://ftp.cdrom.com/pub/gus/sound/patches/files/ (GUS site)
-
-If you got funny voice archive, extract it to appropriate directory
-and configure *.cfg files with the name and path of these voice datas.
diff --git a/INSTALL.en b/INSTALL.en
new file mode 100644
index 0000000..7937bc8
--- /dev/null
+++ b/INSTALL.en
@@ -0,0 +1,631 @@
+======================================================================
+	TiMidity++ Installation guide
+
+					Masanao Izumo
+					<iz@onicos.co.jp>
+					Mar.01.2004
+					version 2.13.0 or later
+======================================================================
+
+This document describes how to install TiMidity++ for your UNIX-like
+machine.
+
+You can configure and make timidity.exe on the Cygwin environment of
+Windows 95/98/Me/NT/2000/XP/2003.  If you are in Windows, install
+Cygwin (or mingw) if you do not have them.
+
+Today's Macintosh has FreeBSD userland, so things described here would
+fly.  Methods for older Macintosh ("Classic") are not described here.
+
+======================================================================
+Basic Installation
+======================================================================
+
+TiMidity++ uses GNU autotools to build.  So the simplest way to
+compile this package is:
+
+1. "cd" to the directory containing TiMidity++'s source code and type
+   "./configure" to configure the package for your system.  If you are
+   using csh on an old version of System V, you might need to type
+   "/bin/sh configure" instead to prevent csh from trying to execute
+   configure itself.  Running configure takes a while.  While running,
+   it prints some messages telling which features it is checking for.
+2. Type "make" to compile the package.
+   NOTE: this make method requires GNU make.  So if your system has it
+         as gamke, type "gmake" instead.
+3. Type "make install" to install the programs and any data files and
+   documentation.
+
+======================================================================
+More complecated way
+======================================================================
+
+The full installation process is:
+
+1. configre
+2. edit common.makefile, Makefile, timidity.h if necessery
+3. make
+4. installation
+5. set up voice data
+
+Each processes are explained in following sections.  Note that % is
+the shell prompt.
+
+======================================================================
+Configure
+======================================================================
+
+First, execute the following command:
+
+% /bin/sh configure --help
+
+Many options of configure will be displayed.  Most of them, such as
+--help, --prefix=PREFIX, and so on are the regular ones.  They exisits
+on most package that uses autoconf and you do not have to worry about
+their behavior.
+
+There also exists some options that is typical to TiMidity++.  Main of
+these are the following:
+
+--enable-debug
+  Enables debug.  Things will be compiled with debugging methods/
+  informations.
+
+--without-x
+  TiMidity++ uses X by default.  So you must specify this option to
+  prevent linker from linking X libraries.
+
+--enable-audio[=audio_list]
+  Enables TiMidity++ to play MIDI files.  If --enable-audio=no,
+  TiMidity++ acts as a MIDI-to-WAVE converter.
+
+  You can specify one or more audio-device listed below.
+
+  * default: Automatically select audio device.
+  * oss: OSS /dev/dsp
+  * sun: SunOS /dev/audio
+  * hpux: hp-ux /dev/audio
+  * irix: IRIX audio library
+  * mme: OSF/1 MME
+  * sb_dsp: BSD/OS 2.0 /dev/sb_dsp
+  * w32: Windows MMS
+  * darwin: darwin(Mac OS X)'s CoreAudio frameowrk
+  * alsa: ALSA pcm device
+  * alib: hp-ux network audio (Alib)
+  * nas: NAS
+  * portaudio: PortAudio
+  * jack: JACK
+  * arts: aRts
+  * esd: EsounD
+  * vorbis: ogg vorbis
+  * gogo: mp3 Gogo-No-Coder (Windows only)
+
+--enable-interface[=interface_list]
+--enable-dynamic[=interface_list]
+  Specify which interface to use.  If you use --enable-dynamic instead
+  of --enable-interface, the interfaces specified will be linked
+  dynamically and the binary size would become a bit smaller.
+
+  You can select one or more interfaces listed below.
+
+  * ncurses: ncurses interface.
+  * slang: S-Lang interface.
+  * motif: Motif interface.  Motif interface also works under Lestiff.
+  * tcltk: Tcl/Tk interface.
+  * emacs: Emacs front-end.  Type M-x timidity to invoke.
+  * vt100: The full-screen interface using vt100 terminal control codes.
+  * xaw: X Athena Widget interface.
+  * xskin: X skin interface.
+  * gtk: GTK+ interface.
+  * w32gui: Build as Windows GUI binary.
+  * winsyn: Build as TiMidity++ Windows Synthesizer server.
+  * alsaseq: Build as ALSA sequencer client.
+
+  Note that
+  --enable-interface=INTERFACE1,INTERFACE2,...
+  equals as
+  --enable-INTERFACE1=yes --enable-INTERFACE2=yes ...
+  and for the same way,
+  --enable-dynamic=INTERFACE1,INTERFACE2,...
+  equals as
+  --enable-INTERFACE1=dynamic --enable-INTERFACE2=dynamic ...
+
+--enable-network
+  Enables network support.  This will allow TiMidity++ to open a MIDI
+  file via network.  You can specify the location of MIDI files by
+  http://foo.com.tw/bar/baz.mid - like format.
+
+--enable-spectrogram
+  With this option specified, TiMidity++ can open a window on X and
+  show sound-spectrogram there.
+
+--enable-wrd
+  WRD is a Japanese local lyric-contents format.  This option enables
+  WRD interface.
+
+* Environment variables and flags to pass to configure
+
+Some MIDI files eat too much CPU power.  If you choose correct
+optimizing method, TiMidity++ can play such MIDI files smoothly.
+
+You can tell configure which optimizing method to use by following
+environmental variables:
+
+CC
+  the C compiler command e.g. "/usr/bin/gcc"
+
+CFLAGS
+  flags to pass to ${CC} e.g. "-O2 -pipe"
+
+LDFLAGS
+  flags to pass to linker e.g. "-L/usr/gnu/lib"
+
+CPPFLAGS
+  flags to pass to preprocessor e.g. "-traditional-cpp"
+
+Your compiler may have many optimization flags.  For example, in case
+of ultrasparc/gcc, you can specify:
+
+% env CFLAGS='-O3 -Wall -mv8 -funroll-all-loops -fomit-frame-pointer \
+	-mcpu=ultrasparc' /bin/sh configure [configure-options]...
+
+and the binary will (hopefully) run faster.
+
+======================================================================
+Edit some files
+======================================================================
+
+If make fails, or if you want to change some parameters, edit
+common.makefile, Makefile, or timidity.h manually.
+
+* Parameters in timidity.h
+
+There are some options that are hard-coded into timidity binary.  They
+are # define-ed in timidity.h.  You have to change things there if you
+want to change these flags.
+
+** CONFIG_FILE
+
+Edit CONFIG_FILE to your convenience.  By default,
+
+#define CONFIG_FILE DEFAULT_PATH "/timidity.cfg"
+
+are recommended.  DEFAULT_PATH is the same as TIMID_DIR in Makefile.
+
+If you want to place it to another path, specify as the following:
+
+#define CONFIG_FILE "/etc/timidity.cfg"
+
+** DECOMPRESSOR_LIST
+
+The file extractor (please ignore in Windows).  By default:
+
+#define DECOMPRESSOR_LIST { \
+		".gz", "gunzip -c %s", \
+		".bz2", "bunzip2 -c %s", \
+		".Z", "zcat %s", \
+		".zip", "unzip -p %s", \
+		".lha", "lha -pq %s", \
+		".lzh", "lha -pq %s", \
+		".shn", "shorten -x %s -", \
+		0 }
+
+TiMidity++ can handle some of archive format directly.  But other
+format will use this extractor.
+
+** PATCH_CONVERTERS
+
+Configuration of of patch file converter (please ignore in Windows).
+By default:
+
+#define PATCH_CONVERTERS { \
+		".wav", "wav2pat %s", \
+		0 }
+
+** PATCH_EXT_LIST
+
+Configuration of extensions of GUS/patch file.  If specified in this
+configuration, the extension can omit in all *.cfg.  By default:
+
+#define PATCH_EXT_LIST { \
+		".pat", \
+		".shn", ".pat.shn", \
+		".gz", ".pat.gz", \
+		".bz2", ".pat.bz2", \
+		0 }
+
+** DEFAULT_PROGRAM
+
+Configuration of default instrument.  By default:
+
+#define DEFAULT_PROGRAM 0
+
+If no Program Change event, this program name are adopted.  Usually 0
+is Piano.
+
+** DEFAULT_DRUMCHANNELS
+
+Configuration of drum channel.  By default:
+
+#define DEFAULT_DRUMCHANNELS {10, -1}
+
+Numbers are the list of drum channels, and -1 is the terminator.  For
+example, if you wish to default drum channel be 10 and 16,
+
+#define DEFAULT_DRUMCHANNELS {10, 16, -1}
+
+This channel can change in command line option.
+
+** FLOAT_T
+
+Type of floating point number.  Choose one of these:
+
+* typedef double FLOAT_T;
+* typedef float FLOAT_T;
+
+Many machine which has FPU results faster operations with double than
+that with float.  But some machine results contrary.
+
+** (MAX|MIN)_OUTPUT_RATE
+
+Minimum/maximum range of playing sample rate.  By default:
+
+#define MIN_OUTPUT_RATE 4000
+#define MAX_OUTPUT_RATE 65000
+
+** DEFAULT_AMPLIFICATION
+
+Default value of master volume.  By default:
+
+#define DEFAULT_AMPLIFICATION 70
+
+This number is the percentage of max volume.  This default value will
+be nice in any occasions.  This number can specify in command line
+option (-A).
+
+** DEFAULT_RATE
+
+Default sampling rate.  By default:
+
+#define DEFAULT_RATE 44100
+
+If you have much CPU power, DAT quality GUS/patch and want to listen
+funny sound,
+
+#define DEFAULT_RATE 48000
+
+is good solution.
+
+** DEFAULT_VOICES
+
+Configuration of default polyphony numbers.  By default:
+
+#define DEFAULT_VOICES 256
+
+DEFAULT_VOICE is the polyphony number in boot-time.  This value is
+configurable by the command line option (-p) from 1 to until memory is
+allowed.  If your machine has much CPU power,
+
+#define DEFAULT_VOICES 512
+
+enables good harmony.
+
+** AUDIO_BUFFER_BITS
+
+Size of internal buffer.  By default:
+
+#define AUDIO_BUFFER_BITS 12
+
+I guess this values no need to change.
+
+** CONTROLS_PER_SECOND
+
+TiMidity++ do not calculate every envelope changes, but calculate some
+samples at one time.  Small controls yields better quality sound, but
+also eat much CPU time.  By default:
+
+#define CONTROLS_PER_SECOND 1000
+
+This can be changed from command line.  Leave as it is.
+
+** DEFAULT_RESAMPLATION
+
+Type of interpolation engine.  By default:
+
+#define DEFAULT_RESAMPLATION resample_gauss
+
+This definition cause TiMidity++ to Gauss-like interpolation in re-
+sampling, and the quality of sound would be nice.  But it eats CPU
+powers.  I recommend define it if your machine has much power.  Other
+choices are (sorted by their speed):
+
+#define DEFAULT_RESAMPLATION resample_none
+#define DEFAULT_RESAMPLATION resample_linear
+#define DEFAULT_RESAMPLATION resample_lagrange
+#define DEFAULT_RESAMPLATION resample_cspline
+#define DEFAULT_RESAMPLATION resample_gauss
+#define DEFAULT_RESAMPLATION resample_newton
+
+Interpolation methods are changeable from the command line.  If you
+want to prevent users from doing so, uncomment next line and define as
+this:
+
+#define FIXED_RESAMPLATION
+
+** USE_DSP_EFFECT
+
+Configuration of USE_DSP_EFFECT to refine chorus, delay, EQ and
+insertion effect.  Default enabled.
+
+** LOOKUP_HACK
+
+Configuration of LOOKUP_HACK.  By default, this features are undefined
+like this:
+
+/* #define LOOKUP_HACK */
+/* #define LOOKUP_INTERPOLATION */
+
+This option saves a little CPU power, but sound quality would decrease
+noticeably.  If your machine suffers from lack of CPU power, enable
+it.
+
+** SMOOTH_MIXING
+
+Defining this greatly reduces popping due to large volume/pan changes.
+This is definitely worth the slight increase in CPU usage.
+
+** FAST_DECAY
+
+Configuration of FAST_DECAY.  By default:
+
+/* #define FAST_DECAY */
+
+This option makes envelopes twice as fast and saves CPU power.  But
+since the release time of voices is shorten, the sound would be poor.
+This feature is controllable in command line option.
+
+** FRACTION_BITS
+
+TiMidity++ uses fixed-point calculation.  Its default is
+
+#define FRACTION_BITS 12
+
+and you don't have to change this value.
+
+** ADJUST_SAMPLE_VOLUMES
+
+Configuration of adjusting amplitude of GUS/patch.  By default:
+
+#define ADJUST_SAMPLE_VOLUMES
+
+This option makes TiMidity to adjust amplitudes of each GUS/patch to
+same volume.
+
+** DENGEROUS_RENICE
+
+By default this feature is disabled:
+
+/* #define DANGEROUS_RENICE -15 */
+
+If you want to increase process priority of TiMidity++ by using setuid
+root enable this option.  This option is only available in UNIX.  Once
+you enabled this option, you should install timidity with the follow-
+ing procedure:
+
+# chown root /usr/local/bin/timidity
+# chmod u+s /usr/local/bin/timidity
+
+Note: You should not set setuid to timidity if DANGEROUS_RENICE isn't
+      enabled.
+
+** MAX_DIE_TIME
+
+If this value is too small, click noise would be come.  Default is:
+
+#define MAX_DIE_TIME 20
+
+and I recommend this value leave to this.
+
+** LOOKUP_SINE
+
+#define LOOKUP_SINE
+
+On some machines (especially PCs without math coprocessors), looking
+up sine values in a table will be significantly faster than computing
+them on the fly.  I recommend define it.
+
+** PRECALC_LOOPS
+
+Configuration of optimizing re-sampling.  By default:
+
+#define PRECALC_LOOPS
+
+These may not in fact be faster on your particular machine and
+compiler.
+
+** USE_LDEXP
+
+Configuration of use of ldexp().  By default this feature is disabled:
+
+/* #define USE_LDEXP */
+
+If your machine can multiply floating point number with ldexp() faster
+than other method, enable this option.
+
+** DEFAULT_CACHE_DATA_SIZE
+
+Size of pre-re-sampling cache.  By default:
+
+#define DEFAULT_CACHE_DATA_SIZE (2*1024*1024)
+
+This can be changed from command line, so you don't have to change
+here.
+
+* Configurations about network
+
+TiMidity++ can access any files via networks with URL.  This feature
+are configurable in Makefile.  If you have enabled this feature in
+Makefile (configure --enable-network), configure the following macros:
+
+** MAIL_DOMAIN
+
+specifies domain name of your name address.  If your name address is
+"iz@onicos.co.jp" set the macro:
+
+#define MAIL_DOMAIN "@onicos.co.jp"
+
+** MAIL_NAME
+
+specifies mail name of yours if in Windows.  In UNIX, uncomment it.
+For example, your name address is "iz@onicos.co.jp" set the macro:
+
+#define MAIL_NAME "iz"
+
+** TMPDIR
+
+Configuration of temporary directory.  By default, this option is
+disabled:
+
+/* #define TMPDIR "/var/tmp" */
+
+In UNIX, if this option is disabled TiMidity++ creates temporary files
+in the path specified by the environment variable TMPDIR.  If environ-
+ment variable TMPDIR also isn't defined, TiMidity++ creates temporary
+files in /tmp.  In Windows, TMPDIR variable are ignored.  So you
+should specify the temporary path with this macro.
+
+** GS_DRUMPART
+
+Recognizing GS drum part by GS exclusive message.
+
+#define GS_DRUMPART
+
+enables to recognize GS exclusive message to set drum part.
+
+/* #define GS_DRUMPART */
+
+disables this feature.
+
+* Japanese-text-handling related options
+
+There are some options for Japanese handling.
+
+** JAPANESE
+
+If your system is in Japanese environment, define
+
+#define JAPANESE
+
+otherwise comment it out like
+
+/* #define JAPANESE */
+
+** OUTPUT_TEXT_CODE
+
+specifies output text code (in Japanese environment).  You should
+specify appropriate code name to OUTPUT_TEXT_CODE macro.  The follow-
+ing strings are available:
+
+AUTO
+  Auto conversion by `LANG' environment variable (UNIX only)
+ASCII
+  Convert unreadable characters to '.' (0x2e)
+NOCNV
+  No conversion
+1251
+  Convert from windows-1251 to koi8-r
+EUC
+  eucJP
+JIS
+  JIS
+SJIS
+  shift-JIS
+
+In Japanized UNIX system, all of above are available.  In Windows,
+"ASCII", "NOCNV", "SJIS" are available.  If your environment cannot
+handle Japanese, specify "ASCII" or "NOCNV" alternatively.
+
+** MODULATION_WHEEL_ALLOW
+** PORTAMENTO_ALLOW
+** NRPN_VIBRATO_ALLOW
+** REVERB_CONTROL_ALLOW
+** FREEVERB_CONTROL_ALLOW
+** CHORUS_CONTROL_ALLOW
+** SURROUND_CHORUS_ALLOW
+** GM_CHANNEL_PRESSURE_ALLOW
+** VOICE_CHAMBERLIN_LPF_ALLOW
+** VOICE_MOOG_LPF_ALLOW
+** MODULATION_ENVELOPE_ALLOW
+** ALWAYS_TRACE_TEXT_META_EVENT
+** OVERLAP_VOICE_ALLOW
+** TEMPER_CONTROL_ALLOW
+
+Controllers of MIDI actions.  By default:
+
+#define MODULATION_WHEEL_ALLOW
+#define PORTAMENTO_ALLOW
+#define NRPN_VIBRATO_ALLOW
+/* #define REVERB_CONTROL_ALLOW */
+#define FREEVERB_CONTROL_ALLOW
+#define CHORUS_CONTROL_ALLOW
+/* #define SURROUND_CHORUS_ALLOW */
+/* #define GM_CHANNEL_PRESSURE_ALLOW */
+#define VOICE_CHAMBERLIN_LPF_ALLOW
+/* #define VOICE_MOOG_LPF_ALLOW */
+/* #define MODULATION_ENVELOPE_ALLOW */
+/* #define ALWAYS_TRACE_TEXT_META_EVENT */
+#define OVERLAP_VOICE_ALLOW
+#define TEMPER_CONTROL_ALLOW
+
+These values are configurable in command line options.  So you may
+leave these in default value.
+
+======================================================================
+Make
+======================================================================
+
+Make section has nothing particular to write.  Just say "make"
+
+...Oops, almost forgot, TiMidity++'s Makefile needs GNU version of
+make.  If you do not have, get one first.  If you have one in a
+different name than "make", type its true name instead.
+
+Installation
+
+On UNIX and clones, you can type "make install" to install all files.
+Or you can select following targets:
+
+install.bin
+  installs executable filles
+install.tk
+  installs Tcl/Tk interface
+install.el
+  installs Emacs interface
+install.man
+  installs man files
+install
+  installs everything
+
+I strongly recommend you to check the install destinations and files
+by setteing -n flag like
+
+% make -n
+
+======================================================================
+Search for voice data
+======================================================================
+
+TiMidity++ uses Either GUS/patch, or SoundFont(, or both) as the voice
+data to play.  You must get a SoundFont or GUS/patch files, and make
+the configuration file.  You must make the configuration file (*.cfg).
+By default, timidity.cfg is /usr/local/share/timidity/timidity.cfg (or
+C:\WINDOWS\TIMIDITY.CFG on Windows).  And please check the following
+sites for many voice(patch) data:
+
+* http://www.onicos.com/staff/iz/timidity/link.html#gus
+* http://www.onicos.com/staff/iz/timidity/dist/cfg/ (Some sample *.cfg's)
+* http://www.i.h.kyoto-u.ac.jp/~shom/timidity/ (10M and 4M patches)
+* ftp://ftp.cdrom.com/pub/gus/sound/patches/files/ (GUS site)
+
+If you got funny voice archive, extract it to appropriate directory
+and configure *.cfg files with the name and path of these voice datas.
-- 
1.7.7.3

>From 429a54eb946a467c5e68f69e838998b6f76cb1ff Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 19 Nov 2011 11:14:07 +0100
Subject: [PATCH 14/17] Silence autofoo warnings about have_speex ac cache
 identifier

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 configure.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.in b/configure.in
index 12bd4cd..97c35db 100644
--- a/configure.in
+++ b/configure.in
@@ -1424,7 +1424,7 @@ fi
 dnl ogg's speex
 AC_MSG_CHECKING(enable_audio=speex)
 if test "x$au_enable_speex" = xyes; then
-  AC_CACHE_VAL(have_speex,
+  AC_CACHE_VAL(timidity_cv_have_speex,
   [AC_TRY_LINK([
   #include <speex/speex.h>
   #include <ogg/ogg.h>
-- 
1.7.7.3

>From c955a31938022b5fe0ee8ceccae08f850dc15965 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 19 Nov 2011 11:02:44 +0100
Subject: [PATCH 15/17] Get rid of the dynamic_control_mode ControlMode

This is a left over from before the dynamic_interface_module() rewrite,
not only is it no longer needed its code is plain wrong, as it still
contains a prototype for the old way different dynamic_interface_module()
and tries to call it as if it were the old version, if that code path where
to ever be invoked bad things (tm) would happen. Luckily it is never used,
so simply nuke it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 interface/Makefile.am |    6 --
 interface/dynamic_c.c |  130 -------------------------------------------------
 timidity/controls.c   |   10 ----
 timidity/timidity.c   |   31 +++---------
 4 files changed, 7 insertions(+), 170 deletions(-)
 delete mode 100644 interface/dynamic_c.c

diff --git a/interface/Makefile.am b/interface/Makefile.am
index 06058fa..fb8d2ee 100644
--- a/interface/Makefile.am
+++ b/interface/Makefile.am
@@ -74,7 +74,6 @@ EXTRA_libinterface_a_SOURCES = \
 	VTparse.h \
 	x_mag.c \
 	x_mag.h \
-	dynamic_c.c \
 	mac_c.c \
 	mac_c.h \
 	mac_mag.c \
@@ -155,10 +154,6 @@ WRD_WINCON_OBJS = wrdt_wcon.$(OBJEXT)
 endif
 endif
 
-if NEEDDLOPEN
-DYNAMIC_OBJS = dynamic_c.$(OBJEXT)
-endif
-
 if ENABLE_SOUND_SPEC
 SOUND_SPEC_OBJS = \
 	soundspec.$(OBJEXT)
@@ -178,7 +173,6 @@ libinterface_LIBADD = \
 	$(INTERFACE_OBJS) \
 	$(WRD_OBJS) \
 	$(WRD_WINCON_OBJS) \
-	$(DYNAMIC_OBJS) \
 	$(SOUND_SPEC_OBJS)
 	
 libinterface_a_LIBADD=$(libinterface_LIBADD)
diff --git a/interface/dynamic_c.c b/interface/dynamic_c.c
deleted file mode 100644
index bb46dbd..0000000
--- a/interface/dynamic_c.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-    TiMidity++ -- MIDI to WAVE converter and player
-    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
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    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
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-/*
-    dynamic_c.c
-    Dynamic loading control mode
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#ifndef NO_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-#include "timidity.h"
-#include "common.h"
-#include "output.h"
-#include "controls.h"
-#include "dlutils.h"
-
-static int ctl_open(int using_stdin, int using_stdout);
-static void ctl_close(void);
-extern char *dynamic_interface_module(char *name);
-static void ctl_event(){} /* Do nothing */
-static int cmsg(int type, int verbosity_level, char *fmt, ...);
-static void *libhandle;
-static void (* ctl_close_hook)(void);
-
-ControlMode dynamic_control_mode =
-{
-    "Dynamic interface", 0,
-    "\0",
-    1,0,0,0,
-    ctl_open, ctl_close, NULL, NULL, NULL, cmsg, ctl_event,
-};
-
-static int cmsg(int type, int verbosity_level, char *fmt, ...)
-{
-  va_list ap;
-
-  if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) &&
-      dynamic_control_mode.verbosity<verbosity_level)
-    return 0;
-  va_start(ap, fmt);
-
-  if (!dynamic_control_mode.opened)
-    {
-      vfprintf(stderr, fmt, ap);
-      fprintf(stderr, "\n");
-    }
-  else
-    {
-      vfprintf(stdout, fmt, ap);
-      fprintf(stdout, "\n");
-    }
-  va_end(ap);
-  return 0;
-}
-
-static int ctl_open(int using_stdin, int using_stdout)
-{
-    ControlMode *(* inferface_loader)(void);
-    char *path, *name;
-    char buff[256];
-    int id;
-
-    if(dynamic_control_mode.opened)
-	return 0;
-    dynamic_control_mode.opened = 1;
-
-    id = dynamic_control_mode.id_character;
-    name = dynamic_control_mode.id_short_name;
-    path = dynamic_interface_module(name);
-    if(path == NULL)
-    {
-	fprintf(stderr, "FATAL ERROR: dynamic_c.c: ctl_open()\n");
-	exit(1);
-    }
-
-    if((libhandle = dl_load_file(path)) == NULL)
-	return -1;
-
-    sprintf(buff, "interface_%c_loader", id);
-    if((inferface_loader = (ControlMode *(*)(void))
-	dl_find_symbol(libhandle, buff)) == NULL)
-	return -1;
-
-    ctl = inferface_loader();
-
-    ctl->verbosity = dynamic_control_mode.verbosity;
-    ctl->trace_playing = dynamic_control_mode.trace_playing;
-    ctl->flags = dynamic_control_mode.flags;
-    ctl_close_hook = ctl->close;
-    ctl->close = dynamic_control_mode.close; /* ctl_close() */
-
-    return ctl->open(using_stdin, using_stdout);
-}
-
-static void ctl_close(void)
-{
-    if(ctl_close_hook)
-    {
-	ctl_close_hook();
-	dl_free(libhandle);
-	ctl_close_hook = NULL;
-    }
-}
diff --git a/timidity/controls.c b/timidity/controls.c
index 246f971..baa1a5e 100644
--- a/timidity/controls.c
+++ b/timidity/controls.c
@@ -90,13 +90,6 @@ extern ControlMode dumb_control_mode;
 # endif
 #endif
 
-#ifdef IA_DYNAMIC
-  extern ControlMode dynamic_control_mode;
-# ifndef DEFAULT_CONTROL_MODE
-#  define DEFAULT_CONTROL_MODE &dynamic_control_mode
-# endif
-#endif /* IA_DYNAMIC */
-
 #ifdef IA_EMACS
   extern ControlMode emacs_control_mode;
 # ifndef DEFAULT_CONTROL_MODE
@@ -219,9 +212,6 @@ ControlMode *ctl_list[]={
 #if !defined(__MACOS__)  && !defined(IA_W32GUI) && !defined(IA_W32G_SYN)
 	&dumb_control_mode,
 #endif
-#ifdef IA_DYNAMIC
-  &dynamic_control_mode,
-#endif
 #ifdef IA_PLUGIN
   &plugin_control_mode,
 #endif
diff --git a/timidity/timidity.c b/timidity/timidity.c
index 57f8fd1..8d5cbc0 100644
--- a/timidity/timidity.c
+++ b/timidity/timidity.c
@@ -528,10 +528,6 @@ static inline FILE *open_pager(void);
 static inline void close_pager(FILE *);
 static void interesting_message(void);
 
-#ifdef IA_DYNAMIC
-MAIN_INTERFACE char dynamic_interface_id;
-#endif /* IA_DYNAMIC */
-
 extern StringTable wrd_read_opts;
 
 extern int SecondMode;
@@ -4015,22 +4011,14 @@ static int parse_opt_h(const char *arg)
 	fputs(NLS, fp);
 	fputs("Available interfaces (-i, --interface option):" NLS, fp);
 	for (cmpp = ctl_list; (cmp = *cmpp) != NULL; cmpp++)
-#ifdef IA_DYNAMIC
-		if (cmp->id_character != dynamic_interface_id)
-			fprintf(fp, "  -i%c          %s" NLS,
-					cmp->id_character, cmp->id_name);
-#else
 		fprintf(fp, "  -i%c          %s" NLS,
 				cmp->id_character, cmp->id_name);
-#endif	/* IA_DYNAMIC */
 #ifdef IA_DYNAMIC
 	fprintf(fp, "Supported dynamic load interfaces (%s):" NLS,
 			dynamic_lib_root);
 	memset(mark, 0, sizeof(mark));
 	for (cmpp = ctl_list; (cmp = *cmpp) != NULL; cmpp++)
 		mark[(int) cmp->id_character] = 1;
-	if (dynamic_interface_id != 0)
-		mark[(int) dynamic_interface_id] = 0;
 	list_dyna_interface(fp, dynamic_lib_root, mark);
 #endif	/* IA_DYNAMIC */
 	fputs(NLS, fp);
@@ -4187,17 +4175,16 @@ static inline int parse_opt_i(const char *arg)
 #endif	/* IA_W32GUI */
 			break;
 		}
+	}
 #ifdef IA_DYNAMIC
-		if (cmp->id_character == dynamic_interface_id) {
-			cmp = dynamic_interface_module(*arg);
-			if(cmp) {
-				ctl = cmp;
-				found = 1;
-				break;
-			}
+	if (! found) {
+		cmp = dynamic_interface_module(*arg);
+		if(cmp) {
+			ctl = cmp;
+			found = 1;
 		}
-#endif	/* IA_DYNAMIC */
 	}
+#endif	/* IA_DYNAMIC */
 	if (! found) {
 		ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
 				"Interface `%c' is not compiled in.", *arg);
@@ -5812,11 +5799,7 @@ int main(int argc, char **argv)
 #endif
 #ifdef IA_DYNAMIC
 {
-#ifdef XP_UNIX
-	argv[0] = "netscape";
-#endif /* XP_UNIX */
 	dynamic_lib_root = safe_strdup(SHARED_LIB_PATH);
-	dynamic_interface_id = 0;
 	dl_init(argc, argv);
 }
 #endif /* IA_DYNAMIC */
-- 
1.7.7.3

>From 7c9e2460e3f82eb7ece0777807414e7a8cabeb26 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 19 Nov 2011 11:29:12 +0100
Subject: [PATCH 16/17] Silence dlsym errors

The way the new dynamic_interface_module() function probes for dynamic
interfaces cause it to always hit a few dlsym errors as soon as you have
more then one dynamic interface, so silence these errors.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 timidity/dl_dlopen.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/timidity/dl_dlopen.c b/timidity/dl_dlopen.c
index a3785ef..5bbb234 100644
--- a/timidity/dl_dlopen.c
+++ b/timidity/dl_dlopen.c
@@ -72,8 +72,6 @@ void *dl_find_symbol(void *libhandle, char *symbolname)
 #endif
 
     RETVAL = dlsym(libhandle, symbolname);
-    if (RETVAL == NULL)
-	fprintf(stderr, "%s\n", dlerror());
     return RETVAL;
 }
 
-- 
1.7.7.3

>From 6c4b3b26448a1f45271983f01543603cde4d6f25 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 19 Nov 2011 11:51:26 +0100
Subject: [PATCH 17/17] Fix listing of dynamic interfaces in --help output

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 timidity/timidity.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/timidity/timidity.c b/timidity/timidity.c
index 8d5cbc0..4bb0f90 100644
--- a/timidity/timidity.c
+++ b/timidity/timidity.c
@@ -4098,21 +4098,21 @@ static inline void list_dyna_interface(FILE *fp, char *path, char *mark)
 	while (url_gets(dir, fname, sizeof(fname)) != NULL)
 		if (strncmp(fname, "if_", 3) == 0) {
 			void* handle = NULL;
-			if((handle = dl_load_file(fname))) {
-				ControlMode *(* loader)(void);
-				char c = CHAR_MAX;
-				loader = NULL;
-				do {
+			char path[NAME_MAX];
+			snprintf(path, NAME_MAX, ".%c%s", PATH_SEP, fname);
+			if((handle = dl_load_file(path))) {
+				ControlMode *(* loader)(void) = NULL;
+				char c;
+				for (c = 'A'; c <= 'z'; c++) {
 					char buf[20]; /* enough */
 					if(mark[(int)c]) continue;
 					sprintf(buf, "interface_%c_loader", c);
 					if((loader = dl_find_symbol(handle, buf))) {
 						fprintf(fp, "  -i%c          %s" NLS, c, loader()->id_name);
 						mark[(int)c] = 1;
-						goto cleanup;
+						break;
 					}
-				} while (--c != CHAR_MAX); /* round-trip detection */
-			cleanup:
+				}
 				dl_free(handle);
 			}
 		}
-- 
1.7.7.3

>From 588206de19c2f0e69e4bb80d3cc4fad3bb724e83 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 19 Nov 2011 13:24:15 +0100
Subject: [PATCH 18/18] configure: Don't add -lX11 to the generic LIBS

This stops timidity itself from depending on libX11 even when build
without any interfaces builtin which need libX11.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 configure.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.in b/configure.in
index 97c35db..56d3c6f 100644
--- a/configure.in
+++ b/configure.in
@@ -374,7 +374,7 @@ if test "x$with_x" = xyes -a "x$have_x" = xyes; then
     CPPFLAGS="$CPPFLAGS -I$x_includes"
   fi
 
-  AC_CHECK_LIB(X11,XOpenDisplay)
+  AC_CHECK_LIB(X11,XOpenDisplay,AC_DEFINE([HAVE_LIBX11],[],[Has libX11]))
   AC_MSG_CHECKING(X11 version 6)
   AC_CACHE_VAL(timidity_cv_x11_version_6,
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[
-- 
1.7.7.3


Reply to: