I'm not really a PortMIDI veteran, but I did end up writing some test code
before using it in one of my programs. The guts of my "listen" loop look
something like this: (assuming an input port has been successfully opened)
PmEvent buffer[INPUT_POLL_SIZE];
PmError status, length;
status = Pm_Poll(input_stream); //non-blocking
if (status == TRUE)
{
length = Pm_Read(input_stream,buffer, INPUT_POLL_SIZE);
printf("parsing %d event(s)\n",length);
for(int i=0;i<length;++i)
{
//for my keyboard, the status field is
//0x90-0x9F for note on events, and
//0x80-0x8F for note off events.
printf("time %ld, %2lx %2lx %2lx\n",
buffer[i].timestamp,
Pm_MessageStatus(buffer[i].message),
Pm_MessageData1(buffer[i].message),
Pm_MessageData2(buffer[i].message));
}
}
I've never tried reading sysex data so I'm afraid I'm useless on that part
of your question.
Steve
On Tue, Nov 23, 2010 at 7:55 AM, Tim Burgess <[email protected]> wrote:
> Hi,
>
> I'm modifying a win32 application that handles MIDI I/O. Has anybody got
> any sample code to demonstrate reading short MIDI and sysex messages from
> an
> input port using PortMIDI, please?
>
> Best wishes.
>
> Tim Burgess
> Raised Bar Ltd
> Phone: +44 (0)1827 719822
>
> Don't forget to vote for improved access to music and music technology at
>
> http://www.raisedbar.net/petition.htm
>
>
>
> _______________________________________________
> media_api mailing list
> [email protected]
> http://lists.create.ucsb.edu/mailman/listinfo/media_api
>
_______________________________________________
media_api mailing list
[email protected]
http://lists.create.ucsb.edu/mailman/listinfo/media_api