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

Reply via email to