Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MIDI Sysex Programming Question...

Posted on 2001-09-05
7
Medium Priority
?
1,000 Views
Last Modified: 2013-12-03
I am trying to write a Windows program to communicate with a MIDI device that is connected to my PC.  However, I can't seem to get my program talking to the device.  I am new to MIDI programming and I haven't been able to find a good example.  

For now, I just want to send a Sysex message to the MIDI device and get a response back.  I have been trying this using these functions:

midiOutGetNumDevs()
midiOutGetDevCaps()
midiOutOpen()
midiInOpen()
midiInStart()

but I haven't really gotten anywhere.  Note I don't want to receive any midi audio from the device - I just want to send a request message to it and get a response.  For now, I would prefer to use CALLBACK functions.

I believe the following is what I need to send to the device:

F0 7E <chan> 06 01 F7 System inquiry message

<chan> can be 7F (all devices) and the device documentation says it will respond.  I have more sysex information on the device, but I am not sure if that is needed to solve this question.  If so, let me know and I will post as much as needed.

I *believe* that I should be using midi output device 2 and midi input device 0.
0
Comment
Question by:TomMahieu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6457903
have you looked at the MIDImon sample in the msdn ?
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 900 total points
ID: 6458009
0
 

Author Comment

by:TomMahieu
ID: 6458797
I've taken a look at the MIDImon sample, but I haven't been able to successfully extract what I am trying to do.  I was looking for someone to point me in the right direction with a code snippet of "here is what you have to do" and leave out all of the things that are not necessary.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:TomMahieu
ID: 6459402
OK, if this helps, here is basically what I am currently doing that does not work.  Anybody see what is wrong?  Everything?  ;)

void CALLBACK MidiOutProc(HMIDIOUT hmo,      
                          UINT wMsg,        
                          DWORD dwInstance,  
                          DWORD dwParam1,    
                          DWORD dwParam2)
{
    DWORD temp = dwParam1;
}
 

void CALLBACK MidiInProc(HMIDIIN hMidiIn,  
                         UINT wMsg,        
                         DWORD dwInstance,
                         DWORD dwParam1,  
                         DWORD dwParam2)
{
    DWORD temp = dwParam1;
}


void OutputSystemExclusiveMessage(void)
{
    HMIDIOUT    outHandle;
    HMIDIIN     inHandle;
    MIDIHDR     midiHdr;
    UINT        err;
    char          sysEx[] = {0xF0, 0x7E, 0x01, 0x06, 0x01, 0x07};

    DWORD outRetVal = 0;
    DWORD inRetVal = 0;
    DWORD inStartRetVal = 0;

    outRetVal = midiOutOpen(&outHandle, 2, (DWORD)MidiOutProc, 23, CALLBACK_FUNCTION);
    inRetVal = midiInOpen(&inHandle, 0, (DWORD)MidiInProc, 34, CALLBACK_FUNCTION);

    if ((MMSYSERR_NOERROR != inRetVal) || (MMSYSERR_NOERROR != outRetVal))
    {
        cout << "ERROR!" << endl;
    }
    else
    {
        inStartRetVal = midiInStart(inHandle);
    }

    if (MMSYSERR_NOERROR == inStartRetVal)
    {
        midiHdr.lpData = (char *)&sysEx[0];
        midiHdr.dwBufferLength = sizeof(sysEx);
        midiHdr.dwBytesRecorded  = sizeof(sysEx);
        midiHdr.dwFlags = 0;

        err = midiOutPrepareHeader(outHandle,  &midiHdr, sizeof(MIDIHDR));
        if (!err)
        {
            err = midiOutLongMsg(outHandle, &midiHdr, sizeof(MIDIHDR));
            if (err)
            {
                char   errMsg[120];

                midiOutGetErrorText(err, &errMsg[0], 120);
                printf("Error: %s\r\n", &errMsg[0]);
            }

            while (MIDIERR_STILLPLAYING == midiOutUnprepareHeader(outHandle, &midiHdr, sizeof(MIDIHDR)))
            {              
            }
        }

        midiOutClose(outHandle);

    }
}
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6466274
In next article
http://www.salleurl.edu/~si04990/documents/lowmidi.htm
I see working code ~ same as your's. Check out differences
and you 'll easy find problems.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6845757
Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20178896.html
http://www.experts-exchange.com/questions/Q.20180095.html




PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6851599
Thanks for returning and finalizing your question.  Anytime you choose to grade less than an A, please comment as to why.  This helps all involved, including others who may visit this question at a later time for help.  Some experts look at grading history before deciding to help someone, so that also may have an impact to you and how quickly your future questions are answered.

The points to you are always the same, but the points granted the expert depend upon the grade.  Using 100 points as an example.  100 at A = 400 ... 100 at B = 300 .... 100 at C = 200, so it also has a point impact to the experts.  

If the grade chosen was in error, let me know, and I can correct this.

EE Moderator
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question