Changeset 5269 for trunk/src/winmm/IRTMidi.cpp
- Timestamp:
- Feb 26, 2001, 9:14:40 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/winmm/IRTMidi.cpp
r2812 r5269 1 /* $Id: IRTMidi.cpp,v 1. 6 2000-02-17 14:09:29sandervl Exp $ */1 /* $Id: IRTMidi.cpp,v 1.7 2001-02-26 20:14:38 sandervl Exp $ */ 2 2 3 3 /******************************************************************************* … … 61 61 iSetup.hqueueCallback = 0; 62 62 if ( rc == 0 ) 63 rc = (*MidiSetup)( &iSetup, 0 );63 rc = MidiSetup( &iSetup, 0 ); 64 64 //fprintf( stderr, "MidiSetup rc=%d\n", rc ); 65 65 … … 93 93 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDICreateInstance", &modAddr ); 94 94 if ( rc ) return rc; 95 MidiCreateInstance = (ULONG(*APIENTRY )( ULONG, MINSTANCE*, PSZ, ULONG)) modAddr;95 pfnMidiCreateInstance = (ULONG(*APIENTRY )( ULONG, MINSTANCE*, PSZ, ULONG)) modAddr; 96 96 97 97 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDIDeleteInstance", &modAddr ); 98 98 if ( rc ) return rc; 99 MidiDeleteInstance = (ULONG(*APIENTRY )(MINSTANCE, ULONG)) modAddr;99 pfnMidiDeleteInstance = (ULONG(*APIENTRY )(MINSTANCE, ULONG)) modAddr; 100 100 101 101 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDIEnableInstance", &modAddr ); 102 102 if ( rc ) return rc; 103 MidiEnableInstance = (ULONG(*APIENTRY )(MINSTANCE, ULONG)) modAddr;103 pfnMidiEnableInstance = (ULONG(*APIENTRY )(MINSTANCE, ULONG)) modAddr; 104 104 105 105 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDIDisableInstance", &modAddr ); 106 106 if ( rc ) return rc; 107 MidiDisableInstance = (ULONG(*APIENTRY )(MINSTANCE, ULONG)) modAddr;107 pfnMidiDisableInstance = (ULONG(*APIENTRY )(MINSTANCE, ULONG)) modAddr; 108 108 109 109 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDIAddLink", &modAddr ); 110 110 if ( rc ) return rc; 111 MidiAddLink = (ULONG(*APIENTRY )(MINSTANCE, MINSTANCE, ULONG, ULONG)) modAddr;111 pfnMidiAddLink = (ULONG(*APIENTRY )(MINSTANCE, MINSTANCE, ULONG, ULONG)) modAddr; 112 112 113 113 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDIRemoveLink", &modAddr ); 114 114 if ( rc ) return rc; 115 MidiRemoveLink = (ULONG(*APIENTRY )(MINSTANCE, MINSTANCE, ULONG, ULONG)) modAddr;115 pfnMidiRemoveLink = (ULONG(*APIENTRY )(MINSTANCE, MINSTANCE, ULONG, ULONG)) modAddr; 116 116 117 117 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDIQueryClassList", &modAddr ); 118 118 if ( rc ) return rc; 119 MidiQueryClassList = (ULONG(*APIENTRY )(ULONG, PMIDICLASSINFO, ULONG)) modAddr;119 pfnMidiQueryClassList = (ULONG(*APIENTRY )(ULONG, PMIDICLASSINFO, ULONG)) modAddr; 120 120 121 121 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDIQueryInstanceList", &modAddr ); 122 122 if ( rc ) return rc; 123 MidiQueryInstanceList = (ULONG(*APIENTRY )(ULONG, PMIDIINSTANCEINFO, ULONG)) modAddr;123 pfnMidiQueryInstanceList = (ULONG(*APIENTRY )(ULONG, PMIDIINSTANCEINFO, ULONG)) modAddr; 124 124 125 125 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDIQueryNumClasses", &modAddr ); 126 126 if ( rc ) return rc; 127 MidiQueryNumClasses = (ULONG(*APIENTRY )(PULONG, ULONG)) modAddr;127 pfnMidiQueryNumClasses = (ULONG(*APIENTRY )(PULONG, ULONG)) modAddr; 128 128 129 129 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDIQueryNumInstances", &modAddr ); 130 130 if ( rc ) return rc; 131 MidiQueryNumInstances = (ULONG(*APIENTRY )(PULONG, ULONG)) modAddr;131 pfnMidiQueryNumInstances = (ULONG(*APIENTRY )(PULONG, ULONG)) modAddr; 132 132 133 133 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDISendMessages", &modAddr ); 134 134 if ( rc ) return rc; 135 MidiSendMessages = (ULONG(*APIENTRY )(PMESSAGE, ULONG, ULONG)) modAddr;135 pfnMidiSendMessages = (ULONG(*APIENTRY )(PMESSAGE, ULONG, ULONG)) modAddr; 136 136 137 137 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDISendSysexMessage", &modAddr ); 138 138 if ( rc ) return rc; 139 MidiSendSysexMessage = (ULONG(*APIENTRY )(PMESSAGE, ULONG, ULONG)) modAddr;139 pfnMidiSendSysexMessage = (ULONG(*APIENTRY )(PMESSAGE, ULONG, ULONG)) modAddr; 140 140 141 141 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDIRetrieveMessages", &modAddr ); 142 142 if ( rc ) return rc; 143 MidiRetrieveMessages = (ULONG(*APIENTRY )(MINSTANCE, PVOID, PULONG, ULONG)) modAddr;143 pfnMidiRetrieveMessages = (ULONG(*APIENTRY )(MINSTANCE, PVOID, PULONG, ULONG)) modAddr; 144 144 145 145 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDISetup", &modAddr ); 146 146 if ( rc ) return rc; 147 MidiSetup = (ULONG(*APIENTRY)(PMIDISETUP, ULONG)) modAddr;147 pfnMidiSetup = (ULONG(*APIENTRY)(PMIDISETUP, ULONG)) modAddr; 148 148 149 149 rc = DosQueryProcAddr( iRTMidiModule, 0L, "MIDITimer", &modAddr ); 150 150 if ( rc ) return rc; 151 MidiTimer = (ULONG(*APIENTRY )(ULONG, ULONG)) modAddr;151 pfnMidiTimer = (ULONG(*APIENTRY )(ULONG, ULONG)) modAddr; 152 152 153 153 return 0; … … 267 267 268 268 // Query classes and get the Hardware & Application class numbers 269 rc = (*MidiQueryNumClasses)( &nc, 0 );269 rc = MidiQueryNumClasses( &nc, 0 ); 270 270 if ( rc == 0 && nc > 0 ) 271 271 { 272 272 ci = new MIDICLASSINFO[ nc ]; 273 rc = (*MidiQueryClassList)( nc, ci, 0 );273 rc = MidiQueryClassList( nc, ci, 0 ); 274 274 } 275 275 if ( rc == 0 && ci ) … … 313 313 314 314 // Add new instance 315 rc = (*MidiCreateInstance)( classNum,315 rc = MidiCreateInstance( classNum, 316 316 &newInstance, 317 317 instanceName, … … 320 320 if ( rc == 0 ) 321 321 { 322 rc = (*MidiQueryNumInstances)( &ni, 0 );322 rc = MidiQueryNumInstances( &ni, 0 ); 323 323 if ( rc == 0 && ni > 0 ) 324 324 { 325 325 ci = new MIDIINSTANCEINFO[ ni ]; 326 rc = (*MidiQueryInstanceList)( ni, ci, 0 );326 rc = MidiQueryInstanceList( ni, ci, 0 ); 327 327 } 328 328 } … … 363 363 364 364 // Delete MIDI Instance 365 rc = (*MidiDeleteInstance)( theInstance->instance(), 0 );365 rc = MidiDeleteInstance( theInstance->instance(), 0 ); 366 366 setLastRC( rc ); 367 367 } … … 397 397 398 398 // Query instances and post them 399 rc = (*MidiQueryNumInstances)( &ni, 0 );399 rc = MidiQueryNumInstances( &ni, 0 ); 400 400 if ( rc == 0 && ni > 0 ) 401 401 { 402 402 ci = new MIDIINSTANCEINFO[ ni ]; 403 rc = (*MidiQueryInstanceList)( ni, ci, 0 );403 rc = MidiQueryInstanceList( ni, ci, 0 ); 404 404 } 405 405 if ( rc == 0 && ci ) … … 432 432 } 433 433 434 void IRTMidi::startTimer() const435 { 436 ((IRTMidi*)this)->setLastRC( (*MidiTimer)( MIDI_START_TIMER, 0 ) );437 } 438 439 void IRTMidi::stopTimer() const440 { 441 ((IRTMidi*)this)->setLastRC( (*MidiTimer)( MIDI_STOP_TIMER, 0 ) );434 void IRTMidi::startTimer() 435 { 436 ((IRTMidi*)this)->setLastRC( MidiTimer( MIDI_START_TIMER, 0 ) ); 437 } 438 439 void IRTMidi::stopTimer() 440 { 441 ((IRTMidi*)this)->setLastRC( MidiTimer( MIDI_STOP_TIMER, 0 ) ); 442 442 } 443 443 … … 458 458 if ( iTheIRTMidiSingleton != NULL ) 459 459 delete iTheIRTMidiSingleton; 460 } 461 462 ULONG IRTMidi::MidiCreateInstance( ULONG a, MINSTANCE* b, PSZ c, ULONG d) 463 { 464 ULONG ret; 465 USHORT sel = GetFS(); 466 ret = (*pfnMidiCreateInstance)(a,b,c,d); 467 SetFS(sel); 468 return ret; 469 } 470 ULONG IRTMidi::MidiDeleteInstance( MINSTANCE a, ULONG b) 471 { 472 ULONG ret; 473 USHORT sel = GetFS(); 474 ret = (*pfnMidiDeleteInstance)(a,b); 475 SetFS(sel); 476 return ret; 477 } 478 ULONG IRTMidi::MidiEnableInstance( MINSTANCE a, ULONG b ) 479 { 480 ULONG ret; 481 USHORT sel = GetFS(); 482 ret = (*pfnMidiEnableInstance)(a,b); 483 SetFS(sel); 484 return ret; 485 } 486 ULONG IRTMidi::MidiDisableInstance( MINSTANCE a, ULONG b) 487 { 488 ULONG ret; 489 USHORT sel = GetFS(); 490 ret = (*pfnMidiDisableInstance)(a,b); 491 SetFS(sel); 492 return ret; 493 } 494 ULONG IRTMidi::MidiAddLink( MINSTANCE a, MINSTANCE b, ULONG c, ULONG d ) 495 { 496 ULONG ret; 497 USHORT sel = GetFS(); 498 ret = (*pfnMidiAddLink)(a,b,c,d); 499 SetFS(sel); 500 return ret; 501 } 502 ULONG IRTMidi::MidiRemoveLink( MINSTANCE a, MINSTANCE b, ULONG c, ULONG d ) 503 { 504 ULONG ret; 505 USHORT sel = GetFS(); 506 ret = (*pfnMidiRemoveLink)(a,b,c,d); 507 SetFS(sel); 508 return ret; 509 } 510 ULONG IRTMidi::MidiQueryClassList( ULONG a, PMIDICLASSINFO b, ULONG c) 511 { 512 ULONG ret; 513 USHORT sel = GetFS(); 514 ret = (*pfnMidiQueryClassList)(a,b,c); 515 SetFS(sel); 516 return ret; 517 } 518 ULONG IRTMidi::MidiQueryInstanceList ( ULONG a, PMIDIINSTANCEINFO b, ULONG c) 519 { 520 ULONG ret; 521 USHORT sel = GetFS(); 522 ret = (*pfnMidiQueryInstanceList)(a,b,c); 523 SetFS(sel); 524 return ret; 525 } 526 ULONG IRTMidi::MidiQueryNumClasses ( PULONG a, ULONG b) 527 { 528 ULONG ret; 529 USHORT sel = GetFS(); 530 ret = (*pfnMidiQueryNumClasses)(a,b); 531 SetFS(sel); 532 return ret; 533 } 534 ULONG IRTMidi::MidiQueryNumInstances ( PULONG a, ULONG b) 535 { 536 ULONG ret; 537 USHORT sel = GetFS(); 538 ret = (*pfnMidiQueryNumInstances)(a,b); 539 SetFS(sel); 540 return ret; 541 } 542 ULONG IRTMidi::MidiSendMessages( PMESSAGE a, ULONG b, ULONG c ) 543 { 544 ULONG ret; 545 USHORT sel = GetFS(); 546 ret = (*pfnMidiSendMessages)(a,b,c); 547 SetFS(sel); 548 return ret; 549 } 550 ULONG IRTMidi::MidiSendSysexMessage( PMESSAGE a, ULONG b, ULONG c ) 551 { 552 ULONG ret; 553 USHORT sel = GetFS(); 554 ret = (*pfnMidiSendSysexMessage)(a,b,c); 555 SetFS(sel); 556 return ret; 557 } 558 ULONG IRTMidi::MidiRetrieveMessages( MINSTANCE a, PVOID b, PULONG c, ULONG d) 559 { 560 ULONG ret; 561 USHORT sel = GetFS(); 562 ret = (*pfnMidiRetrieveMessages)(a,b,c,d); 563 SetFS(sel); 564 return ret; 565 } 566 ULONG IRTMidi::MidiSetup( PMIDISETUP a, ULONG b) 567 { 568 ULONG ret; 569 USHORT sel = GetFS(); 570 ret = (*pfnMidiSetup)(a,b); 571 SetFS(sel); 572 return ret; 573 } 574 575 ULONG IRTMidi::MidiTimer( ULONG a, ULONG b ) 576 { 577 ULONG ret; 578 USHORT sel = GetFS(); 579 ret = (*pfnMidiTimer)(a,b); 580 SetFS(sel); 581 return ret; 460 582 } 461 583 … … 525 647 { 526 648 // Enable send 527 rc = (*IRTMIDI->MidiEnableInstance)( instance(), MIDI_ENABLE_SEND );649 rc = IRTMIDI->MidiEnableInstance( instance(), MIDI_ENABLE_SEND ); 528 650 if ( rc == 0 ) 529 651 iInfo.ulAttributes |= MIDI_INST_ATTR_ENABLE_S; … … 532 654 { 533 655 // Disable send 534 rc = (*IRTMIDI->MidiDisableInstance)( instance(), MIDI_DISABLE_SEND );656 rc = IRTMIDI->MidiDisableInstance( instance(), MIDI_DISABLE_SEND ); 535 657 if ( rc == 0 ) 536 658 iInfo.ulAttributes &= ~MIDI_INST_ATTR_ENABLE_S; … … 554 676 { 555 677 // Enable receive 556 rc = (*IRTMIDI->MidiEnableInstance)( instance(), MIDI_ENABLE_RECEIVE );678 rc = IRTMIDI->MidiEnableInstance( instance(), MIDI_ENABLE_RECEIVE ); 557 679 if ( rc == 0 ) 558 680 iInfo.ulAttributes |= MIDI_INST_ATTR_ENABLE_R; … … 561 683 { 562 684 // Disable receive 563 rc = (*IRTMIDI->MidiDisableInstance)( instance(), MIDI_DISABLE_RECEIVE );685 rc = IRTMIDI->MidiDisableInstance( instance(), MIDI_DISABLE_RECEIVE ); 564 686 if ( rc == 0 ) 565 687 iInfo.ulAttributes &= ~MIDI_INST_ATTR_ENABLE_R; … … 585 707 { 586 708 IRTMIDI->setLastRC( 587 (*IRTMIDI->MidiRemoveLink)( instance(), toLink->instance(),709 IRTMIDI->MidiRemoveLink( instance(), toLink->instance(), 588 710 0, // slot? 589 711 0 ) ); … … 605 727 } 606 728 IRTMIDI->setLastRC( 607 (*IRTMIDI->MidiAddLink)( instance(), toLink->instance(),729 IRTMIDI->MidiAddLink( instance(), toLink->instance(), 608 730 0, // slot ? 609 731 0 ) ); … … 626 748 msg.msg.abData[2] = b3; 627 749 msg.msg.abData[3] = b4; 628 IRTMIDI->setLastRC( (*IRTMIDI->MidiSendMessages)( &msg, 1, 0 ) );750 IRTMIDI->setLastRC( IRTMIDI->MidiSendMessages( &msg, 1, 0 ) ); 629 751 } 630 752 … … 640 762 msg.ulTrack = 0; 641 763 msg.msg.ulMessage = inMsg; 642 IRTMIDI->setLastRC( (*IRTMIDI->MidiSendMessages)( &msg, 1, 0 ) );764 IRTMIDI->setLastRC( IRTMIDI->MidiSendMessages( &msg, 1, 0 ) ); 643 765 } 644 766 … … 657 779 msg->ulTrack = 0; 658 780 memcpy( msg->msg.abData, theMsg, outLen ); 659 IRTMIDI->setLastRC( (*IRTMIDI->MidiSendSysexMessage)( msg, outLen, 0 ) );781 IRTMIDI->setLastRC( IRTMIDI->MidiSendSysexMessage( msg, outLen, 0 ) ); 660 782 free(msg); 661 783 } … … 667 789 unsigned long rc = 0; 668 790 numUCHARs = sizeof( theMessage ); 669 rc = (*IRTMIDI->MidiRetrieveMessages)( instance(), &theMessage, &numUCHARs, 0 );791 rc = IRTMIDI->MidiRetrieveMessages( instance(), &theMessage, &numUCHARs, 0 ); 670 792 if ( rc == 0 ) 671 793 {
Note:
See TracChangeset
for help on using the changeset viewer.