[Media_api] portMIDI question..[Scanned]
Keir, Paul
P.Keir at gsa.ac.uk
Tue May 23 17:14:05 PDT 2006
I'm not sure about your probelm, but I outlined a basic example in a pervious list message: http://www.create.ucsb.edu/pipermail/media_api/2005-October/000425.html I hope it's useful.
Paul
-----Original Message-----
From: media_api-bounces at create.ucsb.edu
[mailto:media_api-bounces at create.ucsb.edu]On Behalf Of Rory Walsh
Sent: 23 May 2006 16:08
To: media_api at create.ucsb.edu
Subject: [Media_api] portMIDI question..[Scanned]
Hi everyone. I have been messing around with PortMIDI for the last few
days and apart from mostly guessing how it works I have been able to get
some nice results. I am currently trying to learn to set up a separate
thread using Pt_Start(). Here's what I got, which as you can probably
tell doesn't work!
int main(int argc, char *argv[])
{
Pm_Initialize();
int device = 0;//microsoft midi mapper...
Pm_OpenOutput(&midi,device,NULL,0,NULL,NULL,10);
Pt_Start(1000, &process_midi, 0);
cin.get();//hold program
Pm_Close(midi);
Pm_Terminate();
}
void process_midi(PtTimestamp timestamp, void *userData)
{
buffer[0].timestamp = 0;
buffer[0].message = Pm_Message(0x90, 60, 100);
Pm_Write(midi, buffer, 1);
buffer[0].timestamp = 400;
buffer[0].message = Pm_Message(0x90, 60, 0);
Pm_Write(midi, buffer, 1);
}
buffer[] and midi are declared globally. As far as I can make out
calling "Pt_Start(1000, &process_midi, 0)"; means that the above
callback function is called every 1 second, is this right? If that is
the case why don't I have a midi note playing back to me once a second
until I stop the timer?? Any help is much appreciated. Apart from the
header files and complex examples is there some place I can get basic
info and 'simple' examples? Cheers,
Rory.
_______________________________________________
media_api mailing list
media_api at create.ucsb.edu
http://www.create.ucsb.edu/mailman/listinfo/media_api
More information about the media_api
mailing list