#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 <mo@goice.co.jp>
/* 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] == '@')
};
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)
{
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)
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)
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)
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)