Ticket #7919: rawmidi2.patch

File rawmidi2.patch, 3.9 KB (added by SF/chuzwuzza, 18 years ago)

updated rawmidi patch

  • Makefile

    Common subdirectories: scummvm.orig/CVS and scummvm.new/CVS
    diff -u scummvm.orig/Makefile scummvm.new/Makefile
    old new  
    22
    33CC      = gcc
    44CFLAGS  = -g -Wno-multichar
     5
     6#Replace -DUSE_TIMIDITY with -DUSE_RAWMIDI for music on a raw midi device
     7#in unix
     8#
    59DEFINES = -DUNIX -DHAVE_READLINE -DUSE_TIMIDITY
     10
    611LDFLAGS :=
    712INCLUDES:= `sdl-config --cflags`
    813CPPFLAGS= $(DEFINES) $(INCLUDES)
  • imuse.cpp

    diff -u scummvm.orig/imuse.cpp scummvm.new/imuse.cpp
    old new  
    24712471
    24722472#define MIDI_OUT(a,b) midiOutShortMsg((HMIDIOUT)(a), (b))
    24732473
     2474#elif defined(USE_RAWMIDI)
     2475static 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
     2496void SoundEngine::midiInit()
     2497{
     2498        int device;
     2499        device = open_rawmidi_device();
     2500        _mo = (void *) device;
     2501}
     2502
     2503static 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
    24742530#elif defined(USE_TIMIDITY)
    24752531
    24762532static int connect_to_timidity(int port)
  • readme.txt

    diff -u scummvm.orig/readme.txt scummvm.new/readme.txt
    old new  
    2020
    2121GCC:
    2222----
     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
    2324* Type make (or gmake if that's what GNU make is called on your system) and
    2425hopefully ScummVM will compile for you.
    2526
     
    4243Ctrl-s shows memory consumption.
    4344
    4445
    45 Playing sound with Timidity:
     46Playing music in Unix with a raw midi device (/dev/midi):
     47----------------------------------------------------------
     48Edit 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).
     49Compile scummvm by typing "make" (or possibly "gmake" depending on your system configuration)
     50Before 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
     54Then you can run scummvm, and hopefully you will hear music out your midi device
     55
     56
     57Playing music in Unix with Timidity:
    4658----------------------------
     59Edit 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)
     60Compile scummvm by typing "make" (or possibly "gmake" depending on youru system configuration)
    4761Start Timidity with the following command line :
    4862
    4963$ timidity -irv 7777
     
    5367
    5468Good Luck,
    5569Ludvig Strigeus
    56 
    57 
    58 
    59 
    60 
    61 
    62 
    63 
    64 
    65 
    66