Hi, good to see people still actively using Timidity. I was expecting the mailing list to be dead based on the lack of recent releases.

"The optreset variable is called __mingw_optreset"
"The functions fork and read_config_file"

I had these problems too. I didn't know optreset was an external library variable, so I just created my own in my patch.  MinGW doesn't have UNIX fork() because the semantics are hard to duplicate on Windows (Cygwin does have fork(), but emulates it pretty inefficiently by copying all the state from parent process to the child process)

I just surrounded the fork() code with  #ifndef _WIN32, which disables Timidity from running as a background service, but I don't think that's needed on Windows since you already have the much more useful Windows MIDI API driver interface.

I removed the static from read_config_file() since it's also used by the Windows GUI.

Yale


On Fri, Oct 25, 2013 at 4:05 AM, LM <lmemsm@gmail.com> wrote:
First off, don't know if Yair K is on the list, but I still remember
the last time I had a problem with Timidity+ and he was so helpful
about adding a patch to get my Karaoke midi files working properly.  I
still really appreciate what he did.

I downloaded the latest version of Timidity++ that I could from git
timidity-git-7d4ddc6c37b8d5b0ff14a65350be4fa2cd6a50aa.zip (wanted all
the latest patches and fixes) and attempted to build it using mingw
(from mingw.org) on Windows.  I'm building with the configure settings
--enable-interface=ncurses,vt100,w32gui --enable-spectogram
--enable-wrd

I ran into three issues building the latest version of Timidity++ with
mingw.  Pdcurses already has vwprintw, so it doesn't like that it's
defined again in ncurs_c.c.  The optreset variable is called
__mingw_optreset.  The functions fork and read_config_file couldn't be
found during the link.  I came up with patches for these issues.  If I
build with the patches, timidity++ builds successfully and I get an
executable.  Hoping to test the latest version of timidity++ (and
patches) with Debian and FreeBSD systems when I have the time.
Noticed Yale just posted some Windows patches to Timidity-devel list.
Will test those out as well when I get a chance.

I'm adding the patches at the bottom of this e-mail in case they might
be useful to anyone.  If there's a problem with sending something in
patch format via e-mail, I'd be happy to send it another way.

Thanks to everyone who's worked on timidity++ and helped make it such
a useful program.

Sincerely,
Laura
http://www.distasis.com/cpp


diff -Naurp src/timidity/interface/ncurs_c.c tmp/timidity/interface/ncurs_c.c
--- src/timidity/interface/ncurs_c.c    2009-03-04 04:51:36 -0500
+++ tmp/timidity/interface/ncurs_c.c
@@ -2888,7 +2888,7 @@ static int ctl_write(char *valp, int32 s
   return write(STDOUT_FILENO, valp, size);
 }

-#ifdef USE_PDCURSES
+/*#ifdef USE_PDCURSES
 static void vwprintw(WINDOW *w, char *fmt, va_list ap)
 {
     char *buff;
@@ -2900,7 +2900,7 @@ static void vwprintw(WINDOW *w, char *fm
     waddstr(w, buff);
     reuse_mblock(&pool);
 }
-#endif /* USE_PDCURSES */
+#endif*/ /* USE_PDCURSES */

 static int cmsg(int type, int verbosity_level, char *fmt, ...)
 {
diff -Naurp src/timidity/utils/tmdy_getopt.h tmp/timidity/utils/tmdy_getopt.h
--- src/timidity/utils/tmdy_getopt.h    2006-12-22 17:42:47 -0500
+++ tmp/timidity/utils/tmdy_getopt.h
@@ -68,7 +68,10 @@ extern int getopt (int __argc, char *con
 #ifdef HAVE_GETOPT_H
 /* gtopt_long() declared here */
 #include <getopt.h>
-
+#if defined (__MINGW32__) || defined (__CYGWIN__ )
+# define optreset  __mingw_optreset
+extern int optreset;
+#endif
 #if __POCC__
 struct option {
 const char *name;
diff -Naurp src/timidity/timidity/timidity.c tmp/timidity/timidity/timidity.c
--- src/timidity/timidity/timidity.c    2012-06-25 00:46:56 -0400
+++ tmp/timidity/timidity/timidity.c
@@ -1223,7 +1223,7 @@ static char *expand_variables(char *stri
 #define READ_CONFIG_ERROR          1
 #define READ_CONFIG_RECURSION      2 /* Too much recursion */
 #define READ_CONFIG_FILE_NOT_FOUND 3 /* Returned only w. allow_missing_file */
-static int read_config_file(char *name, int self, int allow_missing_file)
+MAIN_INTERFACE int read_config_file(char *name, int self, int
allow_missing_file)
 {
     struct timidity_file *tf;
     char buf[1024], *tmp, *w[MAXWORDS + 1], *cp;
@@ -5357,6 +5357,7 @@ MAIN_INTERFACE int timidity_post_load_co
 {
     int i, cmderr = 0;

+#ifdef HAVE_FORK
     /* 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. */
@@ -5379,6 +5380,7 @@ MAIN_INTERFACE int timidity_post_load_co
         exit(0);
     }
     }
+#endif

     if(play_mode == &null_play_mode)
     {

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Timidity-devel mailing list
Timidity-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/timidity-devel