• Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 502 from 2013/5/29
    Hello again!

    I have a few free days to play with MorphOS and try to resolve this mistery.
    What I have done is to compile this source (with different Midi port of course) in my 1200 and Damn! It works ok in classic but same source compile in MorphOS but it doesnt send any sysexmsg to my device.

    Code:

    #include <proto/camd.h>
    #include <proto/dos.h>
    #include <proto/exec.h>
    #include <stdlib.h>


    //USB2.0-MIDI.in
    //USB2.0-MIDI.out

    void cleanout(char *); // Exit

    struct Library *CamdBase = NULL;

    struct MidiNode *ournode = NULL;
    struct MidiLink *outLink = NULL;
    BYTE midisig = -1;

    int main(int argc, char **argv)
    {
    //MidiMsg midimsg;
    ULONG signal;
    BOOL alive = TRUE;

    CamdBase = OpenLibrary((CONST_STRPTR)"camd.library", 36L);
    if(NULL == CamdBase) cleanout("Can't open camd.library");

    midisig = AllocSignal(-1);
    if(midisig == -1) cleanout("Cant get a signal");

    // MIDI Node
    struct TagItem MidiItems[] =
    {
    MIDI_Name, (LONG)"Our MIDI Node",
    MIDI_MsgQueue, 6048L,
    MIDI_SysExSize, 10000L,
    MIDI_RecvSignal, midisig,
    TAG_DONE
    };

    ournode = CreateMidiA(&MidiItems[0]);
    if(!ournode) cleanout("Can't Create MidiNode");

    // MIDI Link
    struct TagItem MidiLinkTags[] =
    {
    MLINK_Location, (LONG)"USB2.0-MIDI.out",
    TAG_DONE
    };

    outLink = AddMidiLinkA(ournode, MLTYPE_Sender, &MidiLinkTags[0]);
    if(!outLink) cleanout("Can't Add Output Link");

    //SendSysEx
    //UBYTE reset[] = {0xf0, 0x7d, 0x00, 0xf7};
    Printf("Send SysEx msgn");
    //Special SysEx to MIDI device
    UBYTE reset[] = {0xf0, 0x7d, 0x03, 0x01, 0xf7};

    PutSysEx(outLink, reset);

    // Wait loop
    while(alive)
    { // Wait (Ctrl-C)

    signal = Wait(SIGBREAKF_CTRL_C | 1L << midisig);

    if(signal & SIGBREAKF_CTRL_C)
    alive = FALSE;
    }

    Printf("Closing MIDI Link ....n");

    cleanout(NULL);
    return (0);
    }

    void cleanout(char *txt)
    {
    if(txt)
    {
    Printf("%sn",txt);
    }

    if (outLink) RemoveMidiLink(outLink);
    if (ournode) DeleteMidi(ournode);
    if (midisig != -1) FreeSignal(midisig);
    if (CamdBase) CloseLibrary(CamdBase);

    if(txt) exit(-1);
    }


    Can anyone provide me a working example for sending SysEx messages?

    Thanks in advance mates!
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »28.12.20 - 12:02
    Profile