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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Rory Walsh
Sent: 23 May 2006 16:08
To: [email protected]
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
[email protected]
http://www.create.ucsb.edu/mailman/listinfo/media_api

_______________________________________________
media_api mailing list
[email protected]
http://www.create.ucsb.edu/mailman/listinfo/media_api

Reply via email to