From: Keishi Suenaga Date: Sat, 5 Apr 2008 21:30:29 +0000 (+0000) Subject: * timidity/common.c X-Git-Tag: unkotim211~146 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=5b9e86bee638ae107957bf00d962cda937791850;p=timidity41%2Ftimidity41.git * timidity/common.c timidity/speex_a.c fix compliation * timidity/midi_a.c BorlancC patch --- diff --git a/ChangeLog b/ChangeLog index c2aac36f..fce4a823 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-04-06 Keishi Suenaga + * timidity/common.c + timidity/speex_a.c fix compliation + * timidity/midi_a.c BorlancC patch + 2008-04-05 TAMUKI Shoichi * timidity/timidity.c: Remove short option -Od(n) for output diff --git a/configure b/configure index a1c0c73e..b1d83e0d 100755 --- a/configure +++ b/configure @@ -15448,7 +15448,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include #include int diff --git a/configure.in b/configure.in index 729058d2..d8faa123 100644 --- a/configure.in +++ b/configure.in @@ -1406,7 +1406,7 @@ AC_MSG_CHECKING(enable_audio=speex) if test "x$au_enable_speex" = xyes; then AC_CACHE_VAL(have_speex, [AC_TRY_LINK([ - #include + #include #include ], [ diff --git a/timidity/common.c b/timidity/common.c index a212209f..76b13aa8 100644 --- a/timidity/common.c +++ b/timidity/common.c @@ -1093,16 +1093,6 @@ void code_convert(char *in, char *out, int outsiz, char *icode, char *ocode) #endif } -static int is_playlist(char *file) -{ - FILE *f; char sig[20], *ret; - if ((f = fopen(file, "r")) == NULL) return 0; - ret = fgets(sig, 20, f); - fclose(f); - if ((!ret) || (strcmp(sig, "timidity playlist:\n"))) return 0; - return 1; -} - /* EAW -- insert stuff from playlist files * * Tue Apr 6 1999: Modified by Masanao Izumo @@ -1148,7 +1138,7 @@ static char **expand_file_lists(char **files, int *nfiles_in_out) /* extract the file extension */ pfile = strrchr(files[i], '.'); - if(*files[i] == '@' || (pfile != NULL && strstr(testext, pfile)) || is_playlist(files[i])) + if(*files[i] == '@' || (pfile != NULL && strstr(testext, pfile))) { /* Playlist file */ if(*files[i] == '@') diff --git a/timidity/midi_a.c b/timidity/midi_a.c index 2458f084..9d284cad 100644 --- a/timidity/midi_a.c +++ b/timidity/midi_a.c @@ -109,11 +109,25 @@ PlayMode dmp = { }; static size_t m_fwrite(const void *ptr, size_t size); -#define M_FWRITE(...) do { \ - uint8_t __arg[] = { __VA_ARGS__ }; \ - m_fwrite(__arg, sizeof(__arg)); \ -} while (0) #define M_FWRITE_STR(s) m_fwrite(s, sizeof(s) - 1) +#define M_FWRITE1(a) do { \ + uint8 __arg[1]; \ + __arg[0] = a; \ + m_fwrite(__arg, 1); \ +} while (0) +#define M_FWRITE2(a, b) do { \ + uint8 __arg[2]; \ + __arg[0] = a; \ + __arg[1] = b; \ + m_fwrite(__arg, 2); \ +} while (0) +#define M_FWRITE3(a, b, c) do { \ + uint8 __arg[3]; \ + __arg[0] = a; \ + __arg[1] = b; \ + __arg[2] = c; \ + m_fwrite(__arg, 3); \ +} while (0) static size_t m_fwrite(const void *ptr, size_t size) { @@ -164,7 +178,7 @@ static void finalize_midi_header(void) static void set_tempo(void) { M_FWRITE_STR("\xff\x51\3"); - M_FWRITE(tempo >> 16, tempo >> 8, tempo); + M_FWRITE3(tempo >> 16, tempo >> 8, tempo); } static void set_time_sig(void) @@ -205,10 +219,10 @@ static void midout_write_delta_time(int32 time) for (idx = 0; idx < 3; idx++) { if (started_printing || c[idx]) { started_printing = 1; - M_FWRITE(c[idx] | 0x80); + M_FWRITE1(c[idx] | 0x80); } } - M_FWRITE(c[3]); + M_FWRITE1(c[3]); } static void start_midi_track(void) @@ -288,43 +302,43 @@ static void close_output(void) static void midout_noteon(int chn, int note, int vel, int32 time) { midout_write_delta_time(time); - M_FWRITE((chn & 0x0f) | MIDI_NOTEON, note & 0x7f, vel & 0x7f); + M_FWRITE3((chn & 0x0f) | MIDI_NOTEON, note & 0x7f, vel & 0x7f); } static void midout_noteoff(int chn, int note, int vel, int32 time) { midout_write_delta_time(time); - M_FWRITE((chn & 0x0f) | MIDI_NOTEOFF, note & 0x7f, vel & 0x7f); + M_FWRITE3((chn & 0x0f) | MIDI_NOTEOFF, note & 0x7f, vel & 0x7f); } static void midout_control(int chn, int control, int value, int32 time) { midout_write_delta_time(time); - M_FWRITE((chn & 0x0f) | MIDI_CTL_CHANGE, control & 0x7f, value & 0x7f); + M_FWRITE3((chn & 0x0f) | MIDI_CTL_CHANGE, control & 0x7f, value & 0x7f); } static void midout_keypressure(int chn, int control, int value, int32 time) { midout_write_delta_time(time); - M_FWRITE((chn & 0x0f) | MIDI_KEY_PRESSURE, control & 0x7f, value & 0x7f); + M_FWRITE3((chn & 0x0f) | MIDI_KEY_PRESSURE, control & 0x7f, value & 0x7f); } static void midout_channelpressure(int chn, int vel, int32 time) { midout_write_delta_time(time); - M_FWRITE((chn & 0x0f) | MIDI_CHN_PRESSURE, vel & 0x7f); + M_FWRITE2((chn & 0x0f) | MIDI_CHN_PRESSURE, vel & 0x7f); } static void midout_bender(int chn, int pitch, int32 time) { midout_write_delta_time(time); - M_FWRITE((chn & 0x0f) | MIDI_PITCH_BEND, pitch & 0x7f, (pitch >> 7) & 0x7f); + M_FWRITE3((chn & 0x0f) | MIDI_PITCH_BEND, pitch & 0x7f, (pitch >> 7) & 0x7f); } static void midout_program(int chn, int pgm, int32 time) { midout_write_delta_time(time); - M_FWRITE((chn & 0x0f) | MIDI_PGM_CHANGE, pgm & 0x7f); + M_FWRITE2((chn & 0x0f) | MIDI_PGM_CHANGE, pgm & 0x7f); } static void midout_tempo(int chn, int a, int b, int32 time) @@ -355,7 +369,7 @@ static void midout_timesig(int chn, int a, int b, int32 time) midout_write_delta_time(time); M_FWRITE_STR("\xff\x58\4"); } - M_FWRITE(a, b); + M_FWRITE2(a, b); } static int do_event(MidiEvent * ev) diff --git a/timidity/speex_a.c b/timidity/speex_a.c index 0a672cea..0dbe480e 100644 --- a/timidity/speex_a.c +++ b/timidity/speex_a.c @@ -26,6 +26,7 @@ #include "config.h" #endif /* HAVE_CONFIG_H */ #include +#include #if HAVE_UNISTD_H #include #endif @@ -33,11 +34,13 @@ #include #endif -#include -#include +#include +#include +#include #include #include "timidity.h" +#include "common.h" #include "output.h" #include "controls.h" #include "timer.h"