diff -ruN TiMidity++-2.9.0/ChangeLog TiMidity++-2.9.1/ChangeLog --- TiMidity++-2.9.0/ChangeLog Sun Feb 27 22:49:44 2000 +++ TiMidity++-2.9.1/ChangeLog Tue Mar 21 04:51:42 2000 @@ -1,3 +1,109 @@ +2000-02-21 Masanao Izumo + + * Version 2.9.1 released. + +2000-02-20 Masanao Izumo + * libarc/arc_tar.c: Fixed memory leak. + * libarc/url.c: url_dump(): Avoid return NULL if nbytes is zero. + * timidity/controls.h: Redefine RC_NONE + * timidity/wrdt.c: __W32G__ => IA_W32GUI + * timidity/mod2midi.c: period2note(): Fixed to search the period note + between 0 and 119. + +2000-02-12 Eric A. Welsh + * timidity/recache.c: cache_resampling() + Defined RESAMPLATION_CACHE, INTERPVARS_CACHE + Cache resampling should be the same as what is used for + non-cached notes, or else things will sound strange + * timidity/playmidi.c: compute_data() + reduce_quality_flag was being set while the buffer was being + filled (beginning of file, or after an unpause). + !aq_fill_buffer_flag keeps this from happening. + Also, the flag was sometimes being set due to round off errors + when it should not have been. The (double) casting and < 99.5 + check fix this problem. + +2000-02-12 Eric A. Welsh + + * timidity/playmidi.c: fixed bug when resampling hit the end + of a sample (mixing did not happen for the last portion of the + sample) + * timidity/resample.c: set voice[i].timeout to 1 when resampling + hits the end of a sample + +2000-02-11 Paolo Bonizni + + * timidity/mod.c: Fixed effect Fxy interpretation (xy=32 sets + speed, not tempo) + * timidity/readmidi.[ch]: added tempo_adjust variable + * timidity/timidity.c: added -T option + +2000-03-11 Daisuke Aoki + * configs/msc-config.h, + interface/{w32g.h,w32g_c.c,w32g_i.c,w32g_playlist.c,w32g_pref.c, + w32g_res.h,w32g_res.rc,w32g_subwin.c,w32g_ut2.c,w32g_ut2.h, + w32g_utl.c},timidity/wrdt.c: + Upgrade Windows version. + - Enable to resize Doc Window and List Window. And also + enable to select the font. + - Fixed bugs for displaying + * libarc/arc_lzh: Fixed some probrems + +2000-03-08 Masanao Izumo + + * timidity/{playmidi.h}: Change ME_PATCH_OFFS enum position. + * timidity/{mod2midi.c} (period2note): Fix to scan period_table[0..119]. + +2000-03-08 Paolo Bonzini + + * timidity/{mod.c,mod2midi.c}: Bug fix + +2000-03-07 Masanao Izumo + + * timidity/mod2midi.c: Check error condition of return value of + period2note, and use ctl->cmsg() to display the warning message + instead of printf(). + +2000-03-06 Paolo Bonzini + + * timidity/mod2midi.c: Bug fix + * timidity/playmidi.c (ME_PATCH_OFFS): Bug fix + +2000-03-05 Paolo Bonzini + + * timidity/mod.c: fixed endless loop in the player + * timidity/mod2midi.c: Voice_SetPeriod does not reset the sample (involved + switching from ME_EXPRESSION to ME_KEYPRESSURE for volumes). Changed + release time to 80 msec. + * timidity/readmidi.h: made MidiEventList a doubly-linked list + * timidity/readmidi.c: implemented doubly-linked-list in readmidi_add_event, + and removed BACKWARD_EVENT_OK because the new implementation + removed the inefficiency of backward events. + +2000-03-05 Sawada Keiji + + * libarc/url_ftp.c: Bug fix. + +2000-03-04 Mikhail Yakshin + + * timidity/{timidity.c,common.c}: Convert the text code + from windows-1251 to koi8-r with command line option `-t 1251'. + +2000-03-03 Masanao Izumo + + * timidity/C/timidity.cfg.5,timidity/ja_JP.ujis/timidity.cfg.5: update. + +2000-03-02 Masanao Izumo + + * timidity/timidity.c (-R): Reset pseudo reverb (modify release) + if `-R -1' is specified. + * timidity/mod2midi.c: Enable to change release envelope time of + the module file if command line option `-R' is specified. + +2000-03-02 Paolo Bonzini + + * timidity/mod2midi.c: Solves a problem with low notes. + 2000-02-27 Masanao Izumo * Version 2.9.0 released. diff -ruN TiMidity++-2.9.0/NEWS TiMidity++-2.9.1/NEWS --- TiMidity++-2.9.0/NEWS Sun Feb 27 22:49:52 2000 +++ TiMidity++-2.9.1/NEWS Tue Mar 21 04:51:46 2000 @@ -1,6 +1,11 @@ +03/21, 2000 + * Version 2.9.1 released. + * New command line option -T n: + Adjust tempo to n%; 120=play MOD files with an NTSC Amiga's timing. + 02/27, 2000 * Version 2.9.0 released. - * Support full module player. + * Support full module midi files. 02/07, 2000 * Version 2.8.2 released. diff -ruN TiMidity++-2.9.0/configs/msc-config.h TiMidity++-2.9.1/configs/msc-config.h --- TiMidity++-2.9.0/configs/msc-config.h Sun Feb 27 22:50:51 2000 +++ TiMidity++-2.9.1/configs/msc-config.h Tue Mar 21 04:52:28 2000 @@ -9,19 +9,21 @@ // #undef const /* Define if you don't have vprintf but do have _doprnt. */ -// #undef HAVE_DOPRNT +#undef HAVE_DOPRNT /* Define if you have a working `mmap' system call. */ -// #undef HAVE_MMAP +#undef HAVE_MMAP /* Define if you have that is POSIX.1 compatible. */ -// #undef HAVE_SYS_WAIT_H +#undef HAVE_SYS_WAIT_H /* Define if you have the vprintf function. */ +// #undef HAVE_VPRINTF #define HAVE_VPRINTF /* Define as __inline if that's what the C compiler calls it. */ -#define inline +// #undef inline +#define inline __inline /* Define to `long' if doesn't define. */ // #undef off_t @@ -30,6 +32,7 @@ // #undef pid_t /* Define as the return type of signal handlers (int or void). */ +// #undef RETSIGTYPE #define RETSIGTYPE int /* Define if the setvbuf function takes the buffering type as its second @@ -48,7 +51,7 @@ /* Define if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ -// #undef WORDS_BIGENDIAN +#undef WORDS_BIGENDIAN /* Define if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING @@ -56,11 +59,16 @@ /* Define if you have the XShmCreatePixmap function. */ #undef HAVE_XSHMCREATEPIXMAP +/* Define if you have the XmuRegisterExternalAgent function. */ +#undef HAVE_XMUREGISTEREXTERNALAGENT + /* Define if you have the getcwd function. */ +// #undef HAVE_GETCWD #define HAVE_GETCWD /* Define if you have the gethostbyname function. */ -#undef HAVE_GETHOSTBYNAME +// #undef HAVE_GETHOSTBYNAME +#define HAVE_GETHOSTBYNAME /* Define if you have the getopt function. */ #undef HAVE_GETOPT @@ -71,41 +79,68 @@ /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY +/* Define if you have the isatty function. */ +// #undef HAVE_ISATTY +#define HAVE_ISATTY + /* Define if you have the popen function. */ -#undef HAVE_POPEN +// #undef HAVE_POPEN +#ifdef _MSC_VER +#define HAVE_POPEN +#define popen _popen +#define pclose _pclose +#endif /* Define if you have the select function. */ -#undef HAVE_SELECT +// #undef HAVE_SELECT +#define HAVE_SELECT /* Define if you have the signal function. */ -#undef HAVE_SIGNAL +// #undef HAVE_SIGNAL +#define HAVE_SIGNAL /* Define if you have the sleep function. */ #undef HAVE_SLEEP /* Define if you have the snprintf function. */ -#undef HAVE_SNPRINTF +// #undef HAVE_SNPRINTF +#ifdef _MSC_VER +#define HAVE_SNPRINTF +#define snprintf _snprintf +#endif /* Define if you have the socket function. */ -#undef HAVE_SOCKET +// #undef HAVE_SOCKET +#define HAVE_SOCKET /* Define if you have the strdup function. */ -#undef HAVE_STRDUP +// #undef HAVE_STRDUP +#define HAVE_STRDUP /* Define if you have the strerror function. */ -#undef HAVE_STRERROR +// #undef HAVE_STRERROR +#define HAVE_STRERROR /* Define if you have the strncasecmp function. */ +// #undef HAVE_STRNCASECMP #define HAVE_STRNCASECMP /* Define if you have the strstr function. */ +// #undef HAVE_STRSTR #define HAVE_STRSTR /* Define if you have the usleep function. */ #undef HAVE_USLEEP /* Define if you have the vsnprintf function. */ -#undef HAVE_VSNPRINTF +// #undef HAVE_VSNPRINTF +#ifdef _MSC_VER +#define HAVE_VSNPRINTF +#define vsnprintf _vsnprintf +#endif + +/* Define if you have the header file. */ +#undef HAVE_X11_XMU_EXTAGENT_H /* Define if you have the header file. */ #undef HAVE_X11_EXTENSIONS_XSHM_H @@ -114,7 +149,8 @@ #undef HAVE_CURSES_H /* Define if you have the header file. */ -#if defined(_MSC_VER) +// #undef HAVE_DIRENT_H +#ifdef _MSC_VER #undef HAVE_DIRENT_H #else #define HAVE_DIRENT_H @@ -124,9 +160,11 @@ #undef HAVE_DLFCN_H /* Define if you have the header file. */ +// #undef HAVE_ERRNO_H #define HAVE_ERRNO_H /* Define if you have the header file. */ +// #undef HAVE_FCNTL_H #define HAVE_FCNTL_H /* Define if you have the header file. */ @@ -136,13 +174,14 @@ #undef HAVE_GLOB_H /* Define if you have the header file. */ +// #undef HAVE_LIMITS_H #define HAVE_LIMITS_H /* Define if you have the header file. */ #undef HAVE_MACHINE_ENDIAN_H /* Define if you have the header file. */ -#define HAVE_MALLOC_H +#undef HAVE_MALLOC_H /* Define if you have the header file. */ #undef HAVE_NCURSES_H @@ -153,6 +192,9 @@ /* Define if you have the header file. */ #undef HAVE_NDIR_H +/* Define if you have the header file. */ +#undef HAVE_SLANG_H + /* Define if you have the header file. */ #undef HAVE_SLANG_SLANG_H @@ -193,6 +235,7 @@ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ +// #undef HAVE_SYS_TYPES_H #define HAVE_SYS_TYPES_H /* Define if you have the header file. */ @@ -217,10 +260,17 @@ #define HAVE_MMSYSTEM_H /* In VDS Macro AAA=BBB is not available. */ -#define TIMID_VERSION "2.9.0" +#define __W32__ +#define TIMID_VERSION "2.9.1" #define DEFAULT_PATH ".\\" #define AU_W32 #define WINSOCK #define __W32READDIR__ -#undef URL_DIR_CACHE_ENABLE +// #define URL_DIR_CACHE_ENABLE #define ANOTHER_MAIN +/* + for Visual Studio Project Option + LIB: mmsystem.lib comdlg32.lib + MACRO: _MT, _WINDOWS + Multithread library + */ diff -ruN TiMidity++-2.9.0/configs/msc-config.h.in TiMidity++-2.9.1/configs/msc-config.h.in --- TiMidity++-2.9.0/configs/msc-config.h.in Sun Feb 27 22:50:51 2000 +++ TiMidity++-2.9.1/configs/msc-config.h.in Tue Mar 21 04:52:28 2000 @@ -9,19 +9,21 @@ // #undef const /* Define if you don't have vprintf but do have _doprnt. */ -// #undef HAVE_DOPRNT +#undef HAVE_DOPRNT /* Define if you have a working `mmap' system call. */ -// #undef HAVE_MMAP +#undef HAVE_MMAP /* Define if you have that is POSIX.1 compatible. */ -// #undef HAVE_SYS_WAIT_H +#undef HAVE_SYS_WAIT_H /* Define if you have the vprintf function. */ +// #undef HAVE_VPRINTF #define HAVE_VPRINTF /* Define as __inline if that's what the C compiler calls it. */ -#define inline +// #undef inline +#define inline __inline /* Define to `long' if doesn't define. */ // #undef off_t @@ -30,6 +32,7 @@ // #undef pid_t /* Define as the return type of signal handlers (int or void). */ +// #undef RETSIGTYPE #define RETSIGTYPE int /* Define if the setvbuf function takes the buffering type as its second @@ -48,7 +51,7 @@ /* Define if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ -// #undef WORDS_BIGENDIAN +#undef WORDS_BIGENDIAN /* Define if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING @@ -56,11 +59,16 @@ /* Define if you have the XShmCreatePixmap function. */ #undef HAVE_XSHMCREATEPIXMAP +/* Define if you have the XmuRegisterExternalAgent function. */ +#undef HAVE_XMUREGISTEREXTERNALAGENT + /* Define if you have the getcwd function. */ +// #undef HAVE_GETCWD #define HAVE_GETCWD /* Define if you have the gethostbyname function. */ -#undef HAVE_GETHOSTBYNAME +// #undef HAVE_GETHOSTBYNAME +#define HAVE_GETHOSTBYNAME /* Define if you have the getopt function. */ #undef HAVE_GETOPT @@ -71,41 +79,68 @@ /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY +/* Define if you have the isatty function. */ +// #undef HAVE_ISATTY +#define HAVE_ISATTY + /* Define if you have the popen function. */ -#undef HAVE_POPEN +// #undef HAVE_POPEN +#ifdef _MSC_VER +#define HAVE_POPEN +#define popen _popen +#define pclose _pclose +#endif /* Define if you have the select function. */ -#undef HAVE_SELECT +// #undef HAVE_SELECT +#define HAVE_SELECT /* Define if you have the signal function. */ -#undef HAVE_SIGNAL +// #undef HAVE_SIGNAL +#define HAVE_SIGNAL /* Define if you have the sleep function. */ #undef HAVE_SLEEP /* Define if you have the snprintf function. */ -#undef HAVE_SNPRINTF +// #undef HAVE_SNPRINTF +#ifdef _MSC_VER +#define HAVE_SNPRINTF +#define snprintf _snprintf +#endif /* Define if you have the socket function. */ -#undef HAVE_SOCKET +// #undef HAVE_SOCKET +#define HAVE_SOCKET /* Define if you have the strdup function. */ -#undef HAVE_STRDUP +// #undef HAVE_STRDUP +#define HAVE_STRDUP /* Define if you have the strerror function. */ -#undef HAVE_STRERROR +// #undef HAVE_STRERROR +#define HAVE_STRERROR /* Define if you have the strncasecmp function. */ +// #undef HAVE_STRNCASECMP #define HAVE_STRNCASECMP /* Define if you have the strstr function. */ +// #undef HAVE_STRSTR #define HAVE_STRSTR /* Define if you have the usleep function. */ #undef HAVE_USLEEP /* Define if you have the vsnprintf function. */ -#undef HAVE_VSNPRINTF +// #undef HAVE_VSNPRINTF +#ifdef _MSC_VER +#define HAVE_VSNPRINTF +#define vsnprintf _vsnprintf +#endif + +/* Define if you have the header file. */ +#undef HAVE_X11_XMU_EXTAGENT_H /* Define if you have the header file. */ #undef HAVE_X11_EXTENSIONS_XSHM_H @@ -114,7 +149,8 @@ #undef HAVE_CURSES_H /* Define if you have the header file. */ -#if defined(_MSC_VER) +// #undef HAVE_DIRENT_H +#ifdef _MSC_VER #undef HAVE_DIRENT_H #else #define HAVE_DIRENT_H @@ -124,9 +160,11 @@ #undef HAVE_DLFCN_H /* Define if you have the header file. */ +// #undef HAVE_ERRNO_H #define HAVE_ERRNO_H /* Define if you have the header file. */ +// #undef HAVE_FCNTL_H #define HAVE_FCNTL_H /* Define if you have the header file. */ @@ -136,13 +174,14 @@ #undef HAVE_GLOB_H /* Define if you have the header file. */ +// #undef HAVE_LIMITS_H #define HAVE_LIMITS_H /* Define if you have the header file. */ #undef HAVE_MACHINE_ENDIAN_H /* Define if you have the header file. */ -#define HAVE_MALLOC_H +#undef HAVE_MALLOC_H /* Define if you have the header file. */ #undef HAVE_NCURSES_H @@ -153,6 +192,9 @@ /* Define if you have the header file. */ #undef HAVE_NDIR_H +/* Define if you have the header file. */ +#undef HAVE_SLANG_H + /* Define if you have the header file. */ #undef HAVE_SLANG_SLANG_H @@ -193,6 +235,7 @@ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ +// #undef HAVE_SYS_TYPES_H #define HAVE_SYS_TYPES_H /* Define if you have the header file. */ @@ -217,10 +260,17 @@ #define HAVE_MMSYSTEM_H /* In VDS Macro AAA=BBB is not available. */ +#define __W32__ #define TIMID_VERSION "@VERSION@" #define DEFAULT_PATH ".\\" #define AU_W32 #define WINSOCK #define __W32READDIR__ -#undef URL_DIR_CACHE_ENABLE +// #define URL_DIR_CACHE_ENABLE #define ANOTHER_MAIN +/* + for Visual Studio Project Option + LIB: mmsystem.lib comdlg32.lib + MACRO: _MT, _WINDOWS + Multithread library + */ diff -ruN TiMidity++-2.9.0/configure TiMidity++-2.9.1/configure --- TiMidity++-2.9.0/configure Mon Feb 21 14:02:40 2000 +++ TiMidity++-2.9.1/configure Mon Mar 20 20:36:20 2000 @@ -884,7 +884,7 @@ PACKAGE=TiMidity++ -VERSION=2.9.0 +VERSION=2.9.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; } @@ -7348,7 +7348,7 @@ lib_w32gui_opt='-lgdi32 -lcomctl32 -lcomdlg32' lib_user32_opt='-luser32' LDFLAGS="-mwindows $LDFLAGS" - INTERFACE_SRCS="$INTERFACE_SRCS w32g_c.c w32g_ini.c w32g_i.c w32g_playlist.c w32g_utl.c w32g_pref.c w32g_subwin.c" + INTERFACE_SRCS="$INTERFACE_SRCS w32g_c.c w32g_ini.c w32g_i.c w32g_playlist.c w32g_utl.c w32g_pref.c w32g_subwin.c w32g_ut2.c" ;; xdynamic) diff -ruN TiMidity++-2.9.0/configure.in TiMidity++-2.9.1/configure.in --- TiMidity++-2.9.0/configure.in Mon Feb 21 14:02:33 2000 +++ TiMidity++-2.9.1/configure.in Mon Mar 20 20:36:12 2000 @@ -55,7 +55,7 @@ AC_INIT(timidity/timidity.c) SHELL=${CONFIG_SHELL-/bin/sh} AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(TiMidity++, 2.9.0, no-define) +AM_INIT_AUTOMAKE(TiMidity++, 2.9.1, no-define) dnl To use CONTAINS() macro (See acinclude.m4) CONTAINS_INIT @@ -1152,7 +1152,7 @@ [ lib_w32gui_opt='-lgdi32 -lcomctl32 -lcomdlg32' lib_user32_opt='-luser32' LDFLAGS="-mwindows $LDFLAGS" - INTERFACE_SRCS="$INTERFACE_SRCS w32g_c.c w32g_ini.c w32g_i.c w32g_playlist.c w32g_utl.c w32g_pref.c w32g_subwin.c" + INTERFACE_SRCS="$INTERFACE_SRCS w32g_c.c w32g_ini.c w32g_i.c w32g_playlist.c w32g_utl.c w32g_pref.c w32g_subwin.c w32g_ut2.c" ]) diff -ruN TiMidity++-2.9.0/doc/C/timidity.cfg.5 TiMidity++-2.9.1/doc/C/timidity.cfg.5 --- TiMidity++-2.9.0/doc/C/timidity.cfg.5 Thu Feb 24 13:40:39 2000 +++ TiMidity++-2.9.1/doc/C/timidity.cfg.5 Fri Mar 3 13:22:07 2000 @@ -6,7 +6,7 @@ .TP .B /etc/timidity.cfg .TP -.B /usr/local/lib/timidity/timidity.cfg +.B /usr/local/share/timidity/timidity.cfg .P .SH DESCRIPTION @@ -38,7 +38,7 @@ .sh Archive file are also allowed. For example: .bp -dir /usr/local/lib/timidity/inst/foo.zip# +dir /usr/local/share/timidity/inst/foo.zip# .br .bank 0 .br @@ -50,7 +50,7 @@ .sp At first, \fBdir\fP specities the archive name (followed by '#') for the path of patch files same as directory name (in this case , -"/usr/local/lib/timidity/inst/foo.zip"). +"/usr/local/share/timidity/inst/foo.zip"). TiMidity recognize the path is an archive file if the expression has the last character '#', and also read the files contained in this archive file. @@ -157,7 +157,7 @@ .BI "#extension comm" " program secound" Specifies the comment \fIcomment\fP for the tone number \fIprogram\fP. These comments are displayed in the indicater line at the case -TiMidity is booted with option \fB\-iNt\fP, \fB\-iTt\fP. +TiMidity is booted with option \fB\-int\fP, \fB\-iTt\fP. .TP .BI "#extension timeout" " program secound" diff -ruN TiMidity++-2.9.0/doc/ja_JP.ujis/timidity.cfg.5 TiMidity++-2.9.1/doc/ja_JP.ujis/timidity.cfg.5 --- TiMidity++-2.9.0/doc/ja_JP.ujis/timidity.cfg.5 Thu Feb 24 13:41:15 2000 +++ TiMidity++-2.9.1/doc/ja_JP.ujis/timidity.cfg.5 Fri Mar 3 13:21:58 2000 @@ -6,7 +6,7 @@ .TP .B /etc/timidity.cfg .TP -.B /usr/local/lib/timidity/timidity.cfg +.B /usr/local/share/timidity/timidity.cfg .P .SH DESCRIPTION @@ -36,7 +36,7 @@ 例: .br -dir /usr/local/lib/timidity/inst/foo.zip# +dir /usr/local/share/timidity/inst/foo.zip# .br bank 0 .br @@ -47,7 +47,7 @@ 2 zoo.pat .br まず、dir で通常のディレクトリのようにアーカイブファイル (上の例では -/usr/local/lib/timidity/inst/foo.zip) +/usr/local/share/timidity/inst/foo.zip) を指定します。このとき、アーカイブファイル名 の最後に \fB#\fP をつけてください。この \fB#\fP があることで、アーカイブファイルで あることを \fITiMidity++\fP は認識します。こうしておくと、\fIdir\fP で指定された @@ -138,7 +138,7 @@ .TP .BI "#extension comm" " program comment" Instrument 番号 \fIprogram\fP にコメント \fIcomment\fP を指定します. -ここで設定した \fIcomment\fP は \fB\-iNt\fP や \fI\-iTt\fP オプション +ここで設定した \fIcomment\fP は \fB\-int\fP や \fI\-iTt\fP オプション で起動した時に、インジケータラインに表示されます。 .TP .BI "#extension timeout" " program secound" diff -ruN TiMidity++-2.9.0/interface/Makefile.am TiMidity++-2.9.1/interface/Makefile.am --- TiMidity++-2.9.0/interface/Makefile.am Mon Feb 7 07:50:40 2000 +++ TiMidity++-2.9.1/interface/Makefile.am Mon Mar 20 15:10:14 2000 @@ -99,6 +99,8 @@ w32g_res.rc \ w32g_utl.c \ w32g_utl.h \ + w32g_ut2.c \ + w32g_ut2.h \ w32g_i.c \ w32g_playlist.c \ w32g_pref.c \ diff -ruN TiMidity++-2.9.0/interface/Makefile.in TiMidity++-2.9.1/interface/Makefile.in --- TiMidity++-2.9.0/interface/Makefile.in Sun Feb 27 22:50:16 2000 +++ TiMidity++-2.9.1/interface/Makefile.in Tue Mar 21 04:52:02 2000 @@ -122,7 +122,7 @@ libinterface_a_SOURCES = dumb_c.c wrdt_dumb.c wrdt_tty.c -EXTRA_libinterface_a_SOURCES = ncurs_c.c slang_c.c motif.h motif_c.c motif_i.c motif_p.c tk_c.c emacs_c.c vt100.h vt100.c vt100_c.c xaw.h xaw_c.c xaw_i.c xaw_redef.c xskin.h xskin_c.c xskin_i.c xskin_loadBMP.c xskin_spectrum.c wrdt_x.c x_sherry.c x_sherry.h x_wrdwindow.c x_wrdwindow.h VTPrsTbl.c VTparse.h x_mag.c x_mag.h dynamic_c.c mac_c.c mac_c.h mac_mag.c mac_mag.h mac_trace.c mac_wrdwindow.c mac_wrdwindow.h wrdt_mac.c wrdt_wcon.c gtk_c.c gtk_h.h gtk_i.c gtk_p.c soundspec.c soundspec.h x_sherry.c x_sherry.h check.xbm arrow.xbm on.xbm off.xbm server_c.c server_defs.h w32g.h w32g_c.c w32g_ini.c w32g_rec.h w32g_res.h w32g_res.rc w32g_utl.c w32g_utl.h w32g_i.c w32g_playlist.c w32g_pref.c w32g_pref.h w32g_subwin.c w32g_subwin.h w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp +EXTRA_libinterface_a_SOURCES = ncurs_c.c slang_c.c motif.h motif_c.c motif_i.c motif_p.c tk_c.c emacs_c.c vt100.h vt100.c vt100_c.c xaw.h xaw_c.c xaw_i.c xaw_redef.c xskin.h xskin_c.c xskin_i.c xskin_loadBMP.c xskin_spectrum.c wrdt_x.c x_sherry.c x_sherry.h x_wrdwindow.c x_wrdwindow.h VTPrsTbl.c VTparse.h x_mag.c x_mag.h dynamic_c.c mac_c.c mac_c.h mac_mag.c mac_mag.h mac_trace.c mac_wrdwindow.c mac_wrdwindow.h wrdt_mac.c wrdt_wcon.c gtk_c.c gtk_h.h gtk_i.c gtk_p.c soundspec.c soundspec.h x_sherry.c x_sherry.h check.xbm arrow.xbm on.xbm off.xbm server_c.c server_defs.h w32g.h w32g_c.c w32g_ini.c w32g_rec.h w32g_res.h w32g_res.rc w32g_utl.c w32g_utl.h w32g_ut2.c w32g_ut2.h w32g_i.c w32g_playlist.c w32g_pref.c w32g_pref.h w32g_subwin.c w32g_subwin.h w32g_btn.bmp w32g_icon.ico w32g_sleep.bmp w32g_subbtn.bmp @ENABLE_WRD_TRUE@WRD_OBJS = wrdt_x.o x_wrdwindow.o VTPrsTbl.o x_mag.o x_sherry.o diff -ruN TiMidity++-2.9.0/interface/w32g.h TiMidity++-2.9.1/interface/w32g.h --- TiMidity++-2.9.0/interface/w32g.h Mon Feb 7 07:43:34 2000 +++ TiMidity++-2.9.1/interface/w32g.h Mon Mar 20 15:09:39 2000 @@ -20,12 +20,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include - -#ifdef RC_NONE #undef RC_NONE -#define RC_NONE 0 -#endif /* RC_NONE */ +#define RC_NONE 0 #define LANGUAGE_JAPANESE 0x0001 #define LANGUAGE_ENGLISH 0x0002 diff -ruN TiMidity++-2.9.0/interface/w32g_c.c TiMidity++-2.9.1/interface/w32g_c.c --- TiMidity++-2.9.0/interface/w32g_c.c Sun Feb 27 22:38:08 2000 +++ TiMidity++-2.9.1/interface/w32g_c.c Mon Mar 20 15:09:39 2000 @@ -131,11 +131,13 @@ Panel->c_flags[i] = 0; for(j = 0; j < 4; j++) Panel->xnote[i][j] = 0; - Panel->channel[i].panning = 64; +// Panel->channel[i].panning = 64; + Panel->channel[i].panning = -1; Panel->channel[i].sustain = 0; Panel->channel[i].expression = 0; Panel->channel[i].volume = 0; - Panel->channel[i].pitchbend = 0x2000; +// Panel->channel[i].pitchbend = 0x2000; + Panel->channel[i].pitchbend = -2; } Panel->titlename[0] = '\0'; Panel->filename[0] = '\0'; @@ -520,10 +522,15 @@ w32g_setcur_playlist(); if(play_mode->id_character == 'l') w32g_show_console(); - w32g_setup_doc(selected); - if(!DocWndIndependent) + if(!DocWndIndependent){ + w32g_setup_doc(selected); w32g_open_doc(1); - + } + { + char *p = w32g_get_playlist(selected); + if(Panel!=NULL && p!=NULL) + strcpy(Panel->filename,p); + } rc = play_midi_file(w32g_get_playlist(selected)); if(ctl.flags & CTLF_NOT_CONTINUE) diff -ruN TiMidity++-2.9.0/interface/w32g_i.c TiMidity++-2.9.1/interface/w32g_i.c --- TiMidity++-2.9.0/interface/w32g_i.c Mon Feb 7 07:43:08 2000 +++ TiMidity++-2.9.1/interface/w32g_i.c Mon Mar 20 15:09:39 2000 @@ -29,6 +29,7 @@ #include #include #include +#undef RC_NONE #include // #include #if defined(__CYGWIN32__) || defined(__MINGW32__) @@ -352,8 +353,6 @@ LRESULT CALLBACK StartWinProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam) { - LRESULT res; - switch (uMess) { case WM_DESTROY: @@ -688,7 +687,6 @@ void MainCmdProc(HWND hwnd, int wId, HWND hwndCtl, UINT wNotifyCode) { - int iRes; // PrintfDebugWnd("WM_COMMAND: ID%lx HWND%lx CODE%lx\n",wId,hwndCtl,wNotifyCode); switch(wId) { @@ -1644,24 +1642,24 @@ rc.top = rc.bottom + 2; rc.bottom = rc.top + 2 - 1; for(i=1;i<=10;i++){ - if(x-rc.left < Canvas.MapExpression[ch]) + if(i < Canvas.MapExpression[ch]) color = colorFG; else color = colorBG; - x = rc.left + i/2; - y = rc.top + 1 - i%2; + x = rc.left + (i-1)/2; + y = rc.top + (i+1)%2; SetPixelV(Canvas.hmdc,x,y,color); } // VOLUME rc.top = rc.bottom + 2; rc.bottom = rc.top + 2 - 1; for(i=1;i<=10;i++){ - if(x-rc.left < Canvas.MapVolume[ch]) + if(i < Canvas.MapVolume[ch]) color = colorFG; else color = colorBG; - x = rc.left + i/2; - y = rc.top + 1 - i%2; + x = rc.left + (i-1)/2; + y = rc.top + (i+1)%2; SetPixelV(Canvas.hmdc,x,y,color); } // PITCH_BEND @@ -2268,7 +2266,7 @@ MPanelPaintDo(); return 0; case WM_LBUTTONDBLCLK: - MPanelReset(); +// MPanelReset(); MPanelReadPanelInfo(1); MPanelUpdateAll(); MPanelPaintAll(); @@ -3195,7 +3193,8 @@ static void DlgMidiFileOpen(HWND hwnd) { char *dir, *file; - char *filter = "midi file\0*.mid;*.smf;*.rcp;*.r36;*.g18;*.g36\0" + char *filter = "timidity file\0*.mid;*.smf;*.rcp;*.r36;*.g18;*.g36;*.lzh;*.zip;*.gz\0" + "midi file\0*.mid;*.smf;*.rcp;*.r36;*.g18;*.g36\0" "archive file\0*.lzh;*.zip;*.gz\0" "playlist file\0*.pls;*.m3u;*.asx\0" "all files\0*.*\0" @@ -3302,7 +3301,6 @@ static void DlgPlaylistSave(HWND hwnd) { OPENFILENAME ofn; - int res; static char *dir; char *filter = "playlist file\0*.pls;*.m3u;*.asx\0" @@ -3345,8 +3343,6 @@ w32g_lock_open_file = 1; w32g_send_rc(RC_EXT_SAVE_PLAYLIST, (int32)DialogFileNameBuff); } - - // **************************************************************************** // Edit Ctl. diff -ruN TiMidity++-2.9.0/interface/w32g_playlist.c TiMidity++-2.9.1/interface/w32g_playlist.c --- TiMidity++-2.9.0/interface/w32g_playlist.c Mon Feb 7 07:42:35 2000 +++ TiMidity++-2.9.1/interface/w32g_playlist.c Mon Mar 20 15:09:39 2000 @@ -26,6 +26,7 @@ #include #include #include +#undef RC_NONE #include "timidity.h" #include "common.h" #include "instrum.h" @@ -483,9 +484,14 @@ { playlist.nfiles--; free(playlist.list[playlist.nfiles].filename); +#if 0 if(hListBox) ListBox_DeleteString(hListBox, playlist.nfiles); +#endif } +// LB_RESETCONTENT + if(hListBox) + ListBox_ResetContent(hListBox); } void w32g_rotate_playlist(int dest) diff -ruN TiMidity++-2.9.0/interface/w32g_pref.c TiMidity++-2.9.1/interface/w32g_pref.c --- TiMidity++-2.9.0/interface/w32g_pref.c Mon Feb 7 07:42:31 2000 +++ TiMidity++-2.9.1/interface/w32g_pref.c Mon Mar 20 15:09:39 2000 @@ -28,6 +28,7 @@ #include #include #include +#undef RC_NONE // #include #if defined(__CYGWIN32__) || defined(__MINGW32__) #include diff -ruN TiMidity++-2.9.0/interface/w32g_res.h TiMidity++-2.9.1/interface/w32g_res.h --- TiMidity++-2.9.0/interface/w32g_res.h Wed Aug 25 13:32:30 1999 +++ TiMidity++-2.9.1/interface/w32g_res.h Mon Mar 20 15:09:39 2000 @@ -2,6 +2,7 @@ // Microsoft Developer Studio generated include file. // Used by w32g_res.rc // +#define IDD_DIALOG_SEARCHBOX 102 #define IDC_CHECK_SEACHDIRRECURSIVE 1001 #define IDC_CHECK_DOCWNDINDEPENDENT 1002 #define IDC_CHECK_INIFILE_AUTOSAVE 1003 @@ -96,6 +97,7 @@ #define IDC_EDIT_AMPLIFICATION 1094 #define IDC_EDIT_CACHE_SIZE 1095 #define IDC_EDIT_SPECIAL_TONEBANK 1097 +#define IDC_CHECKBOX_NOT_LOOPING 1097 #define IDC_EDIT_DEFAULT_TONEBANK 1098 #define IDC_EDIT_REDUCE_VOICE 1099 #define IDC_EDIT_CTL_VEBOSITY 1100 @@ -195,16 +197,16 @@ #define IDC_RADIOBUTTON_GM 1194 #define IDC_RADIOBUTTON_GS 1195 #define IDC_RADIOBUTTON_XG 1196 -#define IDC_CHECKBOX_NOT_LOOPING 1097 +#define IDC_EDIT1 2000 #define IDC_STATIC -1 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 2000 +#define _APS_NEXT_CONTROL_VALUE 2002 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff -ruN TiMidity++-2.9.0/interface/w32g_res.rc TiMidity++-2.9.1/interface/w32g_res.rc --- TiMidity++-2.9.0/interface/w32g_res.rc Wed Aug 25 13:40:54 1999 +++ TiMidity++-2.9.1/interface/w32g_res.rc Mon Mar 20 20:31:06 2000 @@ -91,36 +91,36 @@ WS_VSCROLL | WS_HSCROLL END -IDD_DIALOG_CONSOLE DIALOGEX 0, 0, 240, 180 -STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU +IDD_DIALOG_CONSOLE DIALOGEX 0, 0, 243, 184 +STYLE DS_MODALFRAME | DS_3DLOOK | WS_CAPTION | WS_SYSMENU CAPTION "Console Window (TiMidity Win32GUI)" -FONT 9, "lr o", 400, 0 +FONT 9, "lr o" BEGIN - PUSHBUTTON "C L E A R",IDCLEAR,140,164,96,16,BS_CENTER - EDITTEXT IDC_EDIT_VERBOSITY,44,164,16,16,ES_OEMCONVERT + PUSHBUTTON "C L E A R",IDCLEAR,140,167,96,16,BS_CENTER + EDITTEXT IDC_EDIT_VERBOSITY,44,167,16,16,ES_OEMCONVERT CONTROL "VALID",IDC_CHECKBOX_VALID,"Button",BS_AUTOCHECKBOX | - BS_LEFTTEXT | WS_TABSTOP,92,164,32,16 - CONTROL "Frame_Verbosity",-1,"Static",SS_ETCHEDFRAME,4,164,80,16 - EDITTEXT IDC_EDIT,0,0,240,160,ES_MULTILINE | ES_AUTOVSCROLL | + BS_LEFTTEXT | WS_TABSTOP,92,167,32,16 + CONTROL "",-1,"Static",SS_ETCHEDFRAME,4,167,80,16 + EDITTEXT IDC_EDIT,0,0,242,160,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL,WS_EX_STATICEDGE - PUSHBUTTON "VERBOSITY",IDC_BUTTON_VERBOSITY,4,164,40,16,BS_CENTER, + PUSHBUTTON "VERBOSITY",IDC_BUTTON_VERBOSITY,4,167,40,16,BS_CENTER, WS_EX_CLIENTEDGE - PUSHBUTTON "<<",IDC_BUTTON_DEC,60,164,12,16,BS_CENTER - PUSHBUTTON ">>",IDC_BUTTON_INC,72,164,12,16,BS_CENTER - CONTROL "Frame_Valid",-1,"Static",SS_ETCHEDFRAME,88,164,40,16 + PUSHBUTTON "<<",IDC_BUTTON_DEC,60,167,12,16,BS_CENTER + PUSHBUTTON ">>",IDC_BUTTON_INC,72,167,12,16,BS_CENTER + CONTROL "",-1,"Static",SS_ETCHEDFRAME,88,167,41,16 END IDD_DIALOG_CONSOLE_EN DIALOGEX 0, 0, 240, 180 -STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU +STYLE DS_MODALFRAME | DS_3DLOOK | WS_CAPTION | WS_SYSMENU CAPTION "Console Window (TiMidity Win32GUI)" -FONT 8, "Times New Roman", 400, 0 +FONT 8, "Times New Roman" BEGIN PUSHBUTTON "C L E A R",IDCLEAR,140,164,96,16,BS_CENTER EDITTEXT IDC_EDIT_VERBOSITY,44,164,16,16,ES_OEMCONVERT CONTROL "VALID",IDC_CHECKBOX_VALID,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,92,164,32,16 - CONTROL "Frame_Verbosity",-1,"Static",SS_ETCHEDFRAME,4,164,80,16 + CONTROL "",-1,"Static",SS_ETCHEDFRAME,4,164,80,16 EDITTEXT IDC_EDIT,0,0,240,160,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL,WS_EX_STATICEDGE @@ -128,27 +128,27 @@ WS_EX_CLIENTEDGE PUSHBUTTON "<<",IDC_BUTTON_DEC,60,164,12,16,BS_CENTER PUSHBUTTON ">>",IDC_BUTTON_INC,72,164,12,16,BS_CENTER - CONTROL "Frame_Valid",-1,"Static",SS_ETCHEDFRAME,88,164,40,16 + CONTROL "",-1,"Static",SS_ETCHEDFRAME,88,164,40,16 END -IDD_DIALOG_DOC DIALOG DISCARDABLE 0, 0, 330, 241 -STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU +IDD_DIALOG_DOC DIALOG DISCARDABLE 0, 0, 302, 257 +STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "Document Window (TiMidity Win32GUI)" FONT 9, "lr " BEGIN - EDITTEXT IDC_EDIT_FILENAME,103,223,160,16,ES_CENTER | ES_READONLY - PUSHBUTTON "<<",IDC_BUTTON_PREV,265,223,32,16,BS_CENTER - PUSHBUTTON ">>",IDC_BUTTON_NEXT,298,223,32,16,BS_CENTER - EDITTEXT IDC_EDIT,0,0,330,220,ES_MULTILINE | ES_AUTOVSCROLL | + EDITTEXT IDC_EDIT_FILENAME,100,240,150,16,ES_CENTER | ES_READONLY + PUSHBUTTON "<<",IDC_BUTTON_PREV,255,240,20,16,BS_CENTER + PUSHBUTTON ">>",IDC_BUTTON_NEXT,275,240,20,16,BS_CENTER + EDITTEXT IDC_EDIT,0,0,295,220,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL - EDITTEXT IDC_EDIT_INFO,0,223,101,16,ES_READONLY + EDITTEXT IDC_EDIT_INFO,0,240,95,16,ES_READONLY END -IDD_DIALOG_DOC_EN DIALOGEX 0, 0, 240, 180 -STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU +IDD_DIALOG_DOC_EN DIALOG DISCARDABLE 0, 0, 241, 180 +STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "Document Window (TiMidity Win32GUI)" -FONT 9, "Times New Roman", 400, 0 +FONT 9, "Times New Roman" BEGIN EDITTEXT IDC_EDIT_FILENAME,60,164,140,16,ES_CENTER | ES_READONLY PUSHBUTTON "<<",IDC_BUTTON_PREV,204,164,16,16,BS_CENTER @@ -192,32 +192,32 @@ CONTROL "Frame_Valid",-1,"Static",SS_ETCHEDFRAME,12,200,44,16 END -IDD_DIALOG_SIMPLE_LIST DIALOGEX 0, 0, 240, 184 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_CAPTION | WS_SYSMENU +IDD_DIALOG_SIMPLE_LIST DIALOGEX 0, 0, 241, 185 +STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_ACCEPTFILES CAPTION "List Window (TiMidity Win32GUI)" -FONT 9, "lr o", 400, 0 +FONT 9, "lr o" BEGIN - LISTBOX IDC_LISTBOX_PLAYLIST,0,0,240,172,LBS_HASSTRINGS | + LISTBOX IDC_LISTBOX_PLAYLIST,0,0,241,172,LBS_HASSTRINGS | LBS_WANTKEYBOARDINPUT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - PUSHBUTTON "DOC",IDC_BUTTON_DOC,0,172,52,12,BS_CENTER - PUSHBUTTON "CLEAR",IDC_BUTTON_CLEAR,188,172,52,12,BS_CENTER - PUSHBUTTON "REFINE",IDC_BUTTON_REFINE,136,172,40,12,BS_CENTER - PUSHBUTTON "UNIQ",IDC_BUTTON_UNIQ,96,172,40,12,BS_CENTER + PUSHBUTTON "DOC",IDC_BUTTON_DOC,0,173,52,12,BS_CENTER + PUSHBUTTON "CLEAR",IDC_BUTTON_CLEAR,189,173,52,12,BS_CENTER + PUSHBUTTON "REFINE",IDC_BUTTON_REFINE,136,173,40,12,BS_CENTER + PUSHBUTTON "UNIQ",IDC_BUTTON_UNIQ,96,173,40,12,BS_CENTER END -IDD_DIALOG_SIMPLE_LIST_EN DIALOGEX 0, 0, 240, 184 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_CAPTION | WS_SYSMENU +IDD_DIALOG_SIMPLE_LIST_EN DIALOGEX 0, 0, 241, 184 +STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_ACCEPTFILES CAPTION "List Window (TiMidity Win32GUI)" -FONT 9, "Times New Roman", 400, 0 +FONT 9, "Times New Roman" BEGIN - LISTBOX IDC_LISTBOX_PLAYLIST,0,0,240,172,LBS_HASSTRINGS | + LISTBOX IDC_LISTBOX_PLAYLIST,0,0,241,172,LBS_HASSTRINGS | LBS_WANTKEYBOARDINPUT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP PUSHBUTTON "DOC",IDC_BUTTON_DOC,0,172,52,12,BS_CENTER - PUSHBUTTON "CLEAR",IDC_BUTTON_CLEAR,188,172,52,12,BS_CENTER + PUSHBUTTON "CLEAR",IDC_BUTTON_CLEAR,189,172,52,12,BS_CENTER PUSHBUTTON "REFINE",IDC_BUTTON_REFINE,136,172,40,12,BS_CENTER PUSHBUTTON "UNIQ",IDC_BUTTON_UNIQ,96,172,40,12,BS_CENTER END @@ -502,6 +502,16 @@ BEGIN END +IDD_DIALOG_SEARCHBOX DIALOG DISCARDABLE 0, 0, 183, 54 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Seach" +FONT 9, "lr oSVbN" +BEGIN + DEFPUSHBUTTON "OK",IDOK,70,33,50,14 + PUSHBUTTON "Cancel",IDCANCEL,126,33,50,14 + EDITTEXT IDC_EDIT1,7,7,169,24,ES_AUTOHSCROLL | ES_OEMCONVERT +END + ///////////////////////////////////////////////////////////////////////////// // @@ -605,9 +615,24 @@ #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO DISCARDABLE BEGIN + IDD_DIALOG_CONSOLE, DIALOG + BEGIN + RIGHTMARGIN, 241 + BOTTOMMARGIN, 181 + END + IDD_DIALOG_DOC, DIALOG BEGIN - BOTTOMMARGIN, 239 + RIGHTMARGIN, 268 + BOTTOMMARGIN, 255 + END + + IDD_DIALOG_SEARCHBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 176 + TOPMARGIN, 7 + BOTTOMMARGIN, 47 END END #endif // APSTUDIO_INVOKED diff -ruN TiMidity++-2.9.0/interface/w32g_subwin.c TiMidity++-2.9.1/interface/w32g_subwin.c --- TiMidity++-2.9.0/interface/w32g_subwin.c Mon Feb 7 07:41:44 2000 +++ TiMidity++-2.9.1/interface/w32g_subwin.c Mon Mar 20 15:09:39 2000 @@ -64,6 +64,27 @@ #include "w32g_utl.h" #include "w32g_pref.h" #include "w32g_subwin.h" +#include "w32g_ut2.h" + +extern void MainWndToggleConsoleButton(void); +extern void MainWndUpdateConsoleButton(void); +extern void MainWndToggleTracerButton(void); +extern void MainWndUpdateTracerButton(void); +extern void MainWndToggleListButton(void); +extern void MainWndUpdateListButton(void); +extern void MainWndToggleDocButton(void); +extern void MainWndUpdateDocButton(void); +extern void MainWndToggleWrdButton(void); +extern void MainWndUpdateWrdButton(void); +extern void MainWndToggleSoundSpecButton(void); +extern void MainWndUpdateSoundSpecButton(void); +extern void ShowSubWindow(HWND hwnd,int showflag); +extern void ToggleSubWindow(HWND hwnd); + +extern void VprintfEditCtlWnd(HWND hwnd, char *fmt, va_list argList); +extern void PrintfEditCtlWnd(HWND hwnd, char *fmt, ...); +extern void PutsEditCtlWnd(HWND hwnd, char *str); +extern void ClearEditCtlWnd(HWND hwnd); // *************************************************************************** // @@ -283,14 +304,18 @@ #define IDM_LISTWND_REFINE 4103 #define IDM_LISTWND_UNIQ 4104 #define IDM_LISTWND_CLEAR 4105 +#define IDM_LISTWND_CHOOSEFONT 4106 // --------------------------------------------------------------------------- // Variables -static HANDLE hListWndPopupMenu; +LISTWNDINFO ListWndInfo; // --------------------------------------------------------------------------- // Prototypes static BOOL CALLBACK ListWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); +static int ListWndInfoReset(HWND hwnd); +static int ListWndInfoApply(void); +static int ListWndSetFontListBox(char *fontName, int fontWidth, int fontHeght); static int ResetListWnd(void); static int ClearListWnd(void); static int UniqListWnd(void); @@ -299,7 +324,6 @@ // --------------------------------------------------------------------------- // Grobal Functions - void InitListWnd(HWND hParentWnd) { switch(PlayerLanguage){ @@ -313,11 +337,19 @@ (hInst,MAKEINTRESOURCE(IDD_DIALOG_SIMPLE_LIST),hParentWnd,ListWndProc); break; } - hListWndPopupMenu = CreatePopupMenu(); - AppendMenu(hListWndPopupMenu,MF_STRING,IDM_LISTWND_PLAY,"Play"); - AppendMenu(hListWndPopupMenu,MF_STRING,IDM_LISTWND_REMOVE,"Remove"); - ShowWindow(hListWnd,SW_HIDE); - UpdateWindow(hListWnd); + ListWndInfoReset(hListWnd); + + ListWndInfo.hPopupMenu = CreatePopupMenu(); + AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_PLAY,"Play"); + AppendMenu(ListWndInfo.hPopupMenu,MF_SEPARATOR,0,0); + AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_REMOVE,"Remove"); + AppendMenu(ListWndInfo.hPopupMenu,MF_SEPARATOR,0,0); + AppendMenu(ListWndInfo.hPopupMenu,MF_STRING,IDM_LISTWND_CHOOSEFONT,"Choose Font"); + + INILoadListWnd(); + ListWndInfoApply(); + ShowWindow(ListWndInfo.hwnd,SW_HIDE); + UpdateWindow(ListWndInfo.hwnd); w32g_send_rc(RC_EXT_UPDATE_PLAYLIST, 0); } @@ -330,9 +362,12 @@ switch (uMess){ case WM_INITDIALOG: SendDlgItemMessage(hwnd,IDC_LISTBOX_PLAYLIST, - LB_SETHORIZONTALEXTENT,(WPARAM)1024,0); + LB_SETHORIZONTALEXTENT,(WPARAM)1600,0); w32g_send_rc(RC_EXT_UPDATE_PLAYLIST, 0); return FALSE; + case WM_DESTROY: + INISaveListWnd(); + break; /* }EXLv` */ case WM_SETCURSOR: switch(HIWORD(lParam)){ @@ -340,7 +375,7 @@ { POINT point; GetCursorPos(&point); - TrackPopupMenu(hListWndPopupMenu,TPM_TOPALIGN|TPM_LEFTALIGN, + TrackPopupMenu(ListWndInfo.hPopupMenu,TPM_TOPALIGN|TPM_LEFTALIGN, point.x,point.y,0,hwnd,NULL); } break; @@ -394,6 +429,19 @@ w32g_send_rc(RC_EXT_JUMP_FILE, ListBox_GetCurSel(hListBox)); } return FALSE; + case IDM_LISTWND_CHOOSEFONT: + { + char fontName[64]; + int fontHeight; + int fontWidth; + strcpy(fontName,ListWndInfo.fontName); + fontHeight = ListWndInfo.fontHeight; + fontWidth = ListWndInfo.fontWidth; + if(DlgChooseFont(hwnd,fontName,&fontHeight,&fontWidth)==0){ + ListWndSetFontListBox(fontName,fontWidth,fontHeight); + } + } + return FALSE; default: break; } @@ -402,7 +450,6 @@ { UINT vkey = (UINT)LOWORD(wParam); int nCaretPos = (int)HIWORD(wParam); - int num; switch(vkey){ case VK_SPACE: case VK_RETURN: @@ -477,8 +524,92 @@ } return -1; } - case WM_SIZE: - return FALSE; + case WM_SIZE: + switch(wParam){ + case SIZE_MAXIMIZED: + case SIZE_RESTORED: + { // |(^^;; + int x,y,cx,cy; + int maxHeight = 0; + int center, idControl; + HWND hwndChild; + RECT rcParent, rcChild, rcRest; + int nWidth = LOWORD(lParam); + int nHeight = HIWORD(lParam); + GetWindowRect(hwnd,&rcParent); + cx = rcParent.right-rcParent.left; + cy = rcParent.bottom-rcParent.top; + if(cx < 350) + MoveWindow(hwnd,rcParent.left,rcParent.top,350,cy,TRUE); + if(cy < 200) + MoveWindow(hwnd,rcParent.left,rcParent.top,cx,200,TRUE); + GetClientRect(hwnd,&rcParent); + rcRest.left = rcParent.left; rcRest.right = rcParent.right; + // IDC_BUTTON_DOC + idControl = IDC_BUTTON_DOC; + hwndChild = GetDlgItem(hwnd,idControl); + GetWindowRect(hwndChild,&rcChild); + cx = rcChild.right-rcChild.left; + cy = rcChild.bottom-rcChild.top; + x = rcParent.left; + y = rcParent.bottom - cy; + MoveWindow(hwndChild,x,y,cx,cy,TRUE); + if(cy>maxHeight) maxHeight = cy; + rcRest.left += cx; + // IDC_BUTTON_CLEAR + idControl = IDC_BUTTON_CLEAR; + hwndChild = GetDlgItem(hwnd,idControl); + GetWindowRect(hwndChild,&rcChild); + cx = rcChild.right-rcChild.left; + cy = rcChild.bottom-rcChild.top; + x = rcParent.right - cx - 5; + y = rcParent.bottom - cy ; + MoveWindow(hwndChild,x,y,cx,cy,TRUE); + if(cy>maxHeight) maxHeight = cy; + rcRest.right -= cx + 5; + // IDC_BUTTON_UNIQ + center = rcRest.left + (int)((rcRest.right - rcRest.left)*0.52); + idControl = IDC_BUTTON_UNIQ; + hwndChild = GetDlgItem(hwnd,idControl); + GetWindowRect(hwndChild,&rcChild); + cx = rcChild.right-rcChild.left; + cy = rcChild.bottom-rcChild.top; + x = center - cx; + y = rcParent.bottom - cy; + MoveWindow(hwndChild,x,y,cx,cy,TRUE); + if(cy>maxHeight) maxHeight = cy; + // IDC_BUTTON_REFINE + idControl = IDC_BUTTON_REFINE; + hwndChild = GetDlgItem(hwnd,idControl); + GetWindowRect(hwndChild,&rcChild); + cx = rcChild.right-rcChild.left; + cy = rcChild.bottom-rcChild.top; + x = center + 3; + y = rcParent.bottom - cy; + MoveWindow(hwndChild,x,y,cx,cy,TRUE); + if(cy>maxHeight) maxHeight = cy; + // IDC_LISTBOX_PLAYLIST + idControl = IDC_LISTBOX_PLAYLIST; + hwndChild = GetDlgItem(hwnd,idControl); + cx = rcParent.right - rcParent.left; + cy = rcParent.bottom - rcParent.top - maxHeight - 3; + x = rcParent.left; + y = rcParent.top; + MoveWindow(hwndChild,x,y,cx,cy,TRUE); + InvalidateRect(hwnd,&rcParent,FALSE); + UpdateWindow(hwnd); + GetWindowRect(hwnd,&rcParent); + ListWndInfo.Width = rcParent.right - rcParent.left; + ListWndInfo.Height = rcParent.bottom - rcParent.top; + break; + } + case SIZE_MINIMIZED: + case SIZE_MAXHIDE: + case SIZE_MAXSHOW: + default: + break; + } + break; // See PreDispatchMessage() in w32g2_main.c case WM_SYSKEYDOWN: case WM_KEYDOWN: @@ -505,8 +636,63 @@ return FALSE; } - - +static int ListWndInfoReset(HWND hwnd) +{ + memset(&ListWndInfo,0,sizeof(LISTWNDINFO)); + ListWndInfo.Height = 400; + ListWndInfo.Width = 400; + ListWndInfo.hPopupMenu = NULL; + ListWndInfo.hwnd = hwnd; + ListWndInfo.hwndListBox = GetDlgItem(hwnd,IDC_LISTBOX_PLAYLIST); + switch(PlayerLanguage){ + case LANGUAGE_ENGLISH: + strcpy(ListWndInfo.fontName,"Times New Roman"); + ListWndInfo.fontHeight = 12; + ListWndInfo.fontWidth = 6; + ListWndInfo.fontFlags = FONT_FLAGS_NONE; + break; + default: + case LANGUAGE_JAPANESE: + strcpy(ListWndInfo.fontName,"lr "); + ListWndInfo.fontHeight = 12; + ListWndInfo.fontWidth = 6; + ListWndInfo.fontFlags = FONT_FLAGS_FIXED; + break; + } + return 0; +} +static int ListWndInfoApply(void) +{ + RECT rc; + HFONT hFontPre = NULL; + DWORD fdwPitch = (ListWndInfo.fontFlags&FONT_FLAGS_FIXED)?FIXED_PITCH:VARIABLE_PITCH; + DWORD fdwItalic = (ListWndInfo.fontFlags&FONT_FLAGS_ITALIC)?TRUE:FALSE; + HFONT hFont = + CreateFont(ListWndInfo.fontHeight,ListWndInfo.fontWidth,0,0,FW_DONTCARE,fdwItalic,FALSE,FALSE, + DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, + fdwPitch | FF_DONTCARE,ListWndInfo.fontName); + if(hFont != NULL){ + hFontPre = ListWndInfo.hFontListBox; + ListWndInfo.hFontListBox = hFont; + SendMessage(ListWndInfo.hwndListBox,WM_SETFONT,(WPARAM)ListWndInfo.hFontListBox,(LPARAM)MAKELPARAM(TRUE,0)); + } + GetWindowRect(ListWndInfo.hwnd,&rc); + MoveWindow(ListWndInfo.hwnd,rc.left,rc.top,ListWndInfo.Width,ListWndInfo.Height,TRUE); +// InvalidateRect(hwnd,&rc,FALSE); +// UpdateWindow(hwnd); + if(hFontPre!=NULL) CloseHandle(hFontPre); + INISaveListWnd(); + return 0; +} + +static int ListWndSetFontListBox(char *fontName, int fontWidth, int fontHeight) +{ + strcpy(ListWndInfo.fontName,fontName); + ListWndInfo.fontWidth = fontWidth; + ListWndInfo.fontHeight = fontHeight; + ListWndInfoApply(); + return 0; +} // *************************************************************************** // Tracer Window @@ -595,16 +781,9 @@ //**************************************************************************** // Doc Window -#define DOCWND_DOCFILEMAX 10 -static struct DocWndInfo_ { - char DocFile[DOCWND_DOCFILEMAX][MAXPATH]; - int DocFileMax; - int DocFileCur; - char *Text; - int TextSize; -// HANDLE hMutex; -} DocWndInfo; +#define IDM_DOCWND_CHOOSEFONT 4232 int DocWndIndependent = 0; /* Independent document viewer mode.(hLgr[[h) */ +DOCWNDINFO DocWndInfo; static BOOL CALLBACK DocWndProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam); static void InitDocEditWnd(HWND hParentWnd); @@ -623,8 +802,13 @@ void DocWndReadDocNext(void); void DocWndReadDocPrev(void); +static int DocWndInfoReset2(HWND hwnd); +static int DocWndInfoApply(void); +static int DocWndSetFontEdit(char *fontName, int fontWidth, int fontHeight); + void InitDocWnd(HWND hParentWnd) { + HMENU hMenu; switch(PlayerLanguage){ case LANGUAGE_ENGLISH: hDocWnd = CreateDialog @@ -636,10 +820,22 @@ (hInst,MAKEINTRESOURCE(IDD_DIALOG_DOC),hParentWnd,DocWndProc); break; } -// hDocWnd = CreateDialog -// (hInst,MAKEINTRESOURCE(IDD_DIALOG_DOC),hParentWnd,DocWndProc); + DocWndInfoReset2(hDocWnd); + INILoadDocWnd(); + +// hMenu = GetMenu(DocWndInfo.hwndEdit); +// AppendMenu(hMenu,MF_SEPARATOR,0,0); +// AppendMenu(hMenu,MF_STRING,IDM_DOCWND_CHOOSEFONT,"Choose Font"); +// hMenu = GetSystemMenu(DocWndInfo.hwnd,FALSE); + hMenu = GetSystemMenu(DocWndInfo.hwnd,FALSE); + AppendMenu(hMenu,MF_SEPARATOR,0,0); + AppendMenu(hMenu,MF_STRING,IDM_DOCWND_CHOOSEFONT,"Choose Font"); + + DocWndInfoApply(); ShowWindow(hDocWnd,SW_HIDE); UpdateWindow(hDocWnd); + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),FALSE); + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),FALSE); } static BOOL CALLBACK @@ -650,6 +846,28 @@ PutsDocWnd("Doc Window\n"); DocWndInfoInit(); return FALSE; + case WM_DESTROY: + INISaveDocWnd(); + break; + case WM_SYSCOMMAND: + switch(wParam){ + case IDM_DOCWND_CHOOSEFONT: + { + char fontName[64]; + int fontHeight; + int fontWidth; + strcpy(fontName,DocWndInfo.fontName); + fontHeight = DocWndInfo.fontHeight; + fontWidth = DocWndInfo.fontWidth; + if(DlgChooseFont(hwnd,fontName,&fontHeight,&fontWidth)==0){ + DocWndSetFontEdit(fontName,fontWidth,fontHeight); + } + break; + } + break; + default: + break; + } case WM_COMMAND: switch (LOWORD(wParam)) { case IDCLOSE: @@ -690,12 +908,150 @@ // ShowWindow(hDocWnd, SW_HIDE); MainWndUpdateDocButton(); break; + case WM_SIZE: + switch(wParam){ + case SIZE_MAXIMIZED: + case SIZE_RESTORED: + { // |(^^;; + int x,y,cx,cy; + int max = 0; + int width; + RECT rcParent; + RECT rcEDIT_INFO, rcEDIT_FILENAME, rcBUTTON_PREV, rcBUTTON_NEXT, rcEDIT; + HWND hwndEDIT_INFO, hwndEDIT_FILENAME, hwndBUTTON_PREV, hwndBUTTON_NEXT, hwndEDIT; + int nWidth = LOWORD(lParam); + int nHeight = HIWORD(lParam); + GetWindowRect(hwnd,&rcParent); + cx = rcParent.right-rcParent.left; + cy = rcParent.bottom-rcParent.top; + if(cx < 300) + MoveWindow(hwnd,rcParent.left,rcParent.top,300,cy,TRUE); + if(cy < 200) + MoveWindow(hwnd,rcParent.left,rcParent.top,cx,200,TRUE); + GetClientRect(hwnd,&rcParent); + hwndEDIT = GetDlgItem(hwnd,IDC_EDIT); + hwndEDIT_INFO = GetDlgItem(hwnd,IDC_EDIT_INFO); + hwndEDIT_FILENAME = GetDlgItem(hwnd,IDC_EDIT_FILENAME); + hwndBUTTON_PREV = GetDlgItem(hwnd,IDC_BUTTON_PREV); + hwndBUTTON_NEXT = GetDlgItem(hwnd,IDC_BUTTON_NEXT); + GetWindowRect(hwndEDIT,&rcEDIT); + GetWindowRect(hwndEDIT_INFO,&rcEDIT_INFO); + GetWindowRect(hwndEDIT_FILENAME,&rcEDIT_FILENAME); + GetWindowRect(hwndBUTTON_PREV,&rcBUTTON_PREV); + GetWindowRect(hwndBUTTON_NEXT,&rcBUTTON_NEXT); + width = rcParent.right - rcParent.left; + cx = rcBUTTON_NEXT.right-rcBUTTON_NEXT.left; + cy = rcBUTTON_NEXT.bottom-rcBUTTON_NEXT.top; + x = rcParent.right - cx - 5; + y = rcParent.bottom - cy; + MoveWindow(hwndBUTTON_NEXT,x,y,cx,cy,TRUE); + width -= cx + 5; + if(cy>max) max = cy; + cx = rcBUTTON_PREV.right-rcBUTTON_PREV.left; + cy = rcBUTTON_PREV.bottom-rcBUTTON_PREV.top; + x -= cx + 5; + y = rcParent.bottom - cy; + MoveWindow(hwndBUTTON_PREV,x,y,cx,cy,TRUE); + width -= cx; + if(cy>max) max = cy; + width -= 5; +// cx = rcEDIT_INFO.right-rcEDIT_INFO.left; + cx = (int)(width * 0.36); + cy = rcEDIT_INFO.bottom-rcEDIT_INFO.top; + x = rcParent.left; + y = rcParent.bottom - cy; + MoveWindow(hwndEDIT_INFO,x,y,cx,cy,TRUE); + if(cy>max) max = cy; + x += cx + 5; +// cx = rcEDIT_FILENAME.right-rcEDIT_FILENAME.left; + cx = (int)(width * 0.56); + cy = rcEDIT_FILENAME.bottom-rcEDIT_FILENAME.top; + y = rcParent.bottom - cy; + MoveWindow(hwndEDIT_FILENAME,x,y,cx,cy,TRUE); + if(cy>max) max = cy; + cx = rcParent.right - rcParent.left; + cy = rcParent.bottom - rcParent.top - max - 5; + x = rcParent.left; + y = rcParent.top; + MoveWindow(hwndEDIT,x,y,cx,cy,TRUE); + InvalidateRect(hwnd,&rcParent,FALSE); + UpdateWindow(hwnd); + GetWindowRect(hwnd,&rcParent); + DocWndInfo.Width = rcParent.right - rcParent.left; + DocWndInfo.Height = rcParent.bottom - rcParent.top; + break; + } + case SIZE_MINIMIZED: + case SIZE_MAXHIDE: + case SIZE_MAXSHOW: + default: + break; + } + break; default: return FALSE; } return FALSE; } +static int DocWndInfoReset2(HWND hwnd) +{ +// memset(&DocWndInfo,0,sizeof(DOCWNDINFO)); + DocWndInfo.Height = 400; + DocWndInfo.Width = 400; + DocWndInfo.hPopupMenu = NULL; + DocWndInfo.hwnd = hwnd; + DocWndInfo.hwndEdit = GetDlgItem(hwnd,IDC_EDIT); + switch(PlayerLanguage){ + case LANGUAGE_ENGLISH: + strcpy(DocWndInfo.fontName,"Times New Roman"); + DocWndInfo.fontHeight = 12; + DocWndInfo.fontWidth = 6; + DocWndInfo.fontFlags = FONT_FLAGS_NONE; + break; + default: + case LANGUAGE_JAPANESE: + strcpy(DocWndInfo.fontName,"lr "); + DocWndInfo.fontHeight = 12; + DocWndInfo.fontWidth = 6; + DocWndInfo.fontFlags = FONT_FLAGS_FIXED; + break; + } + return 0; +} +static int DocWndInfoApply(void) +{ + RECT rc; + HFONT hFontPre = NULL; + DWORD fdwPitch = (ListWndInfo.fontFlags&FONT_FLAGS_FIXED)?FIXED_PITCH:VARIABLE_PITCH; + DWORD fdwItalic = (DocWndInfo.fontFlags&FONT_FLAGS_ITALIC)?TRUE:FALSE; + HFONT hFont = + CreateFont(DocWndInfo.fontHeight,DocWndInfo.fontWidth,0,0,FW_DONTCARE,fdwItalic,FALSE,FALSE, + DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, + fdwPitch | FF_DONTCARE,DocWndInfo.fontName); + if(hFont != NULL){ + hFontPre = DocWndInfo.hFontEdit; + DocWndInfo.hFontEdit = hFont; + SendMessage(DocWndInfo.hwndEdit,WM_SETFONT,(WPARAM)DocWndInfo.hFontEdit,(LPARAM)MAKELPARAM(TRUE,0)); + } + GetWindowRect(DocWndInfo.hwnd,&rc); + MoveWindow(DocWndInfo.hwnd,rc.left,rc.top,DocWndInfo.Width,DocWndInfo.Height,TRUE); +// InvalidateRect(hwnd,&rc,FALSE); +// UpdateWindow(hwnd); + if(hFontPre!=NULL) CloseHandle(hFontPre); + INISaveDocWnd(); + return 0; +} + +static int DocWndSetFontEdit(char *fontName, int fontWidth, int fontHeight) +{ + strcpy(DocWndInfo.fontName,fontName); + DocWndInfo.fontWidth = fontWidth; + DocWndInfo.fontHeight = fontHeight; + DocWndInfoApply(); + return 0; +} + static char ControlCode[] = "@ABCDEFGHIJKLMNOPQRS"; static void DocWndConvertText(char *in, int in_size, char *out, int out_size) { @@ -706,7 +1062,7 @@ // Convert Return Code CR, LF -> CR+LF , // Control Code -> ^? (^@, ^A, ^B, ...). -stage1: +// stage1: for(;;){ if(i>=in_size || j>=buffer_size-1) goto stage1_end; @@ -797,7 +1153,7 @@ stage1_end: buffer[j] = '\0'; // Convert KANJI Code. -stage2: +// stage2: #ifndef MAX2 #define MAX2(x,y) ((x)>=(y)?(x):(y)) #endif @@ -832,7 +1188,6 @@ static void DocWndSetInfo(char *info, char *filename) { - char buffer[BUFFER_SIZE]; int buffer_size = BUFFER_SIZE; if(!IsWindow(hDocWnd) || !DocWndFlag) return; @@ -853,6 +1208,8 @@ DocWndInfo.DocFileMax = 0; DocWndInfo.Text = NULL; DocWndInfo.TextSize = 0; + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),FALSE); + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),FALSE); // if(DocWndInfo.hMutex!=NULL) // DocWndInfoUnLock(); } @@ -892,7 +1249,7 @@ DocWndInfo.TextSize = 0; DocWndSetInfo("",""); DocWndSetText("",0); -end: +// end: DocWndInfoUnLock(); } @@ -912,6 +1269,14 @@ DocWndInfo.DocFileMax++; strncpy(DocWndInfo.DocFile[DocWndInfo.DocFileMax-1],filename,MAXPATH); DocWndInfo.DocFile[DocWndInfo.DocFileMax-1][MAXPATH-1] = '\0'; + if(DocWndInfo.DocFileCur==1) + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),FALSE); + else + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),TRUE); + if(DocWndInfo.DocFileCur==DocWndInfo.DocFileMax) + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),FALSE); + else + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),TRUE); #ifdef W32GUI_DEBUG PrintfDebugWnd("DocWndAddDocFile -> (%d)[%s]\n",DocWndInfo.DocFileMax-1,DocWndInfo.DocFile[DocWndInfo.DocFileMax-1]); #endif @@ -939,6 +1304,18 @@ *p = '\0'; strcat(buffer,".hed"); DocWndAddDocFile(buffer); + p = strrchr(buffer,'#'); + if(p==NULL) + goto end; + *p = '\0'; + strcat(buffer,"readme.txt"); + DocWndAddDocFile(buffer); + *p = '\0'; + strcat(buffer,"readme.1st"); + DocWndAddDocFile(buffer); + *p = '\0'; + strcat(buffer,".txt"); + DocWndAddDocFile(buffer); end: DocWndInfoUnLock(); } @@ -989,6 +1366,14 @@ } DocWndSetText(DocWndInfo.Text,DocWndInfo.TextSize); end: + if(DocWndInfo.DocFileCur==1) + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),FALSE); + else + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_PREV),TRUE); + if(DocWndInfo.DocFileCur==DocWndInfo.DocFileMax) + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),FALSE); + else + EnableWindow(GetDlgItem(hDocWnd,IDC_BUTTON_NEXT),TRUE); DocWndInfoUnLock(); } diff -ruN TiMidity++-2.9.0/interface/w32g_ut2.c TiMidity++-2.9.1/interface/w32g_ut2.c --- TiMidity++-2.9.0/interface/w32g_ut2.c Thu Jan 1 09:00:00 1970 +++ TiMidity++-2.9.1/interface/w32g_ut2.c Mon Mar 20 15:09:40 2000 @@ -0,0 +1,187 @@ +#include +#include +#include +#include +#include "w32g_ut2.h" + +char *timidity_window_inifile; + +// **************************************************************************** +// DlgChooseFont +// hwnd: Owner Window of This Dialog +// hwndFontChange: Window to Change Font +// hFontPre: Previous Font of hwndFontChange (Call CloseHandle()) +int DlgChooseFontAndApply(HWND hwnd, HWND hwndFontChange, HFONT hFontPre, char *fontname, int *fontheight, int *fontwidth) +{ + LOGFONT lf; + CHOOSEFONT cf; + HFONT hFont; + memset(&lf,0,sizeof(LOGFONT)); + memset(&cf,0,sizeof(CHOOSEFONT)); + +// lf.lfHeight = 16; +// lf.lfWidth = 8; + strcpy(lf.lfFaceName,"lr "); + cf.lStructSize = sizeof(CHOOSEFONT); + cf.hwndOwner = hwnd; +// cf.hDC = NULL; + cf.lpLogFont = &lf; +// cf.iPointSize = 16; +// cf.Flags = CF_ANSIONLY | CF_FORCEFONTEXIST ; + cf.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;; +// cf.rgbColors = RGB(0,0,0); +// cf.lCustData = NULL; +// cf.lpfnHook = NULL; +// cf.lpTemplateName = NULL; +// cf.hInstance = 0; +// cf.lpszStyle = NULL; + cf.nFontType = SCREEN_FONTTYPE; +// cf.nSizeMin = 4; +// cf.nSizeMax = 72; + ChooseFont(&cf); + +// if(ChooseFont(&cf)==TRUE) +// return -1; + if(hFontPre!=NULL) + CloseHandle(hFontPre); + hFont = CreateFontIndirect(&lf); + SendMessage(hwndFontChange,WM_SETFONT,(WPARAM)hFont,(LPARAM)MAKELPARAM(TRUE,0)); + if(fontname!=NULL) strcpy(fontname,lf.lfFaceName); + if(fontheight!=NULL) *fontheight = lf.lfHeight; + if(fontwidth!=NULL) *fontwidth = lf.lfWidth; + return 0; +} + +int DlgChooseFont(HWND hwnd, char *fontName, int *fontHeight, int *fontWidth) +{ + LOGFONT lf; + CHOOSEFONT cf; + + memset(&lf,0,sizeof(LOGFONT)); + if(fontHeight!=NULL) lf.lfHeight = *fontHeight; + if(fontWidth!=NULL) lf.lfWidth = *fontWidth; + if(fontName!=NULL) strcpy(lf.lfFaceName,fontName); + + memset(&cf,0,sizeof(CHOOSEFONT)); + cf.lStructSize = sizeof(CHOOSEFONT); + cf.hwndOwner = hwnd; +// cf.hDC = NULL; + cf.lpLogFont = &lf; +// cf.iPointSize = 16; +// cf.Flags = CF_ANSIONLY | CF_FORCEFONTEXIST ; + cf.Flags = CF_ANSIONLY | CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT; +// cf.rgbColors = RGB(0,0,0); +// cf.lCustData = NULL; +// cf.lpfnHook = NULL; +// cf.lpTemplateName = NULL; +// cf.hInstance = 0; +// cf.lpszStyle = NULL; + cf.nFontType = SCREEN_FONTTYPE; +// cf.nSizeMin = 4; +// cf.nSizeMax = 72; + if(ChooseFont(&cf)!=TRUE) + return -1; + + if(fontName!=NULL) strcpy(fontName,lf.lfFaceName); + if(fontHeight!=NULL) *fontHeight = abs(lf.lfHeight); + if(fontWidth!=NULL) *fontWidth = lf.lfWidth; + return 0; +} + +/**********************************************************************/ +int INILoadAll(void) +{ + INILoadListWnd(); + return 0; +} +int INISaveAll(void) +{ + INISaveListWnd(); + return 0; +} + + +/**********************************************************************/ +#define SEC_LISTWND "ListWnd" +int INISaveListWnd(void) +{ + char *section = SEC_LISTWND; + char *inifile = TIMIDITY_WINDOW_INI_FILE; + char buffer[256]; + sprintf(buffer,"%d",ListWndInfo.Width); + WritePrivateProfileString(section,"Width",buffer,inifile); + sprintf(buffer,"%d",ListWndInfo.Height); + WritePrivateProfileString(section,"Height",buffer,inifile); + WritePrivateProfileString(section,"fontName",ListWndInfo.fontName,inifile); + sprintf(buffer,"%d",ListWndInfo.fontWidth); + WritePrivateProfileString(section,"fontWidth",buffer,inifile); + sprintf(buffer,"%d",ListWndInfo.fontHeight); + WritePrivateProfileString(section,"fontHeight",buffer,inifile); + sprintf(buffer,"%d",ListWndInfo.fontFlags); + WritePrivateProfileString(section,"fontFlags",buffer,inifile); + WritePrivateProfileString(NULL,NULL,NULL,inifile); // Write Flush + return 0; +} + +int INILoadListWnd(void) +{ + char *section = SEC_LISTWND; + char *inifile = TIMIDITY_WINDOW_INI_FILE; + int num; + char buffer[64]; + num = GetPrivateProfileInt(section,"Width",-1,inifile); + if(num!=-1) ListWndInfo.Width = num; + num = GetPrivateProfileInt(section,"Height",-1,inifile); + if(num!=-1) ListWndInfo.Height = num; + GetPrivateProfileString(section,"fontName","",buffer,32,inifile); + if(buffer[0]!=0) strcpy(ListWndInfo.fontName,buffer); + num = GetPrivateProfileInt(section,"fontWidth",-1,inifile); + if(num!=-1) ListWndInfo.fontWidth = num; + num = GetPrivateProfileInt(section,"fontHeight",-1,inifile); + if(num!=-1) ListWndInfo.fontHeight = num; + num = GetPrivateProfileInt(section,"fontFlags",-1,inifile); + if(num!=-1) ListWndInfo.fontFlags = num; + return 0; +} + +#define SEC_DOCWND "DocWnd" +int INISaveDocWnd(void) +{ + char *section = SEC_DOCWND; + char *inifile = TIMIDITY_WINDOW_INI_FILE; + char buffer[256]; + sprintf(buffer,"%d",DocWndInfo.Width); + WritePrivateProfileString(section,"Width",buffer,inifile); + sprintf(buffer,"%d",DocWndInfo.Height); + WritePrivateProfileString(section,"Height",buffer,inifile); + WritePrivateProfileString(section,"fontName",DocWndInfo.fontName,inifile); + sprintf(buffer,"%d",DocWndInfo.fontWidth); + WritePrivateProfileString(section,"fontWidth",buffer,inifile); + sprintf(buffer,"%d",DocWndInfo.fontHeight); + WritePrivateProfileString(section,"fontHeight",buffer,inifile); + sprintf(buffer,"%d",DocWndInfo.fontFlags); + WritePrivateProfileString(section,"fontFlags",buffer,inifile); + WritePrivateProfileString(NULL,NULL,NULL,inifile); // Write Flush + return 0; +} + +int INILoadDocWnd(void) +{ + char *section = SEC_DOCWND; + char *inifile = TIMIDITY_WINDOW_INI_FILE; + int num; + char buffer[64]; + num = GetPrivateProfileInt(section,"Width",-1,inifile); + if(num!=-1) DocWndInfo.Width = num; + num = GetPrivateProfileInt(section,"Height",-1,inifile); + if(num!=-1) DocWndInfo.Height = num; + GetPrivateProfileString(section,"fontName","",buffer,32,inifile); + if(buffer[0]!=0) strcpy(DocWndInfo.fontName,buffer); + num = GetPrivateProfileInt(section,"fontWidth",-1,inifile); + if(num!=-1) DocWndInfo.fontWidth = num; + num = GetPrivateProfileInt(section,"fontHeight",-1,inifile); + if(num!=-1) DocWndInfo.fontHeight = num; + num = GetPrivateProfileInt(section,"fontFlags",-1,inifile); + if(num!=-1) DocWndInfo.fontFlags = num; + return 0; +} diff -ruN TiMidity++-2.9.0/interface/w32g_ut2.h TiMidity++-2.9.1/interface/w32g_ut2.h --- TiMidity++-2.9.0/interface/w32g_ut2.h Thu Jan 1 09:00:00 1970 +++ TiMidity++-2.9.1/interface/w32g_ut2.h Mon Mar 20 15:09:40 2000 @@ -0,0 +1,73 @@ +#ifndef __W32G_UT2_H__ +#define __W32G_UT2_H__ + +extern int DlgChooseFontAndApply(HWND hwnd, HWND hwndFontChange, HFONT hFontPre, char *fontname, int *fontheight, int *fontwidth); +extern int DlgChooseFont(HWND hwnd, char *fontName, int *fontHeight, int *fontWidth); + +extern int INILoadAll(void); +extern int INISaveAll(void); + +// ini file of timidity window information +#define TIMIDITY_WINDOW_INI_FILE timidity_window_inifile + +#define FONT_FLAGS_NONE 0x00 +#define FONT_FLAGS_FIXED 0x01 +#define FONT_FLAGS_ITALIC 0x02 +#define FONT_FLAGS_BOLD 0x04 + +// section of ini file +// [ListWnd] +// Width = +// Height = +// fontName = +// fontWidth = +// fontHeight = +typedef struct LISTWNDINFO_ { + HWND hwnd; + int Width; // save parameter + int Height; // save parameter + HMENU hPopupMenu; + HWND hwndListBox; + HFONT hFontListBox; + char fontName[64]; // save parameter + int fontWidth; // save parameter + int fontHeight; // save parameter + int fontFlags; // save parameter +} LISTWNDINFO; +extern LISTWNDINFO ListWndInfo; + +// section of ini file +// [DocWnd] +// Width = +// Height = +// fontName = +// fontWidth = +// fontHeight = +#define DOCWND_DOCFILEMAX 10 +typedef struct DOCWNDINFO_ { + char DocFile[DOCWND_DOCFILEMAX][512]; + int DocFileMax; + int DocFileCur; + char *Text; + int TextSize; + + HWND hwnd; + int Width; // save parameter + int Height; // save parameter + HMENU hPopupMenu; + HWND hwndEdit; + HFONT hFontEdit; + char fontName[64]; // save parameter + int fontWidth; // save parameter + int fontHeight; // save parameter + int fontFlags; // save parameter +// HANDLE hMutex; +} DOCWNDINFO; +extern DOCWNDINFO DocWndInfo; + +extern int INISaveListWnd(void); +extern int INILoadListWnd(void); +extern int INISaveDocWnd(void); +extern int INILoadDocWnd(void); + +#endif /* __W32G_UT2_H__ */ diff -ruN TiMidity++-2.9.0/interface/w32g_utl.c TiMidity++-2.9.1/interface/w32g_utl.c --- TiMidity++-2.9.0/interface/w32g_utl.c Mon Feb 7 07:41:31 2000 +++ TiMidity++-2.9.1/interface/w32g_utl.c Mon Mar 20 15:09:40 2000 @@ -602,6 +602,7 @@ // ini & config static char S_IniFile[MAXPATH + 32]; +static char S_timidity_window_inifile[MAXPATH + 32]; static char S_ConfigFile[MAXPATH + 32]; static char S_PlaylistFile[MAXPATH + 32]; static char S_PlaylistHistoryFile[MAXPATH + 32]; @@ -641,6 +642,7 @@ SETTING_PLAYER *sp_default, *sp_current, *sp_temp; SETTING_TIMIDITY *st_default, *st_current, *st_temp; +extern char *timidity_window_inifile; void w32g_initialize(void) { @@ -698,6 +700,10 @@ strncpy(IniFile, buffer, MAXPATH); IniFile[MAXPATH] = '\0'; strcat(IniFile,"timpp32g.ini"); + timidity_window_inifile = S_timidity_window_inifile; + strncpy(timidity_window_inifile, buffer, 200); + timidity_window_inifile[200] = '\0'; + strcat(timidity_window_inifile,"timidity_window.ini"); st_default = (SETTING_TIMIDITY *)safe_malloc(sizeof(SETTING_TIMIDITY)); sp_default = (SETTING_PLAYER *)safe_malloc(sizeof(SETTING_PLAYER)); st_current = (SETTING_TIMIDITY *)safe_malloc(sizeof(SETTING_TIMIDITY)); diff -ruN TiMidity++-2.9.0/libarc/arc_lzh.c TiMidity++-2.9.1/libarc/arc_lzh.c --- TiMidity++-2.9.0/libarc/arc_lzh.c Mon Feb 7 07:37:38 2000 +++ TiMidity++-2.9.1/libarc/arc_lzh.c Mon Mar 20 14:47:50 2000 @@ -254,6 +254,7 @@ retry_read: dir_length = 0; name_length = 0; +#if 0 if((header_size = url_getc(url)) == EOF) return NULL; if(header_size == 0) @@ -273,6 +274,44 @@ if(url_read(url, data + I_HEADER_CHECKSUM, header_size - 1) < header_size - 1) return NULL; +#else /* a little cleverer lzh check */ + if(macbin_check){ +// for(i=0;i= 6){ + if(*(data + i - 4) == '-' + && *(data + i - 3) == 'l' + && *(data + i - 2) == 'h' + && *(data + i - 0) == '-') + { + int j; + if(arc_handler.isfile) + arc_handler.pos += i - 6; + for(j = 0; j<= 6; j++) + *(data + j) = *(data + i - 6 + j); + header_size = (int)(unsigned char)(*(data + i - 6)); + if(header_size == 0) + return NULL; + if(url_read(url, data + 7, header_size - 7) < header_size - 7) + return NULL; + break; + } + } + } + if(i >= LZHEADER_STRAGE) + return NULL; + } else { + if((header_size = url_getc(url)) == EOF) + return NULL; + if(url_read(url, data + I_HEADER_CHECKSUM, + header_size - 1) < header_size - 1) + return NULL; + } + macbin_check = 0; +#endif hdrsiz = header_size; setup_get(data + I_HEADER_LEVEL); header_level = get_byte(); diff -ruN TiMidity++-2.9.0/libarc/arc_tar.c TiMidity++-2.9.1/libarc/arc_tar.c --- TiMidity++-2.9.0/libarc/arc_tar.c Mon Feb 7 07:37:32 2000 +++ TiMidity++-2.9.1/libarc/arc_tar.c Mon Mar 20 14:55:09 2000 @@ -108,22 +108,24 @@ } else { - void *data; - long n; + void *data; + long n; - data = url_dump(url, size, &n); - if(size != n) + data = url_dump(url, size, &n); + if(size != n) { - free_entry_node(entry); - return NULL; + if(data != NULL) + free(data); + free_entry_node(entry); + return NULL; } - entry->cache = arc_compress(data, size, ARC_DEFLATE_LEVEL, - &entry->compsize); - free(data); - entry->comptype = ARCHIVEC_DEFLATED; - entry->origsize = size; - entry->start = 0; - url_skip(url, sizeb - size); + entry->cache = arc_compress(data, size, ARC_DEFLATE_LEVEL, + &entry->compsize); + free(data); + entry->comptype = ARCHIVEC_DEFLATED; + entry->origsize = size; + entry->start = 0; + url_skip(url, sizeb - size); } return entry; diff -ruN TiMidity++-2.9.0/libarc/url.c TiMidity++-2.9.1/libarc/url.c --- TiMidity++-2.9.0/libarc/url.c Wed Feb 16 01:59:43 2000 +++ TiMidity++-2.9.1/libarc/url.c Mon Mar 20 14:59:28 2000 @@ -529,9 +529,11 @@ *read_size = 0; if(nbytes == 0) return NULL; - if(nbytes > 0) + if(nbytes >= 0) { buff = (void *)safe_malloc(nbytes); + if(nbytes == 0) + return buff; read_len = url_nread(url, buff, nbytes); if(read_size != NULL) *read_size = read_len; diff -ruN TiMidity++-2.9.0/libarc/url.h TiMidity++-2.9.1/libarc/url.h --- TiMidity++-2.9.0/libarc/url.h Wed Feb 16 01:04:17 2000 +++ TiMidity++-2.9.1/libarc/url.h Mon Mar 6 13:57:18 2000 @@ -26,7 +26,7 @@ */ -#define URL_LIB_VERSION "1.9.4" +#define URL_LIB_VERSION "1.9.5" /* Define if you want to enable pipe command scheme ("command|") */ #define PIPE_SCHEME_ENABLE diff -ruN TiMidity++-2.9.0/libarc/url_ftp.c TiMidity++-2.9.1/libarc/url_ftp.c --- TiMidity++-2.9.0/libarc/url_ftp.c Mon Feb 7 07:36:55 2000 +++ TiMidity++-2.9.1/libarc/url_ftp.c Mon Mar 6 13:52:26 2000 @@ -155,7 +155,7 @@ char *p, *host, *path; unsigned short port; char buff[BUFSIZ]; - char path_buff[1024]; + char path_buff[1024], host_buff[1024]; int n; char *passwd; char *user; @@ -202,7 +202,11 @@ name += 6; strncpy(buff, name, sizeof(buff)); buff[sizeof(buff) - 1] = '\0'; - host = buff; + + strncpy(host_buff, buff, sizeof(host_buff)); + host_buff[sizeof(host_buff) - 1] = '\0'; + host = host_buff; + if((p = strchr(host, '/')) == NULL) { url_ftp_close((URL)url); diff -ruN TiMidity++-2.9.0/libunimod/load_it.c TiMidity++-2.9.1/libunimod/load_it.c --- TiMidity++-2.9.0/libunimod/load_it.c Thu Feb 17 23:22:34 2000 +++ TiMidity++-2.9.1/libunimod/load_it.c Mon Mar 20 15:51:38 2000 @@ -695,6 +695,11 @@ s.vibrate = _mm_read_UBYTE (modreader); s.vibwave = _mm_read_UBYTE (modreader); + /* Some IT files have bogues loopbeg/loopend if looping is not used by + * a sample. */ + if (!(s.flag & 80)) + s.loopbeg = s.loopend = 0; + /* Generate an error if c5spd is > 512k, or samplelength > 256 megs (nothing would EVER be that high) */ diff -ruN TiMidity++-2.9.0/timidity/Makefile.in TiMidity++-2.9.1/timidity/Makefile.in --- TiMidity++-2.9.0/timidity/Makefile.in Sun Feb 27 22:50:34 2000 +++ TiMidity++-2.9.1/timidity/Makefile.in Tue Mar 21 04:52:18 2000 @@ -362,7 +362,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 ../libarc/arc.h + instrum.h playmidi.h readmidi.h ../libarc/arc.h ../interface.h info-am: info: info-am diff -ruN TiMidity++-2.9.0/timidity/common.c TiMidity++-2.9.1/timidity/common.c --- TiMidity++-2.9.0/timidity/common.c Mon Feb 7 08:00:53 2000 +++ TiMidity++-2.9.1/timidity/common.c Tue Mar 7 16:01:47 2000 @@ -592,6 +592,31 @@ #endif /* HAVE_VOLATILE */ /* code converters */ +static unsigned char + w2k[] = {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, + 242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, + 193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, + 210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209}; + +static void code_convert_cp1251(char *in, char *out, int maxlen) +{ + int i; + if(out == NULL) + out = in; + for(i = 0; i < maxlen && in[i]; i++) + { + if(in[i] & 0200) + out[i] = w2k[in[i] & 0177]; + else + out[i] = in[i]; + } + out[i]='\0'; +} + static void code_convert_dump(char *in, char *out, int maxlen, char *ocode) { if(ocode == NULL) @@ -791,6 +816,12 @@ if(strcasecmp(ocode, "ascii") == 0) { code_convert_dump(in, out, outsiz - 1, "ASCII"); + return; + } + + if(strcasecmp(ocode, "1251") == 0) + { + code_convert_cp1251(in, out, outsiz - 1); return; } } diff -ruN TiMidity++-2.9.0/timidity/controls.h TiMidity++-2.9.1/timidity/controls.h --- TiMidity++-2.9.0/timidity/controls.h Sat Feb 19 18:34:12 2000 +++ TiMidity++-2.9.1/timidity/controls.h Mon Mar 20 14:32:07 2000 @@ -29,6 +29,9 @@ /* Return values for ControlMode.read */ #define RC_ERROR -1 +#ifdef RC_NONE +#undef RC_NONE +#endif #define RC_NONE 0 #define RC_QUIT 1 #define RC_NEXT 2 diff -ruN TiMidity++-2.9.0/timidity/mod.c TiMidity++-2.9.1/timidity/mod.c --- TiMidity++-2.9.0/timidity/mod.c Sat Feb 19 20:58:35 2000 +++ TiMidity++-2.9.1/timidity/mod.c Mon Mar 20 15:47:32 2000 @@ -60,6 +60,7 @@ int load_module_file (struct timidity_file *tf, int mod_type) { + int i, err; MODULE *mf; #ifdef LOOKUP_HACK @@ -69,12 +70,13 @@ #endif ML_monosamples = 1; + ML_RegisterAllLoaders (); mf = ML_Load (tf->url, MOD_NUM_VOICES, 0); if (ML_errno) return 1; current_file_info->file_type = mod_type; - load_module_samples (mf->samples, mf->numsmp); + load_module_samples (mf->samples, mf->numsmp, mod_type == IS_MOD_FILE); mod_do_play (mf); ML_Free (mf); return 0; @@ -84,9 +86,13 @@ int get_module_type (char *fn) { - if (check_file_extension (fn, ".xm", 1) /* Most common first */ + char *p; + + if (check_file_extension (fn, ".mod", 1)) /* Most common first */ + return IS_MOD_FILE; + + if (check_file_extension (fn, ".xm", 1) || check_file_extension (fn, ".s3m", 1) - || check_file_extension (fn, ".mod", 1) || check_file_extension (fn, ".it", 1) || check_file_extension (fn, ".669", 1) /* Then the others in alphabetic order */ || check_file_extension (fn, ".amf", 1) @@ -101,7 +107,7 @@ || check_file_extension (fn, ".ult", 1) || check_file_extension (fn, ".uni", 1)) - return IS_MOD_FILE; + return IS_S3M_FILE; return IS_OTHER_FILE; } @@ -1860,6 +1866,7 @@ /* if we were fading, adjust... */ if (mp.sngpos == (pf->numpos - 1)) mp.volume = pf->initvolume > 128 ? 128 : pf->initvolume; + mp.sngpos = dat; mp.posjmp = 2; mp.patpos = 0; @@ -1886,14 +1893,15 @@ if (!mp.posjmp) { /* don't ask me to explain this code - it makes - backwards.s3m and children.xm (heretic's version) play - correctly, among others. Take that for granted, or write - the page of comments yourself... you might need some - aspirin - Miod */ + * backwards.s3m and children.xm (heretic's version) play + * correctly, among others. Take that for granted, or write + * the page of comments yourself... you might need some + * aspirin - Miod */ if ((mp.sngpos == pf->numpos - 1) && (dat) && ((pf->positions[mp.sngpos] == (pf->numpat - 1) - && !(pf->flags & UF_NOWRAP)))) + && (pf->flags & UF_NOWRAP)))) { + /* printf("%d -- Pattern 0!\n", __LINE__); */ mp.sngpos = 0; mp.posjmp = 2; } @@ -1912,7 +1920,7 @@ mp.newbpm = dat; else if (dat) { - mp.sngspd = (dat > 32) ? 32 : dat; + mp.sngspd = (dat >= 32) ? 32 : dat; mp.vbtick = 0; } break; @@ -2289,19 +2297,19 @@ if ((!s) || (!s->length)) continue; - if (aout->period < 40) - aout->period = 40; - else if (aout->period > 50000) - aout->period = 50000; + if (aout->period < 14 || aout->period > 50000) + { + Voice_Stop(mp.channel); + continue; + } + kick_voice = 0; if ((aout->kick == KICK_NOTE) || (aout->kick == KICK_KEYOFF)) { kick_voice = 1; aout->fadevol = 32768; aout->aswppos = 0; } - else - kick_voice = 0; if (i && ((aout->kick == KICK_NOTE) || (aout->kick == KICK_ENV))) { @@ -2457,7 +2465,7 @@ Voice_Stop (mp.channel); Voice_SetPeriod (mp.channel, - getAmigaPeriod (pf->flags, playperiod)); + getAmigaPeriod (pf->flags, playperiod)); if (kick_voice) Voice_Play (mp.channel, s, (aout->start == -1) ? ((s->flags & SF_UST_LOOP) ? s->loopstart : 0) : aout->start); @@ -2922,6 +2930,7 @@ mp.patpos = mp.numrow ? (mp.patbrk % mp.numrow) : 0; mp.pat_repcrazy = 0; mp.sngpos += (mp.posjmp - 2); + for (mp.channel = 0; mp.channel < pf->numchn; mp.channel++) mp.control[mp.channel].pat_reppos = -1; @@ -2929,11 +2938,11 @@ /* handle the "---" (end of song) pattern since it can occur *inside* the module in .IT and .S3M */ if ((mp.sngpos >= pf->numpos) || (pf->positions[mp.sngpos] == 255)) - { - return 0; - } + return 0; + if (mp.sngpos < 0) mp.sngpos = pf->numpos - 1; + } if (!mp.patdly2) diff -ruN TiMidity++-2.9.0/timidity/mod2midi.c TiMidity++-2.9.1/timidity/mod2midi.c --- TiMidity++-2.9.0/timidity/mod2midi.c Fri Feb 18 03:21:25 2000 +++ TiMidity++-2.9.1/timidity/mod2midi.c Mon Mar 20 15:52:11 2000 @@ -19,7 +19,7 @@ mod2midi.c - Sample info -> MIDI event conversion + Mixer event -> MIDI event conversion */ @@ -31,6 +31,7 @@ #else #include #endif + #include "timidity.h" #include "common.h" #include "instrum.h" @@ -44,8 +45,21 @@ #include "mod2midi.h" +/* Define this to show all the notes touched by a bending in the + * user interface's trace view. This is interesting but disabled + * because it needs tons of CPU power (tens of voices are activated + * but unaudible). */ +/* #define TRACE_SLIDE_NOTES */ + +/* Define this to give a volume envelope to a MOD's notes. This + * could sound wrong with a few MODs, but gives richer sound most + * of the time. */ +#define USE_ENVELOPE + + #define SETMIDIEVENT(e, at, t, ch, pa, pb) \ - { (e).time = (at); (e).type = (t); \ + { /* printf("%d %d " #t " %d %d\n", at, ch, pa, pb); */ \ + (e).time = (at); (e).type = (t); \ (e).channel = (uint8)(ch); (e).a = (uint8)(pa); (e).b = (uint8)(pb); } #define MIDIEVENT(at, t, ch, pa, pb) \ @@ -60,46 +74,88 @@ #define NTSC_CLOCK 3579545.25 -#define NTSC_RATE (NTSC_CLOCK/428) /* <-- 428 = period for c2 */ +#define NTSC_RATE (NTSC_CLOCK/428) #define PAL_CLOCK 3546894.6 #define PAL_RATE (PAL_CLOCK/428) -#define MOD_NOTE_OFFSET 60 +#define MOD_ROOT_NOTE 36 + +/* The internal bending register is 21-bits wide and it is made like this: + * _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + * | | | | | | | | | | | | | | | | | | | | | | + * | 8 bits | 8 bits | 5 bits | + * | note shift | fine tune |discarded| + * '---------------'---------------'---------' + * + * The note shift is an `offset' field: 128 = keep this note. + * To compute it, the values given to the pitch-wheel MIDI event are + * multiplied by the sensitivity. We want to be able to express a full + * 120 notes bending (8 bits for the note shift + 8 for the fine tune) + * with 14-bit pitch-wheel event, so we want a sensitivity value that + * forces the bottom 7 bits of the internal register to 0. This value + * is of course 128. + */ + +#define WHEEL_SENSITIVITY (1 << 7) +#define WHEEL_VALUE(bend) ((bend) / WHEEL_SENSITIVITY + 0x2000) -#define MOD_BEND_SENSITIVE 60 typedef struct _ModVoice { int sample; /* current sample ID */ int noteon; /* (-1 means OFF status) */ + int time; /* time when note was activated */ int period; /* current frequency */ - int tuneon; /* note fine tune */ + int wheel; /* current pitch wheel value */ int pan; /* current panning */ int vol; /* current volume */ int start; /* sample start */ + + int32 noteson[4]; /* bit map for notes 0-127 */ } ModVoice; static void mod_change_tempo (int32 at, int bpm); -static int mod_pitch_bend (int tune); static int period2note (int period, int *finetune); static ModVoice ModV[MOD_NUM_VOICES]; static int at; -static int period_table[84] = -{ -/* C C# D D# E F F# G G# A A# B */ -/* 0 */ 1712, 1616, 1524, 1440, 1356, 1280, 1208, 1140, 1076, 1016, 960, 906, -/* 1 */ 856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453, -/* 2 */ 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226, -/* 3 */ 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113, -/* 4 */ 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, 56, -/* 5 */ 53, 50, 47, 45, 42, 40, 37, 35, 33, 31, 30, 28, -/* 6 */ 27, 25, 24, 22, 21, 20, 19, 18, 17, 16, 15, 14 +/******************** bitmap handling macros **********************************/ + +#define bitmapGet(map, n) ((map)[(n) >> 5] & (1 << ((n) & 31))) +#define bitmapSet(map, n) ((map)[(n) >> 5] |= (1 << ((n) & 31))) +#define bitmapClear(map) ((map)[0] = (map)[1] = (map)[2] = (map)[3] = 0) + +static char significantDigitsLessOne[256] = { + -1, /* 1 */ + 0, /* 2 */ + 1, 1, /* 4 */ + 2, 2, 2, 2, /* 8 */ + 3, 3, 3, 3, 3, 3, 3, 3, /* 16 */ + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* 32 */ + + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 64 */ + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, /* 128 */ + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, /* 256 */ + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 }; +/******************************************************************************/ + void mod_change_tempo (int32 at, int bpm) { @@ -114,31 +170,35 @@ } int -mod_pitch_bend(int tune) -{ - int bend; - - bend = tune * (8192 / 256) / MOD_BEND_SENSITIVE + 8192; - if (bend <= 0) - bend = 1; - else if (bend >= 2 * 8192) - bend = 2 * 8192 - 1; - - return bend; -} - -int period2note (int period, int *finetune) { + static int period_table[120] = + { + /* C C# D D# E F F# G G# A A# B */ + 13696,12928,12192,11520,10848,10240, 9664, 9120, 8608, 8096, 7680, 7248, + 6848, 6464, 6096, 5760, 5424, 5120, 4832, 4560, 4304, 4048, 3840, 3624, + 3424, 3232, 3048, 2880, 2712, 2560, 2416, 2280, 2152, 2024, 1920, 1812, + 1712, 1616, 1524, 1440, 1356, 1280, 1208, 1140, 1076, 1016, 960, 906, + 856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453, + 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226, + 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113, + 107, 101, 95, 90, 85, 80, 75, 71, 67, 63, 60, 56, + 53, 50, 47, 45, 42, 40, 37, 35, 33, 31, 30, 28, + 27, 25, 24, 22, 21, 20, 19, 18, 17, 16, 15, 14 + }; + int note; int l, r, m; - if (period < 14 || period > 1712) + if (period < 14 || period > 13696) + { + ctl->cmsg(CMSG_WARNING, VERB_NORMAL, "BAD period %d\n", period); return -1; + } /* bin search */ l = 0; - r = 84; + r = 120; while (l < r) { m = (l + r) / 2; @@ -150,23 +210,19 @@ note = l - 1; /* - * 83 >= note >= 0 + * 119 >= note >= 0 * period_table[note] >= period > period_table[note + 1] */ if (period_table[note] == period) - { - *finetune = 0; - } + *finetune = 0; else - { - /* fine tune completion */ - *finetune = (int) (256.0 * - (period_table[note] - period) / - (period_table[note] - period_table[note + 1])); - } + /* fine tune completion */ + *finetune = ((period_table[note] - period) << 8) / + (period_table[note] - period_table[note + 1]); - return note + MOD_NOTE_OFFSET; + *finetune <<= 5; + return note; } /********** Interface to mod.c */ @@ -177,42 +233,62 @@ if (v >= MOD_NUM_VOICES) return; - if (vol != ModV[v].vol) { - ModV[v].vol = vol; - vol = vol > 254 ? 127 : vol >> 1; - MIDIEVENT (at, ME_EXPRESSION, v, vol, 0); + /* MOD volume --> MIDI volume */ + vol = vol > 254 ? 127 : vol >> 1; + + if ((ModV[v].vol != vol) && (ModV[v].noteon != -1)) { + MIDIEVENT (at, ME_KEYPRESSURE, v, ModV[v].noteon, vol); } + ModV[v].vol = vol; } void Voice_SetPeriod (UBYTE v, ULONG period) { - int tune, new_noteon, bend; + int new_noteon, new_sample, bend; if (v >= MOD_NUM_VOICES) return; ModV[v].period = period; - new_noteon = period2note (ModV[v].period, &tune); - if (new_noteon < 0) - { - return; - } + if (ModV[v].noteon < 0) + return; - if (ModV[v].noteon != new_noteon) - MIDIEVENT(at, ME_NOTEOFF, v, ModV[v].noteon, 0); + 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 (ModV[v].tuneon != tune) - { - ModV[v].tuneon = tune; - bend = mod_pitch_bend(tune); - MIDIEVENT (at, ME_PITCHWHEEL, v, bend & 0x7F, (bend >> 7) & 0x7F); - } - if (ModV[v].noteon != new_noteon) { + if (!bitmapGet(ModV[v].noteson, new_noteon)) + { + MIDIEVENT(ModV[v].time, ME_NOTEON, v, new_noteon, 1); + bitmapSet(ModV[v].noteson, new_noteon); + } + + if (new_noteon < 0) + { + ctl->cmsg(CMSG_WARNING, VERB_VERBOSE, + "Strange period %d", + ModV[v].period); + return; + } + else + { + MIDIEVENT(at, ME_KEYPRESSURE, v, ModV[v].noteon, 1); + MIDIEVENT(at, ME_KEYPRESSURE, v, new_noteon, ModV[v].vol); + } + ModV[v].noteon = new_noteon; - MIDIEVENT(at, ME_NOTEON, v, ModV[v].noteon, 0x7f); + } + + if (ModV[v].wheel != bend) + { + ModV[v].wheel = bend; + MIDIEVENT (at, ME_PITCHWHEEL, v, bend & 0x7F, (bend >> 7) & 0x7F); } } @@ -233,23 +309,31 @@ void Voice_Play (UBYTE v, SAMPLE * s, ULONG start) { - int tune, new_noteon, new_sample, bend; + int new_noteon, bend; if (v >= MOD_NUM_VOICES) return; - new_noteon = period2note (ModV[v].period, &tune); - new_sample = s->id; + if (ModV[v].noteon != -1) + 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; + } ModV[v].noteon = new_noteon; - if (ModV[v].noteon < 0) - { - return; - } + ModV[v].time = at; + bitmapSet(ModV[v].noteson, new_noteon); - if (ModV[v].sample != new_sample) + if (ModV[v].sample != s->id) { - ModV[v].sample = new_sample; + ModV[v].sample = s->id; MIDIEVENT(at, ME_SET_PATCH, v, ModV[v].sample, 0); + ModV[v].start = 0; } if (ModV[v].start != start) @@ -261,33 +345,54 @@ MIDIEVENT (at, ME_PATCH_OFFS, v, a, b); } - if (ModV[v].tuneon != tune) + if (ModV[v].wheel != bend) { - ModV[v].tuneon = tune; - bend = mod_pitch_bend(tune); + ModV[v].wheel = bend; MIDIEVENT (at, ME_PITCHWHEEL, v, bend & 0x7F, (bend >> 7) & 0x7F); } - - MIDIEVENT (at, ME_NOTEON, v, ModV[v].noteon, 0x7f); + + MIDIEVENT (at, ME_NOTEON, v, ModV[v].noteon, ModV[v].vol); } void Voice_Stop (UBYTE v) { + int32 j; + int n; + if (v >= MOD_NUM_VOICES) return; - if (ModV[v].noteon != -1) - { - MIDIEVENT (at, ME_NOTEOFF, v, ModV[v].noteon, 0); - ModV[v].noteon = -1; - } + if (ModV[v].noteon == -1) + return; + +#define TURN_OFF_8(base, ofs) \ + while (j & (0xFFL << (ofs))) { \ + n = ofs + significantDigitsLessOne[(unsigned char) (j >> (ofs))]; \ + MIDIEVENT (at, ME_NOTEOFF, v, (base) + n, 63); \ + j ^= 1 << n; \ + } + +#define TURN_OFF_32(base) \ + do { \ + TURN_OFF_8((base), 24) \ + TURN_OFF_8((base), 16) \ + TURN_OFF_8((base), 8) \ + TURN_OFF_8((base), 0) \ + } while(0) + + if (j = ModV[v].noteson[0]) TURN_OFF_32(0); + if (j = ModV[v].noteson[1]) TURN_OFF_32(32); + if (j = ModV[v].noteson[2]) TURN_OFF_32(64); + if (j = ModV[v].noteson[3]) TURN_OFF_32(96); + bitmapClear(ModV[v].noteson); + ModV[v].noteon = -1; } BOOL Voice_Stopped (UBYTE v) { - return (v >= MOD_NUM_VOICES) ? 1 : (ModV[v].noteon == -1); + return (v >= MOD_NUM_VOICES) || (ModV[v].noteon == -1); } void @@ -325,18 +430,22 @@ { ModV[v].sample = -1; ModV[v].noteon = -1; + ModV[v].time = -1; ModV[v].period = 0; - ModV[v].tuneon = 0; - ModV[v].pan = (v & 1) ? 127 : 0; + ModV[v].wheel = 0x2000; ModV[v].vol = 64; ModV[v].start = 0; + ModV[v].pan = (v & 1) ? 127 : 0; + bitmapClear(ModV[v].noteson); MIDIEVENT(0, ME_PAN, v, ModV[v].pan, 0); MIDIEVENT(0, ME_SET_PATCH, v, 1, 0); MIDIEVENT(0, ME_MAINVOLUME, v, 127, 0); + MIDIEVENT(0, ME_EXPRESSION, v, 127, 0); + /* MIDIEVENT(0, ME_MONO, v, 0, 0); */ MIDIEVENT(0, ME_RPN_LSB, v, 0, 0); MIDIEVENT(0, ME_RPN_MSB, v, 0, 0); - MIDIEVENT(0, ME_DATA_ENTRY_MSB, v, MOD_BEND_SENSITIVE, 0); + MIDIEVENT(0, ME_DATA_ENTRY_MSB, v, WHEEL_SENSITIVITY, 0); MIDIEVENT(0, ME_DRUMPART, v, 0, 0); } @@ -368,7 +477,7 @@ } -void load_module_samples (SAMPLE * s, int numsamples) +void load_module_samples (SAMPLE * s, int numsamples, int ntsc) { int i; @@ -417,8 +526,10 @@ if (sp->modes & (MODES_PINGPONG | MODES_REVERSE)) sp->modes &= ~MODES_LOOPING; +#ifdef USE_ENVELOPE /* envelope (0,1:attack, 2:sustain, 3,4,5:release) */ sp->modes |= MODES_ENVELOPE; + /* attack */ sp->envelope_offset[0] = env_offset(255); sp->envelope_rate[0] = env_rate(255, 0.0); /* fastest */ @@ -429,17 +540,21 @@ sp->envelope_rate[2] = 0; /* release */ sp->envelope_offset[3] = env_offset(0); - sp->envelope_rate[3] = env_rate(255, 200.0); /* 200 msec */ + if(modify_release) + sp->envelope_rate[3] = env_rate(255, (double)modify_release); /* -R# */ + else + sp->envelope_rate[3] = env_rate(255, 80.0); /* 80 msec */ sp->envelope_offset[4] = sp->envelope_offset[3]; sp->envelope_rate[4] = 0; /* skip this stage */ sp->envelope_offset[5] = sp->envelope_offset[4]; sp->envelope_rate[5] = 0; /* skip this stage, then the voice is disappeared */ +#endif - sp->sample_rate = ((int32)PAL_RATE) >> s->divfactor; + sp->sample_rate = ((int32) PAL_RATE) >> s->divfactor; sp->low_freq = 0; sp->high_freq = 0x7fffffff; - sp->root_freq = freq_table[MOD_NOTE_OFFSET]; + sp->root_freq = freq_table[MOD_ROOT_NOTE]; sp->volume = 1.0; /* I guess it should use globvol... */ sp->panning = s->panning == PAN_SURROUND ? 64 : s->panning * 128 / 255; sp->low_vel = 0; @@ -448,9 +563,12 @@ sp->loop_start <<= FRACTION_BITS; sp->loop_end <<= FRACTION_BITS; + /* If necessary do some anti-aliasing filtering */ + if (antialiasing_allowed) + antialiasing((int16 *)sp->data, sp->data_length / 2, + sp->sample_rate, play_mode->rate); + s->data = NULL; /* Avoid free-ing */ s->id = i; } } - -/* ex:set ts=4: */ diff -ruN TiMidity++-2.9.0/timidity/mod2midi.h TiMidity++-2.9.1/timidity/mod2midi.h --- TiMidity++-2.9.0/timidity/mod2midi.h Sat Feb 19 20:51:18 2000 +++ TiMidity++-2.9.1/timidity/mod2midi.h Mon Mar 20 15:47:35 2000 @@ -1,39 +1,38 @@ -/* - TiMidity++ -- MIDI to WAVE converter and player - Copyright (C) 1999,2000 Masanao Izumo - Copyright (C) 1995 Tuukka Toivonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - mod2midi.h - - Header file for sample info -> MIDI event conversion - - */ - -#include "unimod.h" - -void Voice_SetVolume (UBYTE, UWORD); -void Voice_SetFrequency (UBYTE, ULONG); -void Voice_SetPanning (UBYTE, ULONG); -void Voice_Play (UBYTE, SAMPLE *, ULONG); -void Voice_Stop (UBYTE); -BOOL Voice_Stopped (UBYTE); -void Voice_NewTempo (UWORD, UWORD); -void Voice_TickDone (); -void Voice_StartPlaying (); -void Voice_EndPlaying (); -void load_module_samples (SAMPLE *, int); -void Voice_SetPeriod (UBYTE v, ULONG period); +/* + TiMidity++ -- MIDI to WAVE converter and player + Copyright (C) 1999,2000 Masanao Izumo + Copyright (C) 1995 Tuukka Toivonen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + mod2midi.h + + Header file for sample info -> MIDI event conversion + + */ + +#include "unimod.h" + +void Voice_SetVolume (UBYTE, UWORD); +void Voice_SetFrequency (UBYTE, ULONG); +void Voice_SetPanning (UBYTE, ULONG); +void Voice_Play (UBYTE, SAMPLE *, ULONG); +void Voice_Stop (UBYTE); +BOOL Voice_Stopped (UBYTE); +void Voice_NewTempo (UWORD, UWORD); +void Voice_TickDone (); +void Voice_StartPlaying (); +void Voice_EndPlaying (); +void load_module_samples (SAMPLE *, int, int); diff -ruN TiMidity++-2.9.0/timidity/playmidi.c TiMidity++-2.9.1/timidity/playmidi.c --- TiMidity++-2.9.0/timidity/playmidi.c Sat Feb 19 22:40:30 2000 +++ TiMidity++-2.9.1/timidity/playmidi.c Mon Mar 20 16:29:20 2000 @@ -259,6 +259,8 @@ EVENT_NAME(ME_SET_PATCH); EVENT_NAME(ME_DRUMPART); EVENT_NAME(ME_KEYSHIFT); + EVENT_NAME(ME_PATCH_OFFS); + EVENT_NAME(ME_TEMPO); EVENT_NAME(ME_CHORUS_TEXT); EVENT_NAME(ME_LYRIC); @@ -270,7 +272,6 @@ EVENT_NAME(ME_MASTER_VOLUME); EVENT_NAME(ME_RESET); EVENT_NAME(ME_NOTE_STEP); - EVENT_NAME(ME_PATCH_OFFS); EVENT_NAME(ME_TIMESIG); EVENT_NAME(ME_WRD); EVENT_NAME(ME_SHERRY); @@ -293,7 +294,7 @@ { int i; - if(opt_overlap_voice_allow && !IS_CURRENT_MOD_FILE) + if(opt_overlap_voice_allow) { i = ch * 128 + note; return vidq_head[i]++; @@ -305,7 +306,7 @@ { int i; - if(opt_overlap_voice_allow && !IS_CURRENT_MOD_FILE) + if(opt_overlap_voice_allow) { i = ch * 128 + note; if(vidq_head[i] == vidq_tail[i]) @@ -1142,7 +1143,7 @@ note = MIDI_EVENT_NOTE(e); ch = e->channel; - if(opt_overlap_voice_allow && !IS_CURRENT_MOD_FILE) + if(opt_overlap_voice_allow) status_check = (VOICE_OFF | VOICE_SUSTAINED); else status_check = 0xFF; @@ -2638,8 +2639,9 @@ break; case ME_PATCH_OFFS: - if(special_patch[ch] != NULL) - special_patch[ch]->sample_offset = + i = channel[ch].special_sample; + if(special_patch[i] != NULL) + special_patch[i]->sample_offset = (current_event->a | 256 * current_event->b); break; @@ -3322,11 +3324,20 @@ else vpb = buffer_pointer; mix_voice(vpb, i, count); - if(voice[i].timeout > 0 && - voice[i].timeout < current_sample && - voice[i].status == VOICE_SUSTAINED) - finish_note(i); /* timeout (See also "#extension timeout" line - in *.cfg file */ + if(voice[i].timeout > 0 && + voice[i].timeout < current_sample) + { + if (voice[i].timeout > 1) + { + finish_note(i); /* timeout (See also "#extension timeout" line + in *.cfg file */ + } + else + { + free_voice(i); + ctl_note_event(i); + } + } } } @@ -3563,11 +3574,12 @@ #if defined(CSPLINE_INTERPOLATION) || defined(LAGRANGE_INTERPOLATION) /* fall back to linear interpolation when queue < 100% */ if (opt_realtime_playing != 2 && (play_mode->flag & PF_CAN_TRACE)) { - if (100 * (aq_filled() + aq_soft_filled()) / - aq_get_dev_queuesize() < 100) - reduce_quality_flag = 1; - else - reduce_quality_flag = no_4point_interpolation; + if (!aq_fill_buffer_flag && + 100 * ((double)(aq_filled() + aq_soft_filled()) / + aq_get_dev_queuesize()) < 99) + reduce_quality_flag = 1; + else + reduce_quality_flag = no_4point_interpolation; } #endif @@ -4131,8 +4143,9 @@ break; case ME_PATCH_OFFS: - if(special_patch[ch] != NULL) - special_patch[ch]->sample_offset = + i = channel[ch].special_sample; + if(special_patch[i] != NULL) + special_patch[i]->sample_offset = (current_event->a | 256 * current_event->b); break; diff -ruN TiMidity++-2.9.0/timidity/playmidi.h TiMidity++-2.9.1/timidity/playmidi.h --- TiMidity++-2.9.0/timidity/playmidi.h Sat Feb 19 19:01:25 2000 +++ TiMidity++-2.9.1/timidity/playmidi.h Thu Mar 9 14:18:58 2000 @@ -97,6 +97,9 @@ ME_SET_PATCH, /* Install special instrument */ ME_DRUMPART, ME_KEYSHIFT, + ME_PATCH_OFFS, /* Change special instrument sample position + * Channel, LSB, MSB + */ /* Global channel events */ @@ -112,15 +115,12 @@ ME_RESET, /* Reset and change system mode */ ME_NOTE_STEP, - ME_PATCH_OFFS, /* Change special instrument sample position - * SampleID, LSB, MSB - */ ME_TIMESIG, /* Time signature */ ME_WRD, /* for MIMPI WRD tracer */ ME_SHERRY, /* for Sherry WRD tracer */ ME_BARMARKER, - ME_STEP, + ME_STEP, /* for Metronome */ ME_LAST = 254, /* Last sequence of MIDI list. * This event is reserved for realtime player. diff -ruN TiMidity++-2.9.0/timidity/readmidi.c TiMidity++-2.9.1/timidity/readmidi.c --- TiMidity++-2.9.0/timidity/readmidi.c Fri Feb 18 11:27:56 2000 +++ TiMidity++-2.9.1/timidity/readmidi.c Mon Mar 20 15:47:59 2000 @@ -47,9 +47,6 @@ #include "wrd.h" #include "tables.h" -/* Define if you want to support backward event timer */ -#define BACKWARD_EVENT_OK - /* rcp.c */ int read_rcp_file(struct timidity_file *tf, char *magic0, char *fn); @@ -83,6 +80,7 @@ int opt_trace_text_meta_event = 0; #endif /* ALWAYS_TRACE_TEXT_META_EVENT */ +FLOAT_T tempo_adjust = 1.0; int opt_default_mid = 0; int opt_system_mid = 0; int ignore_midi_error = 1; @@ -154,10 +152,10 @@ void readmidi_add_event(MidiEvent *a_event) { - MidiEventList *next, *newev; + MidiEventList *newev; int32 at; - if(event_count == MAX_MIDI_EVENT) + if(event_count++ == MAX_MIDI_EVENT) { if(!readmidi_error_flag) { @@ -169,24 +167,39 @@ } at = a_event->time; - if(current_midi_point->event.time > at) -#ifdef BACKWARD_EVENT_OK - current_midi_point = evlist; /* Rewind the event pointer */ -#else - at = a_event->time = current_midi_point->event.time; -#endif /* BACKWARD_EVENT_OK */ newev = alloc_midi_event(); - newev->event = *a_event; - next = current_midi_point->next; - while(next && (next->event.time <= at)) + newev->event = *a_event; /* assign by value!!! */ + + if(at >= current_midi_point->event.time) + { + /* Forward scan */ + MidiEventList *next = current_midi_point->next; + while (next && (next->event.time <= at)) + { + current_midi_point = next; + next = current_midi_point->next; + } + newev->prev = current_midi_point; + newev->next = next; + current_midi_point->next = newev; + if (next) + next->prev = newev; + } + else { - current_midi_point = next; - next = current_midi_point->next; + /* Backward scan -- symmetrical to the one above */ + MidiEventList *prev = current_midi_point->prev; + while (prev && (prev->event.time > at)) { + current_midi_point = prev; + prev = current_midi_point->prev; + } + newev->prev = prev; + newev->next = current_midi_point; + current_midi_point->prev = newev; + if (prev) + prev->next = newev; } - newev->next = next; - current_midi_point->next = newev; current_midi_point = newev; - event_count++; } void readmidi_add_ctl_event(int32 at, int ch, int a, int b) @@ -1975,6 +1988,7 @@ if(meep->event.type == ME_TEMPO) { tempo = ch + meep->event.b * 256 + meep->event.a * 65536; + tempo *= tempo_adjust; compute_sample_increment(tempo, divisions); } @@ -2116,6 +2130,7 @@ evlist->event.channel = 0; evlist->event.a = 0; evlist->event.b = 0; + evlist->prev = NULL; evlist->next = NULL; readmidi_error_flag = 0; event_count = 1; diff -ruN TiMidity++-2.9.0/timidity/readmidi.h TiMidity++-2.9.1/timidity/readmidi.h --- TiMidity++-2.9.0/timidity/readmidi.h Mon Feb 7 07:57:05 2000 +++ TiMidity++-2.9.1/timidity/readmidi.h Mon Mar 20 15:48:09 2000 @@ -76,6 +76,7 @@ typedef struct { MidiEvent event; void *next; + void *prev; } MidiEventList; struct midi_file_info @@ -138,5 +139,6 @@ extern int readmidi_error_flag; extern int readmidi_wrd_mode; extern int play_system_mode; +extern FLOAT_T tempo_adjust; #endif /* ___READMIDI_H_ */ diff -ruN TiMidity++-2.9.0/timidity/recache.c TiMidity++-2.9.1/timidity/recache.c --- TiMidity++-2.9.0/timidity/recache.c Mon Feb 7 07:57:01 2000 +++ TiMidity++-2.9.1/timidity/recache.c Mon Mar 20 15:58:27 2000 @@ -62,6 +62,70 @@ #define CACHE_RESAMPLING_NOTOK 1 #define INT32MAX 2147483647L /* (1LU<<31)-1 */ +#if defined(CSPLINE_INTERPOLATION) +# define INTERPVARS_CACHE int32 ofsd, v0, v1, v2, v3, temp; +# define RESAMPLATION_CACHE \ + v1 = (int32)src[(ofs>>FRACTION_BITS)]; \ + v2 = (int32)src[(ofs>>FRACTION_BITS)+1]; \ + if(((ofs-(1L<le)){ \ + dest[i] = (sample_t)(v1 + (((v2-v1) * (ofs & FRACTION_MASK)) >> FRACTION_BITS)); \ + }else{ \ + ofsd=ofs; \ + v0 = (int32)src[(ofs>>FRACTION_BITS)-1]; \ + v3 = (int32)src[(ofs>>FRACTION_BITS)+2]; \ + ofs &= FRACTION_MASK; \ + temp=v2; \ + v2 = (6*v2 + \ + (((((((5*v3 - 11*v2 + 7*v1 - v0)>>1)* \ + ofs)>>FRACTION_BITS)*ofs)>>(FRACTION_BITS+1))-1))*ofs; \ + ofs = (1L << FRACTION_BITS) - ofs; \ + v1 = (6*v1 + \ + (((((((5*v0 - 11*v1 + 7*temp - v3)>>1)* \ + ofs)>>FRACTION_BITS)*ofs)>>(FRACTION_BITS+1))-1))*ofs; \ + v1 = (v1 + v2)/(6L< 32767)? 32767: ((v1 < -32768)? -32768: v1); \ + ofs=ofsd; \ + } +#elif defined(LAGRANGE_INTERPOLATION) +# define INTERPVARS_CACHE int32 ofsd, v0, v1, v2, v3; +# define RESAMPLATION_CACHE \ + v1 = (int32)src[(ofs>>FRACTION_BITS)]; \ + v2 = (int32)src[(ofs>>FRACTION_BITS)+1]; \ + if(((ofs-(1L<le)){ \ + dest[i] = (sample_t)(v1 + (((v2-v1) * (ofs & FRACTION_MASK)) >> FRACTION_BITS)); \ + }else{ \ + v0 = (int32)src[(ofs>>FRACTION_BITS)-1]; \ + v3 = (int32)src[(ofs>>FRACTION_BITS)+2]; \ + ofsd = (ofs & FRACTION_MASK) + (1L << FRACTION_BITS); \ + v1 = v1*ofsd>>FRACTION_BITS; \ + v2 = v2*ofsd>>FRACTION_BITS; \ + v3 = v3*ofsd>>FRACTION_BITS; \ + ofsd -= (1L << FRACTION_BITS); \ + v0 = v0*ofsd>>FRACTION_BITS; \ + v2 = v2*ofsd>>FRACTION_BITS; \ + v3 = v3*ofsd>>FRACTION_BITS; \ + ofsd -= (1L << FRACTION_BITS); \ + v0 = v0*ofsd>>FRACTION_BITS; \ + v1 = v1*ofsd>>FRACTION_BITS; \ + v3 = v3*ofsd; \ + ofsd -= (1L << FRACTION_BITS); \ + v0 = (v3 - v0*ofsd)/(6L << FRACTION_BITS); \ + v1 = (v1 - v2)*ofsd>>(FRACTION_BITS+1); \ + v1 += v0; \ + dest[i] = (v1 > 32767)? 32767: ((v1 < -32768)? -32768: v1); \ + } +#elif defined(LINEAR_INTERPOLATION) +# define RESAMPLATION_CACHE \ + v1=src[ofs>>FRACTION_BITS];\ + v2=src[(ofs>>FRACTION_BITS)+1];\ + dest[i] = (sample_t)(v1 + (((v2-v1) * (ofs & FRACTION_MASK)) >> FRACTION_BITS)); +# define INTERPVARS_CACHE int32 v1, v2; +#else +/* Earplugs recommended for maximum listening enjoyment */ +# define RESAMPLATION_CACHE dest[i]=src[ofs>>FRACTION_BITS]; +# define INTERPVARS_CACHE +#endif + static struct { int32 on[128]; @@ -344,16 +408,15 @@ { for(i = 0; i < newlen; i++) { - int32 j, v1, v2; + int32 j; + INTERPVARS_CACHE if(ofs >= le) ofs -= ll; j = ofs>>FRACTION_BITS; v1 = src[j]; v2 = src[j + 1]; - dest[i] = (sample_t)(v1 + (((v2 - v1) * - (ofs & FRACTION_MASK)) - >> FRACTION_BITS)); + RESAMPLATION_CACHE ofs += incr; } } @@ -361,13 +424,13 @@ { for(i = 0; i < newlen; i++) { - int32 j, v1, v2; + int32 j; + INTERPVARS_CACHE + j = ofs>>FRACTION_BITS; v1 = src[j]; v2 = src[j + 1]; - dest[i] = (sample_t)(v1 + (((v2 - v1) * - (ofs & FRACTION_MASK)) - >> FRACTION_BITS)); + RESAMPLATION_CACHE ofs += incr; } } diff -ruN TiMidity++-2.9.0/timidity/resample.c TiMidity++-2.9.1/timidity/resample.c --- TiMidity++-2.9.0/timidity/resample.c Mon Feb 21 10:20:22 2000 +++ TiMidity++-2.9.1/timidity/resample.c Mon Mar 20 15:58:27 2000 @@ -58,12 +58,12 @@ ofs &= FRACTION_MASK; \ temp=v2; \ v2 = (6*v2 + \ - ((((((5*v3 - 11*v2 + 7*v1 - v0)* \ - ofs)>>FRACTION_BITS)*ofs)>>(FRACTION_BITS+2))-1))*ofs; \ + (((((((5*v3 - 11*v2 + 7*v1 - v0)>>1)* \ + ofs)>>FRACTION_BITS)*ofs)>>(FRACTION_BITS+1))-1))*ofs; \ ofs = (1L << FRACTION_BITS) - ofs; \ v1 = (6*v1 + \ - ((((((5*v0 - 11*v1 + 7*temp - v3)* \ - ofs)>>FRACTION_BITS)*ofs)>>(FRACTION_BITS+2))-1))*ofs; \ + (((((((5*v0 - 11*v1 + 7*temp - v3)>>1)* \ + ofs)>>FRACTION_BITS)*ofs)>>(FRACTION_BITS+1))-1))*ofs; \ v1 = (v1 + v2)/(6L< 32767)? 32767: ((v1 < -32768)? -32768: v1); \ ofs=ofsd; \ @@ -152,8 +152,7 @@ ofs += count; if(ofs == le) { - free_voice(v); - ctl_note_event(v); + vp->timeout = 1; *countptr = count; } vp->sample_offset = (ofs << FRACTION_BITS); @@ -207,8 +206,7 @@ if (ofs >= le) { FINALINTERP; - free_voice(v); - ctl_note_event(v); + vp->timeout = 1; *countptr-=count+1; } #else /* PRECALC_LOOPS */ @@ -219,8 +217,7 @@ if (ofs >= le) { FINALINTERP; - free_voice(v); - ctl_note_event(v); + vp->timeout = 1; *countptr-=count+1; break; } @@ -548,8 +545,7 @@ if (ofs >= le) { FINALINTERP; - free_voice(v); - ctl_note_event(v); + vp->timeout = 1; *countptr-=count+1; break; } @@ -886,8 +882,7 @@ if(*countptr >= (vp->sample->data_length>>FRACTION_BITS) - ofs) { /* Note finished. Free the voice. */ - free_voice(v); - ctl_note_event(v); + vp->timeout = 1; /* Let the caller know how much data we had left */ *countptr = (vp->sample->data_length>>FRACTION_BITS) - ofs; diff -ruN TiMidity++-2.9.0/timidity/timidity.c TiMidity++-2.9.1/timidity/timidity.c --- TiMidity++-2.9.0/timidity/timidity.c Fri Feb 18 10:19:50 2000 +++ TiMidity++-2.9.1/timidity/timidity.c Mon Mar 20 15:48:24 2000 @@ -83,7 +83,7 @@ #include "w32g_utl.h" #endif -#define OPTCOMMANDS "4A:aB:b:C:c:D:d:E:eFfg:hI:i:jk:L:M:m:n:O:o:P:p:Q:q:R:rS:s:t:UW:w:x:Z:" +#define OPTCOMMANDS "4A:aB:b:C:c:D:d:E:eFfg:hI:i:jk:L:M:m:n:O:o:P:p:Q:q:R:rS:s:t:T:UW:w:x:Z:" #define INTERACTIVE_INTERFACE_IDS "kmqagrw" /* main interfaces (To be used another main) */ @@ -429,11 +429,13 @@ " (UNIX only)", " ascii : Convert unreadable characters to '.'(0x2e)", " nocnv : No conversion", +" 1251 : Convert from windows-1251 to koi8-r", #ifdef JAPANESE " euc : EUC-japan", " jis : JIS", " sjis : shift JIS", #endif /* JAPANESE */ +" -T n Adjust tempo to n%%; 120=play MOD files with an NTSC Amiga's timing", " -U Unload instruments from memory between MIDI files", " -W mode Select WRD interface (see below for list)", #ifdef __W32__ @@ -2629,9 +2631,14 @@ case 'R': tmpi32 = atoi(optarg); - if(set_value(&modify_release, tmpi32, 0, MAX_MREL, "Modify Release")) - return 1; - if (modify_release==0) modify_release=DEFAULT_MREL; + if(tmpi32 == -1) { + /* reset */ + modify_release = 0; + } else { + if(set_value(&modify_release, tmpi32, 0, MAX_MREL, "Modify Release")) + return 1; + if (modify_release==0) modify_release=DEFAULT_MREL; + } break; case 'r': @@ -2664,6 +2671,13 @@ free(output_text_code); output_text_code = safe_strdup(optarg); break; + + case 'T': + tmpi32 = atoi(optarg); + if(set_value(&tmpi32, tmpi32, 10, 400, "Tempo adjust")) + return 1; + tempo_adjust = 100.0 / tmpi32; + break; case 'U': free_instruments_afterwards = 1; diff -ruN TiMidity++-2.9.0/timidity/wrdt.c TiMidity++-2.9.1/timidity/wrdt.c --- TiMidity++-2.9.0/timidity/wrdt.c Mon Feb 7 07:55:13 2000 +++ TiMidity++-2.9.1/timidity/wrdt.c Mon Mar 20 16:20:56 2000 @@ -36,6 +36,7 @@ #include "playmidi.h" #include "readmidi.h" #include "arc.h" +#include "interface.h" /* * Remap WRD @COLOR(16)-@COLOR(23) to RGB plain number. @@ -97,7 +98,7 @@ extern WRDTracer x_wrdt_mode; #endif /* WRDT_X */ -#if defined(__W32__) +#if defined(__W32__) && !defined(IA_W32GUI) extern WRDTracer wcon_wrdt_mode; /* wrdt_wcon.c */ #endif /* __W32__ */ @@ -106,7 +107,7 @@ #ifdef WRDT_X &x_wrdt_mode, #endif /* WRDT_X */ -#ifdef __W32__ +#if defined(__W32__) && !defined(IA_W32GUI) &wcon_wrdt_mode, #endif /* __W32__ */ #ifndef __MACOS__