Index: timidity/libunimod/mlutil.c =================================================================== RCS file: /cvsroot/timidity/timidity/libunimod/mlutil.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -r1.6 -r1.7 --- timidity/libunimod/mlutil.c 5 Jun 2003 11:27:47 -0000 1.6 +++ timidity/libunimod/mlutil.c 17 Oct 2004 22:48:29 -0000 1.7 @@ -321,6 +321,7 @@ ULONG getAmigaPeriod (UBYTE flags, ULONG if (flags & UF_LINEAR) { period = lintab[period % 768] >> (period / 768); + if (period < 1) period = 1; period = (8363L * 1712L) / period; } Index: timidity/timidity/mod2midi.c =================================================================== RCS file: /cvsroot/timidity/timidity/timidity/mod2midi.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -p -r1.11 -r1.12 --- timidity/timidity/mod2midi.c 17 Oct 2004 22:48:29 -0000 1.11 +++ timidity/timidity/mod2midi.c 21 Oct 2004 02:34:03 -0000 1.12 @@ -266,11 +267,13 @@ Voice_SetPeriod (UBYTE v, ULONG period) return; new_noteon = period2note (ModV[v].period, &bend); -#ifndef TRACE_SLIDE_NOTES - bend += (new_noteon - ModV[v].noteon) << 13; - new_noteon = ModV[v].noteon; -#endif - bend = WHEEL_VALUE(bend); + if (new_noteon >= 0) { + #ifndef TRACE_SLIDE_NOTES + bend += (new_noteon - ModV[v].noteon) << 13; + new_noteon = ModV[v].noteon; + #endif + bend = WHEEL_VALUE(bend); + } if (ModV[v].noteon != new_noteon) { @@ -330,13 +333,13 @@ Voice_Play (UBYTE v, SAMPLE * s, ULONG s Voice_Stop (v); new_noteon = period2note (ModV[v].period, &bend); - bend = WHEEL_VALUE(bend); if (new_noteon < 0) { ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, "Strange period %d", ModV[v].period); return; } + bend = WHEEL_VALUE(bend); ModV[v].noteon = new_noteon; ModV[v].time = at; @@ -590,9 +593,13 @@ void load_module_samples (SAMPLE * s, in special_patch[i]->sample = sp = (Sample *)safe_malloc(sizeof(Sample)); memset(sp, 0, sizeof(Sample)); - strncpy(name, s->samplename, 22); - name[22] = '\0'; - code_convert(name, NULL, 23, NULL, "ASCII"); + memset(name, 0, 23 * sizeof(char)); + if (s->samplename != NULL) + { + strncpy(name, s->samplename, 22); + name[22] = '\0'; + code_convert(name, NULL, 23, NULL, "ASCII"); + } if(name[0] == '\0') special_patch[i]->name = NULL; else Index: timidity/timidity/aRts_a.c =================================================================== RCS file: /cvsroot/timidity/timidity/timidity/aRts_a.c,v retrieving revision 1.7 retrieving revision 1.9 diff -u -p -r1.7 -r1.9 --- timidity/timidity/aRts_a.c 13 Jan 2004 14:27:48 -0000 1.7 +++ timidity/timidity/aRts_a.c 4 Dec 2004 14:32:31 -0000 1.9 @@ -56,6 +56,7 @@ #include "playmidi.h" #include "miditrace.h" +static int arts_init_state = 0; /* 0=no init, 1=arts_init, 2=arts_free */ static arts_stream_t stream = 0; static int server_buffer = 0; static int output_count = 0; @@ -64,9 +65,11 @@ static int open_output(void); /* 0=succe 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 */ +/* export the playback mode. aRts cannot support auto-detection properly + * see TiMidity bug report #35 on Kagemai. Do not add any functionality + * that would require TiMidity to call arts_init() again after an + * arts_free(), it will blow up */ #define dpm arts_play_mode @@ -83,18 +86,8 @@ PlayMode dpm = { close_output, output_data, acntl, - detect }; -static int detect(void) -{ - if (arts_init() == 0) { - arts_free(); - return 1; /* ok, found */ - } - return 0; -} - /*************************************************************************/ /* We currently only honor the PE_MONO bit, and the sample rate. */ @@ -114,10 +107,19 @@ static int open_output(void) channels = (dpm.encoding & PE_MONO) ? 1 : 2; /* Open the audio device */ - if((i = arts_init()) != 0) - { - ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", - dpm.name, arts_error_text(i)); + switch (arts_init_state) { + case 0: + if((i = arts_init()) != 0) + { + ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: %s", + dpm.name, arts_error_text(i)); + return -1; + } + arts_init_state = 1; + break; + case 2: + ctl->cmsg(CMSG_ERROR, VERB_NORMAL, + "TiMidity aRts bug: open_output() after close_output() not supported"); return -1; } stream = arts_play_stream(dpm.rate, @@ -187,6 +189,7 @@ static void close_output(void) return; arts_close_stream(stream); arts_free(); + arts_init_state = 2; stream = 0; } @@ -197,7 +200,6 @@ static int acntl(int request, void *arg) { case PM_REQ_DISCARD: /* Discard stream */ arts_close_stream(stream); - arts_free(); stream=NULL; return 0; case PM_REQ_RATE: /* Change sample rate */ Index: timidity/interface/gtk_i.c =================================================================== RCS file: /cvsroot/timidity/timidity/interface/gtk_i.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -p -r1.8 -r1.9 --- timidity/interface/gtk_i.c 9 Sep 2004 05:23:17 -0000 1.8 +++ timidity/interface/gtk_i.c 21 Dec 2004 18:02:28 -0000 1.9 @@ -365,6 +365,7 @@ void Launch_Gtk_Process(int pipe_number) { int argc = 0; + gchar **argv = NULL; GtkWidget *button, *mbar, *swin; GtkWidget *table, *align, *handlebox; GtkWidget *vbox, *hbox, *vbox2, *scrolled_win; @@ -373,7 +374,7 @@ Launch_Gtk_Process(int pipe_number) /* enable locale */ gtk_set_locale (); - gtk_init (&argc, NULL); + gtk_init (&argc, &argv); ttip = create_yellow_tooltips(); window = gtk_window_new(GTK_WINDOW_TOPLEVEL);