OSDN Git Service

TiMidity++-2.4.1
authorMasanao Izumo <mo@goice.co.jp>
Wed, 11 Aug 1999 13:07:01 +0000 (22:07 +0900)
committerMasanao Izumo <mo@goice.co.jp>
Wed, 11 Aug 1999 13:07:01 +0000 (22:07 +0900)
25 files changed:
ChangeLog
NEWS
common.makefile.in
configure
configure.in
interface/mac_c.c
interface/ncurs_c.c
interface/soundspec.c
interface/w32g.h
interface/w32g_c.c
interface/w32g_canvas.c
interface/x_sherry.c
interface/x_wrdwindow.c
libarc/arc.c
libarc/arc.h
timidity/Makefile.in
timidity/aq.c
timidity/common.c
timidity/controls.h
timidity/linux_a.c
timidity/playmidi.c
timidity/playmidi.h
timidity/readmidi.c
timidity/timidity.c
timidity/wrdt.c

index 7dd813b..0eaa600 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+1999-08-11  Masanao Izumo <mo@goice.co.jp>
+
+    * Version 2.4.1 released.
+
+1999-08-11  Masanao Izumo <mo@goice.co.jp>
+
+    * timidity/linux_a.c: Fixed to adjust PM_REQ_GETSAMPLES.
+    * interface/x_sherry.c (sry_text): Do nothing if string length is zero.
+    * interface/soundspec.c: Multipuly 1.5 to results.
+    * interface/w32g_c.c(ctl_read): In Windows GUI interface, if
+      play_pause_flag is true, wait until any control message is received.
+      There is no CPU usage during pause.
+    * libarc/arc.c (regist_archive): Static function.  This function is
+      no longer library interface function.
+    * timidity/timidity.c (read_config_file): Don't remove the end of
+      '#' followed by non-space.
+    * timidity/{playmidi.h,playmidi.c,readmidi.c,mac_c.c}:
+      Make a new MidiEvent type `ME_GSLCD' and the interface control message
+      `CTLE_GSLCD'.  If ME_GSLCD is received, TiMidity sends CTLE_GSLCD to
+      the interface.
+    * timidity/{common.c,timidity.c} (open_file_noise_mode): new global
+      variable to pass `noise_mode' of open_file() to arc_error_handler.
+    * wrdt.c: Make more elevant.
+    * x_wrdwindow.c (gscreen_plane_mask): Bug fix.
+
+1999-08-10  Masanao Izumo <mo@goice.co.jp>
+
+    * libarc/arc.c: Bug fixed.
+    * interface/x_sherry.c: Bug fixed.
+    * libarc/{arc.h,arc.c}: Removed `pool' from ArchiveHandler.
+      Use static variable arc_buffer in arc.c instead of ArchiveHandler.pool.
+      `arc_buffer' which is internal usage only.
+    * timidity/playmidi.c (apply_controls): usleep(300000) if play_pause_flag.
+    * interface/{w32g_c.c,w32g_canvas.c}:
+      Fixed update timing for channel bar mode.
+
+1999-08-10  Masanao Izumo <mo@goice.co.jp>
+
+    * libarc/arc.c (): Bug fixed to extract `-lh0-' and `-lz4-' of the lha.
+    * interface/x_sherry.c: Bug fixed to create SHM pixmap.
+    * libarc/{arc.h,arc.c}: Removed `pool' from ArchiveHandler.
+      Use static variable arc_buffer in arc.c instead of ArchiveHandler.pool.
+      `arc_buffer' is internal usage only.
+    * timidity/playmidi.c (apply_controls): usleep(300000) if play_pause_flag.
+    * interface/{w32g_c.c,w32g_canvas.c}:
+      Fixed update timing for channel bar mode.
+
+
 1999-08-09  Masanao Izumo <mo@goice.co.jp>
 
     * Version 2.4.0 released.
diff --git a/NEWS b/NEWS
index 881bf6a..1147587 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+8/11, 1999
+    * Version 2.4.1 released.
+    * Bug fix.
+
 8/9, 1999
     * Version 2.4.0 released.
     * Make archive library (libarc) code more simple.
index 75b56ba..0bc0d7c 100644 (file)
@@ -26,9 +26,8 @@ SHELL=@SHELL@
 #CC= @CC@
 #CFLAGS = @CFLAGS@
 # For pentium gcc
-#CFLAGS = -O6 -Os -mpentium -march=pentium -fomit-frame-pointer \
-#         -funroll-all-loops -malign-double -malign-jumps=0 \
-#         -malign-functions=0 -ffast-math -malign-loops=0
+#CFLAGS = -O3 -mpentium -march=pentium -fomit-frame-pointer \
+#         -funroll-all-loops -malign-double -ffast-math
 #CPPFLAGS = @CPPFLAGS@
 
 #DEFS = @DEFS@
index b6063b1..1ce5cef 100755 (executable)
--- a/configure
+++ b/configure
@@ -856,7 +856,7 @@ fi
 
 PACKAGE=TiMidity++
 
-VERSION=2.4.0
+VERSION=2.4.1
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
index 377c0b1..6488251 100644 (file)
@@ -53,7 +53,7 @@ dnl SHCFLAGS  - Additional flags to compile shared object library.
 
 AC_INIT(timidity/timidity.c)
 AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE(TiMidity++, 2.4.0, no-define)
+AM_INIT_AUTOMAKE(TiMidity++, 2.4.1, no-define)
 
 dnl To use CONTAINS() macro (See acinclude.m4)
 CONTAINS_INIT
index f99ff26..b23cfff 100644 (file)
@@ -1005,12 +1005,21 @@ static void ctl_lyric(int lyricid)
 
        lyric = event2string(lyricid);
        if(lyric == NULL) return;
+       ctl.cmsg(CMSG_TEXT, VERB_VERBOSE, "%s", lyric + 1);
+}
+
+static void ctl_gslcd(int lyricid)
+{
+       char *lyric;
+
+       lyric = event2string(lyricid);
+       if(lyric == NULL) return;
        
-       if( strncmp(lyric+1, "gslcd: ",7)==0 ){
+       if( lyric[0] == ME_GSLCD ){
                int i,j, data, mask;
                char tmp[3]= "00";
                
-               lyric+=8;
+               lyric++;
                for( j=0; j<4; j++ ){
                for( i=0; i<16; i++ ){
                        tmp[0]= lyric[0]; tmp[1]= lyric[1]; lyric+=2;
@@ -1205,6 +1214,9 @@ static void ctl_event(CtlEvent *e)
       case CTLE_LYRIC:
        ctl_lyric((int)e->v1);
        break;
+      case CTLE_GSLCD:
+       ctl_gslcd((int)e->v1);
+       break;
       case CTLE_REFRESH:
        ctl_refresh();
        break;
index 9f2b6bb..3b8c106 100644 (file)
@@ -973,6 +973,8 @@ static void ctl_list_mode(int type)
 
 static void ctl_event(CtlEvent *e)
 {
+    if(midi_trace.flush_flag)
+       return;
     switch(e->type)
     {
       case CTLE_NOW_LOADING:
@@ -2755,7 +2757,6 @@ static void reset_indicator(void)
 
 static void display_aq_ratio(void)
 {
-#if 1
     static int last_rate = -1;
     int rate, devsiz;
 
@@ -2776,11 +2777,6 @@ static void display_aq_ratio(void)
            wprintw(dftwin, " Audio queue:%3d%% ", rate);
        scr_modified_flag = 1;
     }
-#else
-    wmove(dftwin, VOICE_LINE + 1, 30);
-    wprintw(dftwin, " Audio queue: %d %d %d %d",
-           aq_get_dev_queuesize(), aq_filled(), aq_soft_filled(), aq_fillable());
-#endif
 }
 
 static void update_indicator(void)
index aadbd32..f73bbc8 100644 (file)
 #define SCOPE_WIDTH  512       /* You can specified any positive value */
 #define SCROLL_THRESHOLD 256   /* 1 <= SCROLL_THRESHOLD <= SCOPE_WIDTH */
 #define NCOLOR    64           /* 1 <= NCOLOR <= 255 */
-/*#define AMP 0.35*/
 #define AMP 1.0
-/*#define AMP 0.27*/
+#define AMP2 1.5
 #define DEFAULT_ZOOM (44100.0/1024.0*2.0) /* ~86Hz */
-#define MIN_ZOOM 15.0  /* 15Hz is lower bound that human can be heard. */
+#define MIN_ZOOM 15.0  /* 15Hz is the lowest bound that human can be heard. */
 #define MAX_ZOOM 440.0
 #define DEFAULT_UPDATE 0.05
 
@@ -282,9 +281,11 @@ static void set_draw_pixel(double *val, char *pixels)
 
     for(i = 0; i < SCOPE_HEIGHT; i++)
     {
-       v = (unsigned)val[i];
+       v = (unsigned)(val[i] * AMP2);
        if(v > NCOLOR - 1)
            val[i] = NCOLOR - 1;
+       else
+           val[i] = v;
     }
 
     switch(depth) {
index 60fca7f..8cf12e0 100644 (file)
@@ -125,6 +125,7 @@ extern void TmCanvasRefresh(void);
 extern void TmCanvasReset(void);\r
 extern void TmCanvasNote(int status, int ch, int note, int vel);\r
 extern int TmCanvasChange(void);\r
+extern void TmCanvasUpdateInterval();\r
 extern int TmCanvasMode;\r
 \r
 /* w32g_c.c */\r
index d8472b5..f77ff54 100644 (file)
@@ -82,6 +82,7 @@ ControlMode ctl=
 static int ctl_open(int using_stdin, int using_stdout)\r
 {\r
     ctl.opened = 1;\r
+    set_trace_loop_hook(TmCanvasUpdateInterval);\r
     return w32g_open();\r
 }\r
 \r
@@ -225,7 +226,7 @@ static int ctl_read(int32 *valp)
 {\r
     int rc;\r
 \r
-    rc = w32g_get_rc(valp, 0);\r
+    rc = w32g_get_rc(valp, play_pause_flag);\r
     if(rc >= RC_EXT_BASE)\r
        return w32g_ext_control(rc, *valp);\r
     return rc;\r
@@ -470,7 +471,8 @@ static void ctl_event(CtlEvent *e)
        break;\r
       case CTLE_REFRESH:\r
        TmPanelRefresh();\r
-       TmCanvasRefresh();\r
+       if(TmCanvasMode == TMCM_TRACER)\r
+           TmCanvasRefresh();\r
        break;\r
       case CTLE_RESET:\r
        TmCanvasReset();\r
index d96f7cd..c014bdc 100644 (file)
@@ -94,6 +94,7 @@ static void TmCanvasEnd(HWND hwnd);
 static void TmCanvasRepaint(HWND hwnd);\r
 static void TmCanvasFillRect(RECT *r, COLORREF c);\r
 static HGDIOBJ hgdiobj_hpen, hgdiobj_hbrush;\r
+static void TmCanvasUpdateChannel(void);\r
 \r
 void w32g_init_canvas(HWND hwnd)\r
 {\r
@@ -290,10 +291,9 @@ static void TmDrawBar(int x, int y, int len, int c)
 \r
 static void TmCanvasChannelNote(int status, int ch, int note, int vel)\r
 {\r
-    int v;\r
-    double t, past_time;\r
+    int i, v;\r
     unsigned int onoff;\r
-    int i;\r
+    double t;\r
 \r
     if(ch >= TCTM_MAX_CHANNELS)\r
        return;\r
@@ -302,15 +302,6 @@ static void TmCanvasChannelNote(int status, int ch, int note, int vel)
     onoff <<= (8 * sizeof(onoff) - 1);\r
     set_bitset(&TmCanvas.channel_on_flags[ch], &onoff, note, 1);\r
 \r
-    t = get_current_calender_time();\r
-    past_time = t - TmCanvas.last_bar_time;\r
-    TmCanvas.last_bar_time = t;\r
-\r
-    /* decrease alive time of bar */\r
-    for(i = 0; i < TCTM_MAX_CHANNELS; i++)\r
-       if(!has_bitset(&TmCanvas.channel_on_flags[i]))\r
-           TmCanvas.bar_alive_time[i] -= past_time;\r
-\r
     /* increase alive time of NoteON bar */\r
     if(status == VOICE_ON)\r
     {\r
@@ -320,6 +311,23 @@ static void TmCanvasChannelNote(int status, int ch, int note, int vel)
        if(TmCanvas.bar_alive_time[ch] < t)\r
            TmCanvas.bar_alive_time[ch] = t;\r
     }\r
+}\r
+\r
+static void TmCanvasUpdateChannel(void)\r
+{\r
+    double t, past_time;\r
+    int i, v;\r
+\r
+    t = get_current_calender_time();\r
+    past_time = t - TmCanvas.last_bar_time;\r
+    if(past_time < TM_SEC_PER_BOX)\r
+       return;\r
+    TmCanvas.last_bar_time = t;\r
+\r
+    /* decrease alive time of bar */\r
+    for(i = 0; i < TCTM_MAX_CHANNELS; i++)\r
+       if(!has_bitset(&TmCanvas.channel_on_flags[i]))\r
+           TmCanvas.bar_alive_time[i] -= past_time;\r
 \r
     /* Update bar[] */\r
     for(i = 0; i < TCTM_MAX_CHANNELS; i++)\r
@@ -358,6 +366,7 @@ static void TmCanvasChannelNote(int status, int ch, int note, int vel)
        SelectObject(TmCanvas.hmdc, hgdiobj_hpen);\r
        SelectObject(TmCanvas.hmdc, hgdiobj_hbrush);\r
     }\r
+    TmCanvasRefresh();\r
 }\r
 \r
 static void TmCanvasFillRect(RECT *r, COLORREF c)\r
@@ -532,6 +541,11 @@ int TmCanvasChange(void)
     return rc;\r
 }\r
 \r
+void TmCanvasUpdateInterval(void)\r
+{\r
+    TmCanvasUpdateChannel();\r
+}\r
+\r
 void TmCanvasRefresh(void)\r
 {\r
     if(!TmCanvas.hdc)\r
index b4922df..7896bf3 100644 (file)
@@ -34,7 +34,6 @@
 #include <strings.h>
 #endif
 #include <stdlib.h>
-
 #include <png.h>
 
 #include "timidity.h"
     defined(HAVE_X11_EXTENSIONS_XSHM_H) && \
     defined(HAVE_SYS_IPC_H) && \
     defined(HAVE_SYS_SHM_H)
-#include <X11/extensions/XShm.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
 #define XSHM_SUPPORT 1
 #else
-#undef XSHM_SUPPORT 0
+#define XSHM_SUPPORT 0
 #endif
 #endif /* XSHM_SUPPORT */
 
+#if XSHM_SUPPORT
+#include <X11/extensions/XShm.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif
+
 #define MAX_PLANES             8
 #define MAX_COLORS             (1<<MAX_PLANES)
 #define MAX_VIRTUAL_SCREENS    65536
@@ -78,7 +80,7 @@ typedef struct _ImagePixmap
     XImage             *im;
     GC                 gc;
     int                        depth;
-#ifdef XSHM_SUPPORT
+#if XSHM_SUPPORT
     XShmSegmentInfo    shminfo;
 #endif /* XSHM_SUPPORT */
 } ImagePixmap;
@@ -456,7 +458,7 @@ static int x_sry_open(char *opts)
                                            theDepth);
     imageBitmap = create_shm_image_pixmap(IMAGEBITMAPLEN * CHAR_WIDTH1,
                                          CHAR_HEIGHT,
-                                         1);
+                                         theDepth);
 #else
     theRealScreen = create_image_pixmap(REAL_SCREEN_SIZE_X,
                                        REAL_SCREEN_SIZE_Y,
@@ -1705,6 +1707,9 @@ static void sry_text(uint8 *data)
     str  = (char *)data + 10;
     len  = strlen(str);
 
+    if(len == 0)
+       return;
+
 #ifdef SRY_DEBUG
     printf("%d 0x%02x %d %d %d (%d,%d)\n%s\n",
           screen, mask, mode, fg, bg, tx, ty, str);
@@ -1981,11 +1986,7 @@ static ImagePixmap *create_shm_image_pixmap(int width, int height, int depth)
     ImagePixmap *ip;
     int shm_depth;
 
-    if(depth <= 1)
-       shm_depth = 8;  /* Can't create SHM bitmap. Why ?? */
-    else
-       shm_depth = depth;
-
+    shm_depth = depth;
     ip = (ImagePixmap *)safe_malloc(sizeof(ImagePixmap));
 
     shm_error = 0;
index a76ab22..c2f644c 100644 (file)
@@ -246,6 +246,7 @@ static int InitColor(Colormap cmap, Bool allocate)
     gscreen_plane_mask = 0;
     for(i = 0; i < NUMPLANE; i++)
       gscreen_plane_mask |= mywin.pmask[i];
+    gscreen_plane_mask |= mywin.basepix[0];
   }
 
   for(i=0;i<NUMPXL;i++){
index 812b14c..f544d38 100644 (file)
@@ -34,6 +34,7 @@ char *arc_lib_version = ARC_LIB_VERSION;
 #define ABORT                  -1
 
 ArchiveHandler arc_handler;
+static MBlockList arc_buffer;
 
 typedef struct _ArchiveFileList
 {
@@ -81,7 +82,7 @@ int skip_gzip_header(URL url)
     method = url_getc(url);
     switch(method)
     {
-      case 8: /* deflated */
+      case 8:                  /* deflated */
        method = ARCHIVEC_DEFLATED;
        break;
       default:
@@ -94,8 +95,8 @@ int skip_gzip_header(URL url)
     /* time */
     url_getc(url); url_getc(url); url_getc(url); url_getc(url);
 
-    url_getc(url); /* extra flags */
-    url_getc(url); /* OS type */
+    url_getc(url);             /* extra flags */
+    url_getc(url);             /* OS type */
 
     if(flags & GZIP_MULTIPARTFLAG)
     {
@@ -147,19 +148,19 @@ int skip_gzip_header(URL url)
 
 int parse_gzip_header_bytes(char *gz, long maxparse, int *hdrsiz)
 {
-  URL url = url_mem_open(gz, maxparse, 0);
-  int method;
-
-  if(!url)
-    return -1;
-  method = skip_gzip_header(url);
-  *hdrsiz = url_tell(url);
-  url_close(url);
-  return method;
+    URL url = url_mem_open(gz, maxparse, 0);
+    int method;
+
+    if(!url)
+       return -1;
+    method = skip_gzip_header(url);
+    *hdrsiz = url_tell(url);
+    url_close(url);
+    return method;
 }
 
 void (* arc_error_handler)(char *error_message) = NULL;
-
+    
 static void arc_cant_open(char *s)
 {
     if(arc_error_handler != NULL)
@@ -212,7 +213,7 @@ int get_archive_type(char *archive_name)
     if(url_check_type(archive_name) == URL_dir_t)
        return ARCHIVE_DIR;
 
-    return -1; /* Not found */
+    return -1;                 /* Not found */
 }
 
 static ArchiveFileList *find_arc_filelist(char *basename)
@@ -229,12 +230,12 @@ static ArchiveFileList *find_arc_filelist(char *basename)
 
 ArchiveEntryNode *arc_parse_entry(URL url, int archive_type)
 {
-  ArchiveEntryNode *entry_first, *entry_last, *entry;
-  ArchiveEntryNode *(* next_header_entry)(void);
-  int gzip_method;
-  URL orig;
+    ArchiveEntryNode *entry_first, *entry_last, *entry;
+    ArchiveEntryNode *(* next_header_entry)(void);
+    int gzip_method;
+    URL orig;
 
-  orig = NULL;
+    orig = NULL;
     switch(archive_type)
     {
       case ARCHIVE_TAR:
@@ -261,7 +262,7 @@ ArchiveEntryNode *arc_parse_entry(URL url, int archive_type)
       case ARCHIVE_MIME:
        if(!IS_URL_SEEK_SAFE(url))
        {
-         orig = url;
+           orig = url;
            if((url = url_cache_open(orig, 0)) == NULL)
                return NULL;
        }
@@ -283,13 +284,13 @@ ArchiveEntryNode *arc_parse_entry(URL url, int archive_type)
        else
            entry_first = entry_last = entry;
        while(entry_last->next)
-         entry_last = entry_last->next;
+           entry_last = entry_last->next;
        arc_handler.counter++;
     }
     url_close(url);
     if(orig)
-      url_close(orig);
-    return entry_first; /* Note that NULL if no archive file */
+       url_close(orig);
+    return entry_first;                /* Note that NULL if no archive file */
 }
 
 static ArchiveFileList *add_arc_filelist(char *basename, int archive_type)
@@ -306,8 +307,8 @@ static ArchiveFileList *add_arc_filelist(char *basename, int archive_type)
       case ARCHIVE_LZH:
       case ARCHIVE_MIME:
        break;
-    default:
-      return NULL;
+      default:
+       return NULL;
     }
 
     if((url = url_open(basename)) == NULL)
@@ -326,43 +327,38 @@ static ArchiveFileList *add_arc_filelist(char *basename, int archive_type)
     return afl;
 }
 
-int regist_archive(char *archive_filename, int archive_type)
+static ArchiveFileList *regist_archive(char *archive_filename)
 {
-  if(archive_type < 0)
-    archive_type = get_archive_type(archive_filename);
-  if(archive_type < 0)
-    return 0; /* Unknown archive */
-  archive_filename = url_expand_home_dir(archive_filename);
-  if(find_arc_filelist(archive_filename))
-    return 0; /* Already registerd */
-  if(add_arc_filelist(archive_filename, archive_type))
-    {
-    reuse_mblock(&arc_handler.pool);
-    return 1;
-    }
-  return 0;
+    int archive_type;
+
+    if((archive_type = get_archive_type(archive_filename)) < 0)
+       return NULL;            /* Unknown archive */
+    archive_filename = url_expand_home_dir(archive_filename);
+    if(find_arc_filelist(archive_filename))
+       return NULL;            /* Already registerd */
+    return add_arc_filelist(archive_filename, archive_type);
 }
 
 static int arc_expand_newfile(StringTable *s, ArchiveFileList *afl,
                              char *pattern)
 {
-  ArchiveEntryNode *entry;
-  char *p;
+    ArchiveEntryNode *entry;
+    char *p;
 
-  for(entry = afl->entry_list; entry; entry = entry->next)
+    for(entry = afl->entry_list; entry; entry = entry->next)
     {
-      if(arc_case_wildmat(entry->name, pattern))
+       if(arc_case_wildmat(entry->name, pattern))
        {
-         p = new_segment(&arc_handler.pool, strlen(afl->archive_name) +
-                         strlen(entry->name) + 2);
-         strcpy(p, afl->archive_name);
-         strcat(p, "#");
-         strcat(p, entry->name);
-         if(put_string_table(s, p, strlen(p)) == NULL)
-           return -1;
+           p = new_segment(&arc_buffer, strlen(afl->archive_name) +
+                           strlen(entry->name) + 2);
+           strcpy(p, afl->archive_name);
+           strcat(p, "#");
+           strcat(p, entry->name);
+           if(put_string_table(s, p, strlen(p)) == NULL)
+               return -1;
        }
     }
-  return 0;
+    return 0;
 }
 
 char **expand_archive_names(int *nfiles_in_out, char **files)
@@ -384,7 +380,7 @@ char **expand_archive_names(int *nfiles_in_out, char **files)
     {
        error_flag = 0;
        init_string_table(&stab);
-       pool = &arc_handler.pool;
+       pool = &arc_buffer;
     }
 
     nfiles = *nfiles_in_out;
@@ -408,9 +404,9 @@ char **expand_archive_names(int *nfiles_in_out, char **files)
 
        if((afl = find_arc_filelist(base)) != NULL)
        {
-         if(arc_expand_newfile(&stab, afl, pattern) == -1)
-           goto abort_expand;
-         continue;
+           if(arc_expand_newfile(&stab, afl, pattern) == -1)
+               goto abort_expand;
+           continue;
        }
 
        arc_type = get_archive_type(base);
@@ -478,8 +474,8 @@ char **expand_archive_names(int *nfiles_in_out, char **files)
                len1--;
            while(url_gets(url, buff, sizeof(buff)))
            {
-             if(strcmp(buff, ".") == 0 || strcmp(buff, "..") == 0)
-               continue;
+               if(strcmp(buff, ".") == 0 || strcmp(buff, "..") == 0)
+                   continue;
 
                len2 = strlen(buff);
                p = (char *)new_segment(pool, len1 + len2 + 2);
@@ -500,8 +496,8 @@ char **expand_archive_names(int *nfiles_in_out, char **files)
 
        if((afl = add_arc_filelist(base, arc_type)) != NULL)
        {
-         if(arc_expand_newfile(&stab, afl, pattern) == -1)
-           goto abort_expand;
+           if(arc_expand_newfile(&stab, afl, pattern) == -1)
+               goto abort_expand;
        }
     }
 
@@ -523,21 +519,21 @@ char **expand_archive_names(int *nfiles_in_out, char **files)
 
 ArchiveEntryNode *new_entry_node(char *name, int len)
 {
-  ArchiveEntryNode *entry;
-  entry = (ArchiveEntryNode *)safe_malloc(sizeof(ArchiveEntryNode));
-  memset(entry, 0, sizeof(ArchiveEntryNode));
-  entry->name = (char *)safe_malloc(len + 1);
-  memcpy(entry->name, name, len);
-  entry->name[len] = '\0';
-  return entry;
+    ArchiveEntryNode *entry;
+    entry = (ArchiveEntryNode *)safe_malloc(sizeof(ArchiveEntryNode));
+    memset(entry, 0, sizeof(ArchiveEntryNode));
+    entry->name = (char *)safe_malloc(len + 1);
+    memcpy(entry->name, name, len);
+    entry->name[len] = '\0';
+    return entry;
 }
 
 void free_entry_node(ArchiveEntryNode *entry)
 {
-  free(entry->name);
-  if(entry->cache != NULL)
-    free(entry->cache);
-  free(entry);
+    free(entry->name);
+    if(entry->cache != NULL)
+       free(entry->cache);
+    free(entry);
 }
 
 
@@ -545,27 +541,27 @@ static char *compress_buff;
 long   compress_buff_len;
 static long arc_compress_func(char *buff, long size, void *user_val)
 {
-  if(compress_buff_len <= 0)
-    return 0;
-  if(size > compress_buff_len)
-    size = compress_buff_len;
-  memcpy(buff, compress_buff, size);
-  compress_buff += size;
-  compress_buff_len -= size;
-  return size;
+    if(compress_buff_len <= 0)
+       return 0;
+    if(size > compress_buff_len)
+       size = compress_buff_len;
+    memcpy(buff, compress_buff, size);
+    compress_buff += size;
+    compress_buff_len -= size;
+    return size;
 }
 
 void *arc_compress(void *buff, long bufsiz,
                   int compress_level, long *compressed_size)
 {
-  DeflateHandler compressor;
-  long allocated, offset, space, nbytes;
-  char *compressed;
-
-  compress_buff = (char *)buff;
-  compress_buff_len = bufsiz;
-  compressor = open_deflate_handler(arc_compress_func, NULL,
-                                   compress_level);
+    DeflateHandler compressor;
+    long allocated, offset, space, nbytes;
+    char *compressed;
+
+    compress_buff = (char *)buff;
+    compress_buff_len = bufsiz;
+    compressor = open_deflate_handler(arc_compress_func, NULL,
+                                     compress_level);
     allocated = 1024;
     compressed = (char *)safe_malloc(allocated);
     offset = 0;
@@ -593,13 +589,13 @@ void *arc_compress(void *buff, long bufsiz,
 
 void *arc_decompress(void *buff, long bufsiz, long *decompressed_size)
 {
-  InflateHandler decompressor;
-  long allocated, offset, space, nbytes;
-  char *decompressed;
+    InflateHandler decompressor;
+    long allocated, offset, space, nbytes;
+    char *decompressed;
 
-  compress_buff = (char *)buff;
-  compress_buff_len = bufsiz;
-  decompressor = open_inflate_handler(arc_compress_func, NULL);
+    compress_buff = (char *)buff;
+    compress_buff_len = bufsiz;
+    decompressor = open_inflate_handler(arc_compress_func, NULL);
     allocated = 1024;
     decompressed = (char *)safe_malloc(allocated);
     offset = 0;
@@ -627,36 +623,35 @@ void *arc_decompress(void *buff, long bufsiz, long *decompressed_size)
 
 void free_archive_files(void)
 {
-  ArchiveEntryNode *entry, *ecur;
-  ArchiveFileList *acur;
+    ArchiveEntryNode *entry, *ecur;
+    ArchiveFileList *acur;
 
-  while(arc_filelist)
+    while(arc_filelist)
     {
-      acur = arc_filelist;
-      arc_filelist = arc_filelist->next;
-      entry = acur->entry_list;
-      while(entry)
+       acur = arc_filelist;
+       arc_filelist = arc_filelist->next;
+       entry = acur->entry_list;
+       while(entry)
        {
-         ecur = entry;
-         entry = entry->next;
-         free_entry_node(ecur);
+           ecur = entry;
+           entry = entry->next;
+           free_entry_node(ecur);
        }
-      free(acur->archive_name);
-      free(acur);
+       free(acur->archive_name);
+       free(acur);
     }
 }
 
-
 /******************************************************************************
- * url_arc
- *****************************************************************************/
+* url_arc
+*****************************************************************************/
 typedef struct _URL_arc
 {
     char common[sizeof(struct _URL)];
     URL instream;
     long pos, size;
-  int comptype;
-  void *decoder;
+    int comptype;
+    void *decoder;
 } URL_arc;
 
 static long url_arc_read(URL url, void *buff, long n);
@@ -671,16 +666,16 @@ static long archiver_read_func(char *buff, long buff_size, void *v)
     url = (URL_arc *)v;
 
     if(url->size < 0)
-      n = buff_size;
+       n = buff_size;
     else
-      {
+    {
        n = url->size - url->pos;
        if(n > buff_size)
-         n = buff_size;
-      }
+           n = buff_size;
+    }
 
     if(n <= 0)
-      return 0;
+       return 0;
     n = url_read(url->instream, buff, n);
     if(n <= 0)
        return n;
@@ -700,16 +695,16 @@ URL url_arc_open(char *name)
     if((p = strrchr(name, '#')) == NULL)
        return NULL;
     len = p - name;
-    base = new_segment(&arc_handler.pool, len + 1);
+    base = new_segment(&arc_buffer, len + 1);
     memcpy(base, name, len);
     base[len] = '\0';
     base = url_expand_home_dir(base);
+
     if((afl = find_arc_filelist(base)) == NULL)
-    {
-       reuse_mblock(&arc_handler.pool);
+       afl = regist_archive(base);
+    if(afl == NULL)
        return NULL;
-    }
-    reuse_mblock(&arc_handler.pool); /* free `base' */
+    reuse_mblock(&arc_buffer); /* free `base' */
     name += len + 1;
 
     for(entry = afl->entry_list; entry; entry = entry->next)
@@ -721,14 +716,14 @@ URL url_arc_open(char *name)
        return NULL;
 
     if(entry->cache != NULL)
-      instream = url_mem_open((char *)entry->cache + entry->start,
-                             entry->compsize, 0);
+       instream = url_mem_open((char *)entry->cache + entry->start,
+                               entry->compsize, 0);
     else
-      {
+    {
        if((instream = url_file_open(base)) == NULL)
-         return NULL;
+           return NULL;
        url_seek(instream, entry->start, 0);
-      }
+    }
 
     url = (URL_arc *)alloc_url(sizeof(URL_arc));
     if(url == NULL)
@@ -743,7 +738,6 @@ URL url_arc_open(char *name)
       case ARCHIVEC_STORED:    /* No compression */
       case ARCHIVEC_LZHED_LH0: /* -lh0- */
       case ARCHIVEC_LZHED_LZ4: /* -lz4- */
-       url->comptype = ARCHIVEC_STORED;
        url->decoder = NULL;
 
       case ARCHIVEC_DEFLATED:  /* deflate */
@@ -783,9 +777,9 @@ URL url_arc_open(char *name)
       case ARCHIVEC_LZHED_LH7: /* -lh7- */
        url->decoder =
            (void *)open_unlzh_handler(
-               archiver_read_func,
-               lzh_methods[entry->comptype - ARCHIVEC_LZHED - 1],
-               entry->compsize, entry->origsize, url);
+                                      archiver_read_func,
+                                      lzh_methods[entry->comptype - ARCHIVEC_LZHED - 1],
+                                      entry->compsize, entry->origsize, url);
        if(url->decoder == NULL)
        {
            url_arc_close((URL)url);
@@ -831,6 +825,8 @@ static long url_arc_read(URL url, void *vp, long bufsiz)
     switch(comptype)
     {
       case ARCHIVEC_STORED:
+      case ARCHIVEC_LZHED_LH0: /* -lh0- */
+      case ARCHIVEC_LZHED_LZ4: /* -lz4- */
        n = archiver_read_func(buff, bufsiz, (void *)urlp);
        break;
 
@@ -883,9 +879,9 @@ static void url_arc_close(URL url)
     int save_errno = errno;
 
     /* 1. close decoder 
-     * 2. close decode_stream
-     * 3. free url
-     */
+       * 2. close decode_stream
+           * 3. free url
+               */
 
     decoder = urlp->decoder;
     if(decoder != NULL)
@@ -903,16 +899,16 @@ static void url_arc_close(URL url)
            close_explode_handler((ExplodeHandler)decoder);
            break;
 
-         case ARCHIVEC_LZHED_LH1:      /* -lh1- */
-         case ARCHIVEC_LZHED_LH2:      /* -lh2- */
-         case ARCHIVEC_LZHED_LH3:      /* -lh3- */
-         case ARCHIVEC_LZHED_LH4:      /* -lh4- */
-         case ARCHIVEC_LZHED_LH5:      /* -lh5- */
-         case ARCHIVEC_LZHED_LZS:      /* -lzs- */
-         case ARCHIVEC_LZHED_LZ5:      /* -lz5- */
-         case ARCHIVEC_LZHED_LHD:      /* -lhd- */
-         case ARCHIVEC_LZHED_LH6:      /* -lh6- */
-         case ARCHIVEC_LZHED_LH7:      /* -lh7- */
+         case ARCHIVEC_LZHED_LH1: /* -lh1- */
+         case ARCHIVEC_LZHED_LH2: /* -lh2- */
+         case ARCHIVEC_LZHED_LH3: /* -lh3- */
+         case ARCHIVEC_LZHED_LH4: /* -lh4- */
+         case ARCHIVEC_LZHED_LH5: /* -lh5- */
+         case ARCHIVEC_LZHED_LZS: /* -lzs- */
+         case ARCHIVEC_LZHED_LZ5: /* -lz5- */
+         case ARCHIVEC_LZHED_LHD: /* -lhd- */
+         case ARCHIVEC_LZHED_LH6: /* -lh6- */
+         case ARCHIVEC_LZHED_LH7: /* -lh7- */
            close_unlzh_handler((UNLZHHandler)decoder);
            break;
 
@@ -926,9 +922,9 @@ static void url_arc_close(URL url)
     }
 
     if(urlp->instream != NULL)
-     url_close(urlp->instream);
-     free(urlp);
-   errno = save_errno;
+       url_close(urlp->instream);
+    free(urlp);
+    errno = save_errno;
 }
 
 
@@ -972,8 +968,8 @@ static char *ParseHex(char *p, int *val)
 }
 
 /*
-**  Match text and p, return TRUE, FALSE, or ABORT.
-*/
+ *  Match text and p, return TRUE, FALSE, or ABORT.
+ */
 static int DoMatch(char *text, char *p)
 {
     register int       last;
@@ -1136,7 +1132,7 @@ int arc_wildmat(char *text, char *p)
 #ifdef OPTIMIZE_JUST_STAR
     if (p[0] == '*' && p[1] == '\0')
        return TRUE;
-#endif /* OPTIMIZE_JUST_STAR */
+#endif /* OPTIMIZE_JUST_STAR */
     return DoMatch(text, p) == TRUE;
 }
 
@@ -1145,6 +1141,6 @@ int arc_case_wildmat(char *text, char *p)
 #ifdef OPTIMIZE_JUST_STAR
     if (p[0] == '*' && p[1] == '\0')
        return TRUE;
-#endif /* OPTIMIZE_JUST_STAR */
+#endif /* OPTIMIZE_JUST_STAR */
     return DoCaseMatch(text, p) == TRUE;
 }
index 5e2abf2..84001c9 100644 (file)
  * Interfaces
  */
 
-extern int regist_archive(char *archive_filename, int archive_type);
-/* Regist archive file name to use url_arc_open */
-
-extern char **expand_archive_names(int *nfiles_in_out, char **files_in_out);
+extern char **expand_archive_names(int *nfiles_in_out, char **files);
 /* Regist all archive files in `files_in_out', and expand the archive */
 
 extern URL url_arc_open(char *name);
-/* Open input stream from registerd archive */
+/* Open input stream from archive.  `name' format must be "filename#entry".
+ */
 
 extern void free_archive_files(void);
 /* Call once at the last */
@@ -40,7 +38,6 @@ extern int arc_wildmat(char *text, char *p);
 extern void (* arc_error_handler)(char *error_message);
 
 
-
 /*
  * Internal library usage only
  */
@@ -61,7 +58,6 @@ typedef struct _ArchiveHandler {
     URL url;   /* Input stream */
     int counter;/* counter to extract the entry*/
     long pos;
-    MBlockList pool;
 } ArchiveHandler;
 
 extern ArchiveHandler arc_handler;
index 6bf2669..04be69d 100644 (file)
@@ -360,7 +360,7 @@ wrd_read.o: wrd_read.c ../config.h timidity.h ../utils/support.h \
        readmidi.h controls.h wrd.h ../utils/strtab.h
 wrdt.o: wrdt.c ../config.h timidity.h ../utils/support.h common.h \
        ../libarc/url.h ../utils/mblock.h wrd.h ../utils/strtab.h \
-       instrum.h playmidi.h readmidi.h
+       instrum.h playmidi.h readmidi.h ../libarc/arc.h
 
 info-am:
 info: info-am
index c82f0f4..62b6a91 100644 (file)
@@ -594,6 +594,7 @@ int aq_flush(int discard)
              break;
          }
     }
+
     trace_flush();
     play_mode->acntl(PM_REQ_FLUSH, NULL);
     play_counter = play_offset_counter = 0;
index 8b388fb..cff3820 100644 (file)
@@ -62,6 +62,7 @@
 char *program_name, current_filename[1024];
 MBlockList tmpbuffer;
 char *output_text_code = NULL;
+int open_file_noise_mode = OF_NORMAL;
 
 #ifdef DEFAULT_PATH
     /* The paths in this list will be tried whenever we're reading a file */
@@ -290,6 +291,7 @@ struct timidity_file *open_file(char *name, int decompress, int noise_mode)
   PathList *plp=pathlist;
   int l;
 
+  open_file_noise_mode = noise_mode;
   if (!name || !(*name))
     {
       if(noise_mode)
@@ -876,6 +878,7 @@ char **expand_file_archives(char **files, int *nfiles_in_out)
 
     /* Second, expand archive files */
     new_nfiles = nfiles;
+    open_file_noise_mode = OF_NORMAL;
     new_files = expand_archive_names(&new_nfiles, files);
     free(files[0]);
     free(files);
index 0753487..8094bd3 100644 (file)
@@ -101,7 +101,8 @@ enum {
     CTLE_REFRESH,
     CTLE_RESET,
     CTLE_SPEANA,               /* v1:double[] v2:len */
-    CTLE_PAUSE                 /* v1:pause on/off v2:time of pause */
+    CTLE_PAUSE,                        /* v1:pause on/off v2:time of pause */
+    CTLE_GSLCD                 /* GS L.C.D. */
 };
 
 typedef struct _CtlEvent {
index 9397fab..e70055c 100644 (file)
@@ -61,6 +61,9 @@
 #include "playmidi.h"
 #include "miditrace.h"
 
+/* It is possible count_info.bytes > written bytes. bug? */
+#define BYTES_PROCESSED_BUGFIX 1
+
 #ifndef AFMT_S16_NE
 #ifdef LITTLE_ENDIAN
 #define AFMT_S16_NE AFMT_S16_LE
@@ -73,6 +76,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 output_counter, counter_offset;
 
 /* export the playback mode */
 
@@ -92,7 +96,6 @@ PlayMode dpm = {
     acntl
 };
 
-
 /*************************************************************************/
 /* We currently only honor the PE_MONO bit, the sample rate, and the
    number of buffer fragments. We try 16-bit signed data first, and
@@ -226,6 +229,7 @@ static int open_output(void)
 #endif
 
     dpm.fd = fd;
+    output_counter = counter_offset = 0;
 
     return warnings;
 }
@@ -233,6 +237,15 @@ static int open_output(void)
 static int output_data(char *buf, int32 nbytes)
 {
     int n;
+    count_info cinfo;
+
+    ioctl(dpm.fd, SNDCTL_DSP_GETOPTR, &cinfo);
+    if(output_counter < cinfo.bytes)
+    {
+       counter_offset += output_counter;
+       ioctl(dpm.fd, SNDCTL_DSP_SYNC);
+       output_counter = 0;
+    }
 
     while(nbytes > 0)
     {
@@ -257,6 +270,7 @@ static int output_data(char *buf, int32 nbytes)
        }
        buf += n;
        nbytes -= n;
+       output_counter += n;
     }
 
     return 0;
@@ -278,16 +292,21 @@ static int acntl(int request, void *arg)
 
     switch(request)
     {
-    case PM_REQ_GETQSIZ:
-      if(ioctl(dpm.fd, SNDCTL_DSP_GETOSPACE, &info) == -1)
-       return -1;
-      total = info.fragstotal * info.fragsize;
-      *((int *)arg) = total;
-      return 0;
+      case PM_REQ_GETQSIZ:
+       if(ioctl(dpm.fd, SNDCTL_DSP_GETOSPACE, &info) == -1)
+         return -1;
+       total = info.fragstotal * info.fragsize;
+       *((int *)arg) = total;
+       return 0;
 
       case PM_REQ_DISCARD:
+       counter_offset = output_counter = 0;
        return ioctl(dpm.fd, SNDCTL_DSP_RESET);
 
+      case PM_REQ_FLUSH:
+       counter_offset = output_counter = 0;
+       return ioctl(dpm.fd, SNDCTL_DSP_SYNC);
+
       case PM_REQ_RATE: {
          int rate;
          rate = *(int *)arg;
@@ -325,14 +344,11 @@ static int acntl(int request, void *arg)
     case PM_REQ_GETSAMPLES:
       if(ioctl(dpm.fd, SNDCTL_DSP_GETOPTR, &cinfo) == -1)
        return -1;
-      bytes = cinfo.bytes;
+      bytes = cinfo.bytes + counter_offset;
       if(!(dpm.encoding & PE_MONO)) bytes >>= 1;
       if(dpm.encoding & PE_16BIT) bytes >>= 1;
       *((int *)arg) = bytes;
       return 0;
-
-    case PM_REQ_FLUSH:
-      return ioctl(dpm.fd, SNDCTL_DSP_SYNC);
     }
     return -1;
 }
index 098d50b..a05b0e2 100644 (file)
@@ -253,6 +253,7 @@ static char *event_name(int type)
        EVENT_NAME(ME_TEMPO);
        EVENT_NAME(ME_CHORUS_TEXT);
        EVENT_NAME(ME_LYRIC);
+       EVENT_NAME(ME_GSLCD);
        EVENT_NAME(ME_MARKER);
        EVENT_NAME(ME_INSERT_TEXT);
        EVENT_NAME(ME_TEXT);
@@ -3041,11 +3042,7 @@ static int apply_controls(void)
        if(intr)
            return RC_QUIT;
        if(play_pause_flag)
-#ifdef HAVE_USLEEP
            usleep(300000);
-#else
-           sleep(1);
-#endif
     } while (rc != RC_NONE || play_pause_flag);
     return jump_flag ? RC_JUMP : RC_NONE;
 }
@@ -3843,6 +3840,11 @@ int play_event(MidiEvent *ev)
        ctl_mode_event(CTLE_LYRIC, 1, i, 0);
        break;
 
+      case ME_GSLCD:
+       i = ev->a | ((int)ev->b << 8);
+       ctl_mode_event(CTLE_GSLCD, 1, i, 0);
+       break;
+
       case ME_MASTER_VOLUME:
        master_volume_ratio = (int32)ev->a + 256 * (int32)ev->b;
        adjust_master_volume();
@@ -4142,9 +4144,9 @@ void ctl_mode_event(int type, int trace, long arg1, long arg2)
     ce.type = type;
     ce.v1 = arg1;
     ce.v2 = arg2;
-    if(trace && ctl->trace_playing && !midi_trace.flush_flag)
+    if(trace && ctl->trace_playing)
        push_midi_trace_ce(ctl->event, &ce);
-    else if(ctl->event != NULL)
+    else
        ctl->event(&ce);
 }
 
@@ -4156,7 +4158,7 @@ void ctl_note_event(int noteID)
     ce.v2 = voice[noteID].channel;
     ce.v3 = voice[noteID].note;
     ce.v4 = voice[noteID].velocity;
-    if(ctl->trace_playing && !midi_trace.flush_flag)
+    if(ctl->trace_playing)
        push_midi_trace_ce(ctl->event, &ce);
     else
        ctl->event(&ce);
@@ -4177,26 +4179,18 @@ static void ctl_timestamp(void)
     ce.type = CTLE_CURRENT_TIME;
     ce.v1 = last_secs = secs;
     ce.v2 = last_voices = voices;
-    if(ctl->trace_playing && !midi_trace.flush_flag)
+    if(ctl->trace_playing)
        push_midi_trace_ce(ctl->event, &ce);
-    else if(ctl->event)
+    else
        ctl->event(&ce);
 }
 
 static void ctl_updatetime(int32 samples)
 {
     long secs;
-    CtlEvent ce;
-
     secs = (long)(samples / (midi_time_ratio * play_mode->rate));
-    ce.type = CTLE_CURRENT_TIME;
-    ce.v1 = secs;
-    ce.v2 = 0;
-    if(ctl->event)
-    {
-       ctl->event(&ce);
-       ctl_mode_event(CTLE_REFRESH, 0, 0, 0);
-    }
+    ctl_mode_event(CTLE_CURRENT_TIME, 0, secs, 0);
+    ctl_mode_event(CTLE_REFRESH, 0, 0, 0);
 }
 
 static void ctl_prog_event(int ch)
@@ -4206,7 +4200,7 @@ static void ctl_prog_event(int ch)
     ce.v1 = ch;
     ce.v2 = channel[ch].program;
     ce.v3 = (long)channel_instrum_name(ch);
-    if(ctl->trace_playing && !midi_trace.flush_flag)
+    if(ctl->trace_playing)
        push_midi_trace_ce(ctl->event, &ce);
     else
        ctl->event(&ce);
@@ -4214,14 +4208,9 @@ static void ctl_prog_event(int ch)
 
 static void ctl_pause_event(int pause, int32 s)
 {
-    if(ctl->event)
-    {
-       CtlEvent ce;
-       ce.type = CTLE_PAUSE;
-       ce.v1 = pause;
-       ce.v2 = (long)(s / (midi_time_ratio * play_mode->rate));
-       ctl->event(&ce);
-    }
+    long secs;
+    secs = (long)(s / (midi_time_ratio * play_mode->rate));
+    ctl_mode_event(CTLE_PAUSE, 0, pause, secs);
 }
 
 char *channel_instrum_name(int ch)
index 23ed7bc..c22a872 100644 (file)
@@ -104,6 +104,7 @@ enum midi_event_t
     ME_TEMPO,
     ME_CHORUS_TEXT,
     ME_LYRIC,
+    ME_GSLCD,  /* GS L.C.D. Exclusive message event */
     ME_MARKER,
     ME_INSERT_TEXT, /* for SC */
     ME_TEXT,
index 53b5c81..7922aa4 100644 (file)
@@ -259,15 +259,14 @@ static char *readmidi_make_lcd_event(int type, const uint8 *data, MidiEvent *ev)
     a = (string_event_strtab.nstring & 0xff);
     b = ((string_event_strtab.nstring >> 8) & 0xff);
 
-    len = 7+128;
+    len = 128;
     
-       text = (char *)new_segment(&tmpbuffer, len + 1);
+       text = (char *)new_segment(&tmpbuffer, len + 2);
 
-    strcpy(text+1, "gslcd: ");
     for( i=0; i<64; i++){
        const char tbl[]= "0123456789ABCDEF";
-       text[8+i*2  ]=tbl[data[i]>>4];
-       text[8+i*2+1]=tbl[data[i]&0xF];
+       text[1+i*2  ]=tbl[data[i]>>4];
+       text[1+i*2+1]=tbl[data[i]&0xF];
     }
     text[len + 1] = '\0';
     
@@ -694,7 +693,7 @@ int parse_sysex_event(uint8 *val, int32 len, MidiEvent *ev)
        len -= 2;
        save = val[len];
        val[len] = '\0';
-       if(readmidi_make_lcd_event(ME_INSERT_TEXT, (uint8 *)val + 7, ev))
+       if(readmidi_make_lcd_event(ME_GSLCD, (uint8 *)val + 7, ev))
        {
            val[len] = save;
            return 1;
index aadaee3..8cbdf32 100644 (file)
@@ -1154,8 +1154,15 @@ MAIN_INTERFACE int read_config_file(char *name, int self)
            extension_flag = 0;
            i = 0;
        }
+
+       /* Chop the comment.
+        * Comment delimiter =~ /^#|\s#|#[ \t]/
+        */
        if((cp = strchr(tmp + i, '#')) != NULL) {
-           if(cp == tmp + i || isspace((int)cp[-1]) || isspace((int)cp[1]))
+           if(cp == tmp + i ||         /* beginning of line */
+              isspace((int)cp[-1]) ||  /* "\s#" */
+              cp[1] == ' ' ||          /* "#[ \t]" */
+              cp[1] == '\t')
                *cp = '\0';
        }
 
@@ -2670,7 +2677,7 @@ static RETSIGTYPE sigterm_exit(int sig)
     s[2] = '\n';
     write(2, s, 3);
 
-    if(sig == SIGINT && intr < 5)
+    if(sig == SIGINT && intr < 3)
     {
        intr++;
        signal(SIGINT, sigterm_exit); /* For SysV base */
@@ -2682,7 +2689,9 @@ static RETSIGTYPE sigterm_exit(int sig)
 
 static void timidity_arc_error_handler(char *error_message)
 {
-    ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "%s", error_message);
+    extern int open_file_noise_mode;
+    if(open_file_noise_mode)
+       ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "%s", error_message);
 }
 
 MAIN_INTERFACE void timidity_start_initialize(void)
index 789d2fd..3fe8e8f 100644 (file)
@@ -36,6 +36,7 @@
 #include "instrum.h"
 #include "playmidi.h"
 #include "readmidi.h"
+#include "arc.h"
 
 /*
  * Remap WRD @COLOR(16)-@COLOR(23) to RGB plain number.
@@ -125,62 +126,70 @@ WRDTracer *wrdt = &null_wrdt_mode;
 
 static StringTable path_list;
 static StringTable default_path_list;
+static int wrd_add_path_one(char *path, int pathlen);
 
 void wrd_init_path(void)
 {
     StringTableNode *p;
     delete_string_table(&path_list);
     for(p = default_path_list.head; p; p = p->next)
-       wrd_add_path(p->string, 0);
-    if(current_file_info && strchr(current_file_info->filename, '#') != NULL)
-       wrd_add_path(current_file_info->filename,
-                    strchr(current_file_info->filename, '#') -
-                    current_file_info->filename + 1);
-    if(current_file_info &&
-       strrchr(current_file_info->filename, PATH_SEP) != NULL)
-       wrd_add_path(current_file_info->filename,
-                    strrchr(current_file_info->filename, PATH_SEP) -
-                    current_file_info->filename + 1);
+       wrd_add_path_one(p->string, strlen(p->string));
+
+    if(current_file_info)
+    {
+       if(strchr(current_file_info->filename, '#') != NULL)
+           wrd_add_path_one(current_file_info->filename,
+                            strchr(current_file_info->filename, '#') -
+                            current_file_info->filename + 1);
+       if(strrchr(current_file_info->filename, PATH_SEP) != NULL)
+           wrd_add_path_one(current_file_info->filename,
+                            strrchr(current_file_info->filename, PATH_SEP) -
+                            current_file_info->filename + 1);
+    }
+}
+
+static int wrd_add_path_one(char *path, int pathlen)
+{
+    int exists;
+    StringTableNode *p;
+
+    exists = 0;
+    for(p = path_list.head; p; p = p->next)
+       if(strncmp(p->string, path, pathlen) == 0 &&
+          p->string[pathlen] == '\0')
+       {
+           exists = 1;
+           break;
+       }
+    if(exists)
+       return 0;
+    put_string_table(&path_list, path, pathlen);
+    return 1;
 }
 
 void wrd_add_path(char *path, int pathlen)
 {
     if(pathlen == 0)
        pathlen = strlen(path);
-    if(pathlen > 0)
+    if(!wrd_add_path_one(path, pathlen))
+       return;
+
+    if(current_file_info &&
+       get_archive_type(current_file_info->filename) != -1)
     {
-       int exists;
-       StringTableNode *p;
-
-       exists = 0;
-       for(p = path_list.head; p; p = p->next)
-           if(strncmp(p->string, path, pathlen) == 0)
-           {
-               exists = 1;
-               break;
-           }
-       if(!exists)
-       {
-           put_string_table(&path_list, path, pathlen);
-           if(current_file_info &&
-              strchr(current_file_info->filename, '#') != NULL &&
-              path[pathlen - 1] != '#')
-           {
-               MBlockList buf;
-               char *arc_path;
-               int baselen;
-
-               init_mblock(&buf);
-               baselen = strchr(current_file_info->filename, '#') -
-                   current_file_info->filename + 1;
-               arc_path = new_segment(&buf, baselen + pathlen + 1);
-               strncpy(arc_path, current_file_info->filename, baselen);
-               strncpy(arc_path + baselen, path, pathlen);
-               arc_path[baselen + pathlen] = '\0';
-               put_string_table(&path_list, arc_path, strlen(arc_path));
-               reuse_mblock(&buf);
-           }
-       }
+       MBlockList buf;
+       char *arc_path;
+       int baselen;
+
+       init_mblock(&buf);
+       baselen = strrchr(current_file_info->filename, '#') -
+           current_file_info->filename + 1;
+       arc_path = new_segment(&buf, baselen + pathlen + 1);
+       strncpy(arc_path, current_file_info->filename, baselen);
+       strncpy(arc_path + baselen, path, pathlen);
+       arc_path[baselen + pathlen] = '\0';
+       put_string_table(&path_list, arc_path, strlen(arc_path));
+       reuse_mblock(&buf);
     }
 }
 
@@ -218,6 +227,10 @@ struct timidity_file *wrd_open_file(char *filename)
 {
     StringTableNode *path;
     struct timidity_file *tf;
+
+    if(get_archive_type(filename) != -1)
+       return open_file(filename, 0, OF_SILENT);
+
     for(path = path_list.head; path; path = path->next){
        if((tf = try_wrd_open_file(path->string, filename)) != NULL)
            return tf;