timidity for zandronum patch file (CR CF) Apply for https://github.com/starg2/timidity41/tree/tim41.7.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -U 3 ./timidity/playmidi.c ./timidity/playmidi.c | |
--- ./timidity/playmidi.c Wed Apr 6 01:33:29 2022 | |
+++ ./timidity/playmidi.c Fri Apr 8 15:14:20 2022 | |
@@ -82,6 +82,10 @@ | |
int usleep(unsigned int useconds); | |
#endif | |
+#ifdef __W32__ | |
+extern HANDLE KillerEvent; /* [RH] */ | |
+#endif | |
+ | |
#ifdef SUPPORT_SOUNDSPEC | |
#include "soundspec.h" | |
#endif /* SUPPORT_SOUNDSPEC */ | |
@@ -12600,6 +12604,15 @@ | |
int32 i, j, cet; | |
int k, l, ch, orig_ch, port_ch, offset, layered; | |
+ | |
+#ifdef __W32__ | |
+ /* [RH] */ | |
+ if(KillerEvent != NULL) | |
+ { | |
+ if(WaitForSingleObject(KillerEvent, 0) == WAIT_OBJECT_0) | |
+ return RC_QUIT; | |
+ } | |
+#endif | |
if(play_mode->flag & PF_MIDI_EVENT) | |
return play_mode->acntl(PM_REQ_MIDI, ev); | |
diff -U 3 ./timidity/readmidi.c ./timidity/readmidi.c | |
--- ./timidity/readmidi.c Wed Apr 6 01:33:29 2022 | |
+++ ./timidity/readmidi.c Fri Apr 8 15:14:20 2022 | |
@@ -7351,6 +7351,7 @@ | |
_set_errno(0); | |
+#ifndef NO_MODULES | |
if((mtype = get_module_type(fn)) > 0) | |
{ | |
readmidi_read_init(); | |
@@ -7370,6 +7371,7 @@ | |
url_rewind(tf->url); | |
url_cache_disable(tf->url); | |
} | |
+#endif | |
#if MAX_CHANNELS > 16 | |
for(i = 16; i < MAX_CHANNELS; i++) | |
@@ -7854,11 +7856,13 @@ | |
return p->format; | |
p = get_midi_file_info(filename, 1); | |
+#ifndef NO_MODULES | |
if(get_module_type(filename) > 0) | |
{ | |
p->format = 0; | |
return 0; | |
} | |
+#endif | |
tf = open_file(filename, 1, OF_SILENT); | |
if(tf == NULL) | |
@@ -7998,6 +8002,7 @@ | |
if(tf == NULL) | |
return NULL; | |
+#ifndef NO_MODULES | |
mtype = get_module_type(filename); | |
check_cache = check_need_cache(tf->url, filename); | |
if(check_cache || mtype > 0) | |
@@ -8036,6 +8041,7 @@ | |
safe_free (title); | |
goto end_of_parse; | |
} | |
+#endif | |
/* Parse MIDI header */ | |
if(tf_read(tmp, 1, 4, tf) != 4) | |
diff -U 3 ./timidity/timidity.c ./timidity/timidity.c | |
--- ./timidity/timidity.c Wed Apr 6 01:33:29 2022 | |
+++ ./timidity/timidity.c Fri Apr 8 15:14:20 2022 | |
@@ -96,7 +96,9 @@ | |
#include "mid.defs" | |
#include "aq.h" | |
#include "mix.h" | |
+#ifndef NO_MODULES | |
#include "unimod.h" | |
+#endif | |
#include "quantity.h" | |
#include "rtsyn.h" | |
#include "sndfontini.h" | |
@@ -977,6 +979,8 @@ | |
intr++; | |
return TRUE; | |
} | |
+HANDLE KillerEvent; /* [RH] */ | |
+static const char KillerEventName[] = "TiMidity Killer"; | |
#endif /* __W32__ */ | |
int effect_lr_mode = -1; | |
@@ -8516,8 +8520,10 @@ | |
init_midi_trace(); | |
int_rand(-1); /* initialize random seed */ | |
int_rand(42); /* the 1st number generated is not very random */ | |
+#ifndef NO_MODULES | |
ML_RegisterAllLoaders (); | |
- } | |
+#endif | |
+ } | |
is_first = 0; | |
} | |
@@ -9143,6 +9149,18 @@ | |
printf("TiMidity++ start\n"); | |
fflush(stdout); | |
#endif | |
+ | |
+#if defined(__W32__) | |
+ /* [RH] Make sure stdout and stdin are using binary output. */ | |
+ _setmode(_fileno(stdout), _O_BINARY); | |
+ _setmode(_fileno(stdin), _O_BINARY); | |
+ | |
+ /* [RH] If the specified named event can be found, signalling | |
+ * it will cause Timidity to quit. | |
+ */ | |
+ KillerEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, KillerEventName); | |
+#endif | |
+ | |
///r | |
#ifdef __W32__ | |
#if defined(IA_W32GUI) && !defined(WIN32GCC) || defined(IA_W32G_SYN) | |
diff -U 3 ./timidity/mod.h ./timidity/mod.h | |
--- ./timidity/mod.h Wed Apr 6 01:33:01 2022 | |
+++ ./timidity/mod.h Fri Apr 8 15:14:20 2022 | |
@@ -21,10 +21,14 @@ | |
#ifndef ___MOD_H_ | |
#define ___MOD_H_ | |
+#ifndef NO_MODULES | |
+ | |
#define MOD_NUM_VOICES MAX_CHANNELS | |
extern int get_module_type (char *fn); | |
extern int load_module_file (struct timidity_file *tf, int mod_type); | |
extern char *get_module_title (struct timidity_file *tf, int mod_type); | |
+ | |
+#endif /* NOMODULES */ | |
#endif /* ___MOD_H_ */ | |
diff -U 3 ./timidity/mod2midi.c ./timidity/mod2midi.c | |
--- ./timidity/mod2midi.c Wed Apr 6 01:33:01 2022 | |
+++ ./timidity/mod2midi.c Fri Apr 8 15:14:20 2022 | |
@@ -25,6 +25,9 @@ | |
#ifdef HAVE_CONFIG_H | |
#include "config.h" | |
#endif /* HAVE_CONFIG_H */ | |
+ | |
+#ifndef NO_MODULES | |
+ | |
#ifndef NO_STRING_H | |
#include <string.h> | |
#else | |
@@ -758,3 +761,5 @@ | |
s->id = i; | |
} | |
} | |
+ | |
+#endif /* NO_MODULES */ | |
diff -U 3 ./timidity/mod2midi.h ./timidity/mod2midi.h | |
--- ./timidity/mod2midi.h Wed Apr 6 01:33:01 2022 | |
+++ ./timidity/mod2midi.h Fri Apr 8 15:14:20 2022 | |
@@ -23,6 +23,8 @@ | |
*/ | |
+#ifndef NO_MODULES | |
+ | |
#include "unimod.h" | |
void Voice_SetVolume (UBYTE, UWORD); | |
@@ -37,3 +39,5 @@ | |
void Voice_EndPlaying (); | |
void load_module_samples (SAMPLE *, int, int); | |
void Voice_SetPeriod (UBYTE v, ULONG period); | |
+ | |
+#endif /* NO_MODULES */ | |
diff -U 3 ./timidity/mod.c ./timidity/mod.c | |
--- ./timidity/mod.c Wed Apr 6 01:33:01 2022 | |
+++ ./timidity/mod.c Fri Apr 8 15:14:20 2022 | |
@@ -28,6 +28,8 @@ | |
#include "config.h" | |
#endif /* HAVE_CONFIG_H */ | |
+#ifndef NO_MODULES | |
+ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
@@ -3069,3 +3071,5 @@ | |
free (mp.control); | |
return 0; | |
} | |
+ | |
+#endif /* NO_MODULES */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment