home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / beaversweeper_v101.zip / src / MIDIReceptor.cpp < prev    next >
C/C++ Source or Header  |  2003-01-06  |  809b  |  47 lines

  1. #include "stdafx.h"
  2. #include <mmsystem.h>
  3. #include "MIDIReceptor.h"
  4.  
  5. MIDIReceptor::MIDIReceptor()
  6. {
  7.  
  8.  
  9. }
  10.  
  11. MIDIReceptor::~MIDIReceptor()
  12. {
  13.  
  14.  
  15. }
  16.  
  17. void MIDIReceptor::FilterMidiMsg( UINT message, WPARAM wParam, LPARAM lParam )
  18. {
  19.     if (message == MM_MIM_DATA) {
  20.         unsigned char param1 = lParam & 0xff;
  21.         unsigned char param2 = (lParam>>8) & 0xff;
  22.         unsigned char param3 = (lParam>>16) & 0xff;
  23.  
  24.         if( ((param1&0xF0)==0x90 && param3==0x00) || (param1&0xF0)==0x80 ) {
  25.             // Note OFF
  26.             OnMIDIKeyUp( param2 - 36, param3 << 1 );
  27.         } else 
  28.             if( (param1&0xF0)==0x90) {
  29.                 // Note ON
  30.                 OnMIDIKeyDown( param2 - 36, param3 << 1 );
  31.             }
  32.  
  33.  
  34.     }
  35. }
  36.  
  37. void MIDIReceptor::OnMIDIKeyDown( UINT key, UINT velocity )
  38. {
  39.     
  40. }
  41.  
  42. void MIDIReceptor::OnMIDIKeyUp( UINT key, UINT velocity )
  43. {
  44.     
  45. }
  46.  
  47.