Ticket #7919: rawmidi.patch

File rawmidi.patch, 3.6 KB (added by SF/chuzwuzza, 22 years ago)

rawmidi patch

  • Makefile

    Common subdirectories: scummvm/CVS and scummvm.new/CVS
    diff -u scummvm/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/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        device = (open((getenv("SCUMMVM_MIDI")), O_RDWR, 0));
     2479        if (device < 0){
     2480                printf("Cannot open rawmidi device - using /dev/null (no music will be heard)\n");
     2481                device = (open(("/dev/null"), O_RDWR, 0));
     2482                if (device < 0)
     2483                        error("Cannot open /dev/null to dump midi output");
     2484        }
     2485        return device;
     2486}
     2487
     2488void SoundEngine::midiInit()
     2489{
     2490        int device;
     2491        device = open_rawmidi_device();
     2492        _mo = (void *) device;
     2493}
     2494
     2495static inline void MIDI_OUT(void *a, int b) {
     2496        int device = (int) a;
     2497        unsigned char buf[256];
     2498        int position = 0;
     2499       
     2500        switch (b & 0xF0) {
     2501        case 0x80:
     2502        case 0x90:
     2503        case 0xA0:
     2504        case 0xB0:
     2505        case 0xE0:
     2506                buf[position++] = b;
     2507                buf[position++] = (b >> 8) & 0x7F;
     2508                buf[position++] = (b >> 16) & 0x7F;
     2509                break;
     2510        case 0xC0:
     2511        case 0xD0:
     2512                buf[position++] = b;
     2513                buf[position++] = (b >> 8) & 0x7F;
     2514                break;
     2515        default:
     2516                fprintf(stderr, "Unknown : %08x\n", b);
     2517                break;
     2518        }
     2519        write(device, buf, position);
     2520}
     2521
    24742522#elif defined(USE_TIMIDITY)
    24752523
    24762524static int connect_to_timidity(int port)
  • readme.txt

    diff -u scummvm/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