Ticket #7919: rawmidi2.patch
File rawmidi2.patch, 3.9 KB (added by , 23 years ago) |
---|
-
Makefile
Common subdirectories: scummvm.orig/CVS and scummvm.new/CVS diff -u scummvm.orig/Makefile scummvm.new/Makefile
old new 2 2 3 3 CC = gcc 4 4 CFLAGS = -g -Wno-multichar 5 6 #Replace -DUSE_TIMIDITY with -DUSE_RAWMIDI for music on a raw midi device 7 #in unix 8 # 5 9 DEFINES = -DUNIX -DHAVE_READLINE -DUSE_TIMIDITY 10 6 11 LDFLAGS := 7 12 INCLUDES:= `sdl-config --cflags` 8 13 CPPFLAGS= $(DEFINES) $(INCLUDES) -
imuse.cpp
diff -u scummvm.orig/imuse.cpp scummvm.new/imuse.cpp
old new 2471 2471 2472 2472 #define MIDI_OUT(a,b) midiOutShortMsg((HMIDIOUT)(a), (b)) 2473 2473 2474 #elif defined(USE_RAWMIDI) 2475 static int open_rawmidi_device() 2476 { 2477 int device; 2478 char *device_name = getenv("SCUMMVM_MIDI"); 2479 if (device_name != NULL) { 2480 device = (open((device_name), O_RDWR, 0)); 2481 } else { 2482 warning("You need to set-up the SCUMMVM_MIDI environment variable properly (see readme.txt) "); 2483 } 2484 if ((device_name == NULL) || (device < 0)) { 2485 if (device_name == NULL) 2486 warning("Opening /dev/null (no music will be heard) "); 2487 else 2488 warning("Cannot open rawmidi device %s - using /dev/null (no music will be heard) ", device_name); 2489 device = (open(("/dev/null"), O_RDWR, 0)); 2490 if (device < 0) 2491 error("Cannot open /dev/null to dump midi output"); 2492 } 2493 return device; 2494 } 2495 2496 void SoundEngine::midiInit() 2497 { 2498 int device; 2499 device = open_rawmidi_device(); 2500 _mo = (void *) device; 2501 } 2502 2503 static inline void MIDI_OUT(void *a, int b) { 2504 int device = (int) a; 2505 unsigned char buf[256]; 2506 int position = 0; 2507 2508 switch (b & 0xF0) { 2509 case 0x80: 2510 case 0x90: 2511 case 0xA0: 2512 case 0xB0: 2513 case 0xE0: 2514 buf[position++] = b; 2515 buf[position++] = (b >> 8) & 0x7F; 2516 buf[position++] = (b >> 16) & 0x7F; 2517 break; 2518 case 0xC0: 2519 case 0xD0: 2520 buf[position++] = b; 2521 buf[position++] = (b >> 8) & 0x7F; 2522 break; 2523 default: 2524 fprintf(stderr, "Unknown : %08x\n", b); 2525 break; 2526 } 2527 write(device, buf, position); 2528 } 2529 2474 2530 #elif defined(USE_TIMIDITY) 2475 2531 2476 2532 static int connect_to_timidity(int port) -
readme.txt
diff -u scummvm.orig/readme.txt scummvm.new/readme.txt
old new 20 20 21 21 GCC: 22 22 ---- 23 * If you need to, to change music settings, edit the file 'Makefile' as per the instructions for either raw midi output or timidity output later in this readme 23 24 * Type make (or gmake if that's what GNU make is called on your system) and 24 25 hopefully ScummVM will compile for you. 25 26 … … 42 43 Ctrl-s shows memory consumption. 43 44 44 45 45 Playing sound with Timidity: 46 Playing music in Unix with a raw midi device (/dev/midi): 47 ---------------------------------------------------------- 48 Edit the Makefile and make sure on the line "DEFINES", there is -DUSE_RAWMIDI listed. If there is -DUSE_TIMIDITY, replace it (unless you want to use timidity for music -- i.e. your soundcard does not have a working midi device). 49 Compile scummvm by typing "make" (or possibly "gmake" depending on your system configuration) 50 Before you run scummvm, make sure you have the environment variable SCUMMVM_MIDI set to your midi device (usually /dev/midi). In bash, this is done as follows 51 52 $ SCUMMVM_MIDI="/dev/midi" && export SCUMMVM_MIDI 53 54 Then you can run scummvm, and hopefully you will hear music out your midi device 55 56 57 Playing music in Unix with Timidity: 46 58 ---------------------------- 59 Edit the Makefile and make sure on the line "DEFINES" there is -DUSE_TIMIDITY listed. If there is -DUSE_RAWMIDI, replace it (unless you want to use a raw midi device for music) 60 Compile scummvm by typing "make" (or possibly "gmake" depending on youru system configuration) 47 61 Start Timidity with the following command line : 48 62 49 63 $ timidity -irv 7777 … … 53 67 54 68 Good Luck, 55 69 Ludvig Strigeus 56 57 58 59 60 61 62 63 64 65 66