diff -ruN TiMidity++-2.4.0/ChangeLog TiMidity++-2.4.1/ChangeLog --- TiMidity++-2.4.0/ChangeLog Mon Aug 9 04:58:32 1999 +++ TiMidity++-2.4.1/ChangeLog Wed Aug 11 21:32:20 1999 @@ -1,3 +1,51 @@ +1999-08-11 Masanao Izumo + + * Version 2.4.1 released. + +1999-08-11 Masanao Izumo + + * 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 + + * 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 + + * 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 * Version 2.4.0 released. diff -ruN TiMidity++-2.4.0/NEWS TiMidity++-2.4.1/NEWS --- TiMidity++-2.4.0/NEWS Mon Aug 9 00:59:36 1999 +++ TiMidity++-2.4.1/NEWS Wed Aug 11 17:17:54 1999 @@ -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. diff -ruN TiMidity++-2.4.0/common.makefile.in TiMidity++-2.4.1/common.makefile.in --- TiMidity++-2.4.0/common.makefile.in Sat Jul 31 19:23:45 1999 +++ TiMidity++-2.4.1/common.makefile.in Wed Aug 11 17:49:20 1999 @@ -26,9 +26,8 @@ #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@ diff -ruN TiMidity++-2.4.0/configure TiMidity++-2.4.1/configure --- TiMidity++-2.4.0/configure Sun Aug 8 18:45:19 1999 +++ TiMidity++-2.4.1/configure Tue Aug 10 18:32:07 1999 @@ -856,7 +856,7 @@ 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; } diff -ruN TiMidity++-2.4.0/configure.in TiMidity++-2.4.1/configure.in --- TiMidity++-2.4.0/configure.in Sun Aug 8 18:42:20 1999 +++ TiMidity++-2.4.1/configure.in Tue Aug 10 18:32:00 1999 @@ -53,7 +53,7 @@ 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 diff -ruN TiMidity++-2.4.0/interface/mac_c.c TiMidity++-2.4.1/interface/mac_c.c --- TiMidity++-2.4.0/interface/mac_c.c Sat Aug 7 22:42:28 1999 +++ TiMidity++-2.4.1/interface/mac_c.c Wed Aug 11 11:53:18 1999 @@ -1005,12 +1005,21 @@ 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; @@ -1204,6 +1213,9 @@ break; case CTLE_LYRIC: ctl_lyric((int)e->v1); + break; + case CTLE_GSLCD: + ctl_gslcd((int)e->v1); break; case CTLE_REFRESH: ctl_refresh(); diff -ruN TiMidity++-2.4.0/interface/ncurs_c.c TiMidity++-2.4.1/interface/ncurs_c.c --- TiMidity++-2.4.0/interface/ncurs_c.c Sun Aug 8 20:40:25 1999 +++ TiMidity++-2.4.1/interface/ncurs_c.c Wed Aug 11 16:44:18 1999 @@ -973,6 +973,8 @@ 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 display_aq_ratio(void) { -#if 1 static int last_rate = -1; int rate, devsiz; @@ -2776,11 +2777,6 @@ 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) diff -ruN TiMidity++-2.4.0/interface/soundspec.c TiMidity++-2.4.1/interface/soundspec.c --- TiMidity++-2.4.0/interface/soundspec.c Mon Jul 19 10:59:26 1999 +++ TiMidity++-2.4.1/interface/soundspec.c Wed Aug 11 11:04:09 1999 @@ -52,11 +52,10 @@ #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 @@ 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) { diff -ruN TiMidity++-2.4.0/interface/w32g.h TiMidity++-2.4.1/interface/w32g.h --- TiMidity++-2.4.0/interface/w32g.h Sun Aug 8 20:26:36 1999 +++ TiMidity++-2.4.1/interface/w32g.h Tue Aug 10 05:48:45 1999 @@ -125,6 +125,7 @@ extern void TmCanvasReset(void); extern void TmCanvasNote(int status, int ch, int note, int vel); extern int TmCanvasChange(void); +extern void TmCanvasUpdateInterval(); extern int TmCanvasMode; /* w32g_c.c */ diff -ruN TiMidity++-2.4.0/interface/w32g_c.c TiMidity++-2.4.1/interface/w32g_c.c --- TiMidity++-2.4.0/interface/w32g_c.c Sun Aug 8 20:27:04 1999 +++ TiMidity++-2.4.1/interface/w32g_c.c Wed Aug 11 21:56:07 1999 @@ -82,6 +82,7 @@ static int ctl_open(int using_stdin, int using_stdout) { ctl.opened = 1; + set_trace_loop_hook(TmCanvasUpdateInterval); return w32g_open(); } @@ -225,7 +226,7 @@ { int rc; - rc = w32g_get_rc(valp, 0); + rc = w32g_get_rc(valp, play_pause_flag); if(rc >= RC_EXT_BASE) return w32g_ext_control(rc, *valp); return rc; @@ -470,7 +471,8 @@ break; case CTLE_REFRESH: TmPanelRefresh(); - TmCanvasRefresh(); + if(TmCanvasMode == TMCM_TRACER) + TmCanvasRefresh(); break; case CTLE_RESET: TmCanvasReset(); diff -ruN TiMidity++-2.4.0/interface/w32g_canvas.c TiMidity++-2.4.1/interface/w32g_canvas.c --- TiMidity++-2.4.0/interface/w32g_canvas.c Mon Aug 2 13:19:34 1999 +++ TiMidity++-2.4.1/interface/w32g_canvas.c Tue Aug 10 06:21:00 1999 @@ -94,6 +94,7 @@ static void TmCanvasRepaint(HWND hwnd); static void TmCanvasFillRect(RECT *r, COLORREF c); static HGDIOBJ hgdiobj_hpen, hgdiobj_hbrush; +static void TmCanvasUpdateChannel(void); void w32g_init_canvas(HWND hwnd) { @@ -290,10 +291,9 @@ static void TmCanvasChannelNote(int status, int ch, int note, int vel) { - int v; - double t, past_time; + int i, v; unsigned int onoff; - int i; + double t; if(ch >= TCTM_MAX_CHANNELS) return; @@ -302,15 +302,6 @@ onoff <<= (8 * sizeof(onoff) - 1); set_bitset(&TmCanvas.channel_on_flags[ch], &onoff, note, 1); - t = get_current_calender_time(); - past_time = t - TmCanvas.last_bar_time; - TmCanvas.last_bar_time = t; - - /* decrease alive time of bar */ - for(i = 0; i < TCTM_MAX_CHANNELS; i++) - if(!has_bitset(&TmCanvas.channel_on_flags[i])) - TmCanvas.bar_alive_time[i] -= past_time; - /* increase alive time of NoteON bar */ if(status == VOICE_ON) { @@ -320,6 +311,23 @@ if(TmCanvas.bar_alive_time[ch] < t) TmCanvas.bar_alive_time[ch] = t; } +} + +static void TmCanvasUpdateChannel(void) +{ + double t, past_time; + int i, v; + + t = get_current_calender_time(); + past_time = t - TmCanvas.last_bar_time; + if(past_time < TM_SEC_PER_BOX) + return; + TmCanvas.last_bar_time = t; + + /* decrease alive time of bar */ + for(i = 0; i < TCTM_MAX_CHANNELS; i++) + if(!has_bitset(&TmCanvas.channel_on_flags[i])) + TmCanvas.bar_alive_time[i] -= past_time; /* Update bar[] */ for(i = 0; i < TCTM_MAX_CHANNELS; i++) @@ -358,6 +366,7 @@ SelectObject(TmCanvas.hmdc, hgdiobj_hpen); SelectObject(TmCanvas.hmdc, hgdiobj_hbrush); } + TmCanvasRefresh(); } static void TmCanvasFillRect(RECT *r, COLORREF c) @@ -530,6 +539,11 @@ } TmCanvasReset(); return rc; +} + +void TmCanvasUpdateInterval(void) +{ + TmCanvasUpdateChannel(); } void TmCanvasRefresh(void) diff -ruN TiMidity++-2.4.0/interface/x_sherry.c TiMidity++-2.4.1/interface/x_sherry.c --- TiMidity++-2.4.0/interface/x_sherry.c Mon Jul 19 14:45:30 1999 +++ TiMidity++-2.4.1/interface/x_sherry.c Wed Aug 11 11:04:21 1999 @@ -34,7 +34,6 @@ #include #endif #include - #include #include "timidity.h" @@ -49,15 +48,18 @@ defined(HAVE_X11_EXTENSIONS_XSHM_H) && \ defined(HAVE_SYS_IPC_H) && \ defined(HAVE_SYS_SHM_H) -#include -#include -#include #define XSHM_SUPPORT 1 #else -#undef XSHM_SUPPORT 0 +#define XSHM_SUPPORT 0 #endif #endif /* XSHM_SUPPORT */ +#if XSHM_SUPPORT +#include +#include +#include +#endif + #define MAX_PLANES 8 #define MAX_COLORS (1<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 @@ case ARCHIVE_LZH: case ARCHIVE_MIME: break; - default: - return NULL; + default: + return NULL; } if((url = url_open(basename)) == NULL) @@ -326,43 +327,38 @@ 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 @@ { error_flag = 0; init_string_table(&stab); - pool = &arc_handler.pool; + pool = &arc_buffer; } nfiles = *nfiles_in_out; @@ -408,9 +404,9 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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_decompress(void *buff, long bufsiz, long *decompressed_size) { - 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); + 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); allocated = 1024; decompressed = (char *)safe_malloc(allocated); offset = 0; @@ -627,36 +623,35 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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 @@ } /* -** 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 @@ #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 @@ #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; } diff -ruN TiMidity++-2.4.0/libarc/arc.h TiMidity++-2.4.1/libarc/arc.h --- TiMidity++-2.4.0/libarc/arc.h Sat Aug 7 21:38:26 1999 +++ TiMidity++-2.4.1/libarc/arc.h Wed Aug 11 18:52:05 1999 @@ -16,14 +16,12 @@ * 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 void (* arc_error_handler)(char *error_message); - /* * Internal library usage only */ @@ -61,7 +58,6 @@ URL url; /* Input stream */ int counter;/* counter to extract the entry*/ long pos; - MBlockList pool; } ArchiveHandler; extern ArchiveHandler arc_handler; diff -ruN TiMidity++-2.4.0/timidity/Makefile.in TiMidity++-2.4.1/timidity/Makefile.in --- TiMidity++-2.4.0/timidity/Makefile.in Mon Aug 9 06:10:37 1999 +++ TiMidity++-2.4.1/timidity/Makefile.in Wed Aug 11 22:06:54 1999 @@ -360,7 +360,7 @@ 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 diff -ruN TiMidity++-2.4.0/timidity/aq.c TiMidity++-2.4.1/timidity/aq.c --- TiMidity++-2.4.0/timidity/aq.c Sun Aug 8 01:25:05 1999 +++ TiMidity++-2.4.1/timidity/aq.c Wed Aug 11 16:53:04 1999 @@ -594,6 +594,7 @@ break; } } + trace_flush(); play_mode->acntl(PM_REQ_FLUSH, NULL); play_counter = play_offset_counter = 0; diff -ruN TiMidity++-2.4.0/timidity/common.c TiMidity++-2.4.1/timidity/common.c --- TiMidity++-2.4.0/timidity/common.c Sun Aug 8 20:21:20 1999 +++ TiMidity++-2.4.1/timidity/common.c Wed Aug 11 18:56:40 1999 @@ -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 @@ PathList *plp=pathlist; int l; + open_file_noise_mode = noise_mode; if (!name || !(*name)) { if(noise_mode) @@ -876,6 +878,7 @@ /* 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); diff -ruN TiMidity++-2.4.0/timidity/controls.h TiMidity++-2.4.1/timidity/controls.h --- TiMidity++-2.4.0/timidity/controls.h Sat Jul 31 00:13:32 1999 +++ TiMidity++-2.4.1/timidity/controls.h Wed Aug 11 11:44:27 1999 @@ -101,7 +101,8 @@ 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 { diff -ruN TiMidity++-2.4.0/timidity/linux_a.c TiMidity++-2.4.1/timidity/linux_a.c --- TiMidity++-2.4.0/timidity/linux_a.c Sun Aug 8 20:58:15 1999 +++ TiMidity++-2.4.1/timidity/linux_a.c Wed Aug 11 11:04:30 1999 @@ -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 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 @@ 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 @@ #endif dpm.fd = fd; + output_counter = counter_offset = 0; return warnings; } @@ -233,6 +237,15 @@ 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 @@ } buf += n; nbytes -= n; + output_counter += n; } return 0; @@ -278,16 +292,21 @@ 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 @@ 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; } diff -ruN TiMidity++-2.4.0/timidity/playmidi.c TiMidity++-2.4.1/timidity/playmidi.c --- TiMidity++-2.4.0/timidity/playmidi.c Mon Aug 9 03:41:01 1999 +++ TiMidity++-2.4.1/timidity/playmidi.c Wed Aug 11 17:04:59 1999 @@ -253,6 +253,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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_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) diff -ruN TiMidity++-2.4.0/timidity/playmidi.h TiMidity++-2.4.1/timidity/playmidi.h --- TiMidity++-2.4.0/timidity/playmidi.h Mon Aug 9 03:33:58 1999 +++ TiMidity++-2.4.1/timidity/playmidi.h Wed Aug 11 16:53:09 1999 @@ -104,6 +104,7 @@ 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, diff -ruN TiMidity++-2.4.0/timidity/readmidi.c TiMidity++-2.4.1/timidity/readmidi.c --- TiMidity++-2.4.0/timidity/readmidi.c Mon Aug 9 03:35:59 1999 +++ TiMidity++-2.4.1/timidity/readmidi.c Wed Aug 11 11:48:42 1999 @@ -259,15 +259,14 @@ 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 @@ 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; diff -ruN TiMidity++-2.4.0/timidity/timidity.c TiMidity++-2.4.1/timidity/timidity.c --- TiMidity++-2.4.0/timidity/timidity.c Sun Aug 8 22:20:49 1999 +++ TiMidity++-2.4.1/timidity/timidity.c Wed Aug 11 18:55:50 1999 @@ -1154,8 +1154,15 @@ 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 @@ 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 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) diff -ruN TiMidity++-2.4.0/timidity/wrdt.c TiMidity++-2.4.1/timidity/wrdt.c --- TiMidity++-2.4.0/timidity/wrdt.c Mon Aug 9 03:37:19 1999 +++ TiMidity++-2.4.1/timidity/wrdt.c Wed Aug 11 19:01:12 1999 @@ -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 @@ 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) - { - int exists; - StringTableNode *p; + if(!wrd_add_path_one(path, pathlen)) + return; - 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); - } - } + if(current_file_info && + get_archive_type(current_file_info->filename) != -1) + { + 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 @@ { 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;