Source: midimountain/mcEvent.h


Annotated List
Files
Globals
Hierarchy
Index
//=============================================================================
//  TMidiEvent class definition
//=============================================================================
// Author  : Adrian Meyer
// Version : 0.2.2
// Log     :
//=============================================================================
// 18.02.2000 building class
// 25.02.2000 owner, data methods
//            compiler switch DEBUG_OUTPUT
// 27.02.2000 accessing channel, accessing data
// 29.02.2000 show info
// 01.03.2000 display Ref offset in ShowInfo
// 30.03.2000 read note name and number
// 05.04.2000 read owner
// 03.09.2000 added get index
// 04.09.2000 destructor corrected (ref destroy removed)
// 04.09.2001 changing to base class TMidiItem
//=============================================================================
// to do:
//=============================================================================

#ifndef __MCEVENT__
#define __MCEVENT__

#include <mcTrack.h>
#include <mcList.h>

const short cWFOK = 0;
const short cWFPlaying = 1;
const short cWFLocked = 2;

// event status
const short cESNoteOff              = 0x80;           // d1=note number, d2=velocite
const short cESNoteOn               = 0x90;           // d1=note number, d2=velocite
const short cESPolyphonicAfterTouch = 0xA0;           // d1=note number, d2=touch
const short cESControlChange        = 0xB0;           // d1=control number, d2=value
const short cESProgramChange        = 0xC0;           // d1=program number
const short cESChannelAfterTouch    = 0xD0;           // d1=touch
const short cESPitchBend            = 0xE0;           // d1=amount low byte, d2=amount high byte

const short cESSystemExclusive      = 0xF0;
const short cESMidiTimeCode         = 0xF1;
const short cESSongPositionPointer  = 0xF2;
const short cESSongSelect           = 0xF3;
const short cESTuneRequest          = 0xF6;
const short cESEndOfSystemExclusive = 0xF7;
const short cESTimingClock          = 0xF8;
const short cESStart                = 0xFA;
const short cESContinue             = 0xFB;
const short cESStop                 = 0xFC;
const short cESActiveSensing        = 0xFE;
const short cESSystemReset          = 0xFF;

const long cMMEventCreate           = cMCEvent << 16 | 0x0001;
const long cMMEventDestroy          = cMCEvent << 16 | 0x0002;
const long cMMEventSetChannel       = cMCEvent << 16 | 0x0003;
const long cMMEventSetOffset        = cMCEvent << 16 | 0x0004;
const long cMMEventSetData1         = cMCEvent << 16 | 0x0005;
const long cMMEventSetData2         = cMCEvent << 16 | 0x0006;
const long cMMEventSetData3         = cMCEvent << 16 | 0x0007;


class TMidiEvent: public TMidiItem
  {
		friend ostream& operator<<(ostream& out, TMidiEvent ev);

    private:
      TMidiTrack* fOwner;
      short fData1;                                   // data bytes
      short fData2;
      short fData3;
      short fWorkFlag;
      bool fNoteOff;                                  // note off event
      char* fResult;                                  // result for notename
    public:
      TMidiEvent* Ref;                                // reference to other event

      TMidiEvent( TMidiTrack* aOwner, long aOffset ); // constructor
      ~TMidiEvent( void );                            // destructor

//      int GetIndex( void );                           // read index of event

      long GetOffset( void );                         // read offset
      void SetOffset( long aOffset );                 // write offset

	  // Set channel (based on 1..16)
      void SetChannel( short aChannel );
	  // Get channel (based on 1..16)
      short GetChannel( void );

      void SetNoteOff( bool aNoteOff );               // writing note off
      short GetNoteOff( void );                       // reading note off

      void SetData1( short aData1 );                  // read and write data
      short GetData1( void );
      void SetData2( short aData2 );
      short GetData2( void );
      void SetData3( short aData3 );
      short GetData3( void );

	  // Get the command status (eg. cESNoteOn etc)
	  int GetStatus() { return fData1 & 0xf0; };

      char* GetNoteName();                            // get note name and number

      void ShowInfo( void );                          // show info

      TMidiTrack* GetOwner( void );                   // read owner
  };

#endif

Generated by: root@castle on Fri Jul 20 00:33:17 2001, using kdoc 2.0a36.