jdkmidi class library documentation

Copyright © 2004 J.D. Koftinoff Software, Ltd.

Released under the GNU General Public License (GPL)




Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

jdkmidi::MIDIProcessorTransposer Class Reference

#include <process.h>

Inheritance diagram for jdkmidi::MIDIProcessorTransposer:

jdkmidi::MIDIProcessor List of all members.

Public Member Functions

 MIDIProcessorTransposer ()
virtual ~MIDIProcessorTransposer ()
void SetTransposeChannel (int chan, int trans)
int GetTransposeChannel (int chan) const
void SetAllTranspose (int trans)
virtual bool Process (MIDITimedBigMessage *msg)

Private Attributes

int trans_amount [16]

Constructor & Destructor Documentation

jdkmidi::MIDIProcessorTransposer::MIDIProcessorTransposer  ) 
 

Definition at line 81 of file jdkmidi_process.cpp.

References trans_amount.

00082   {
00083     for( int i=0; i<16; ++i )
00084     {
00085       trans_amount[i] = 0;
00086     }
00087     
00088   }

jdkmidi::MIDIProcessorTransposer::~MIDIProcessorTransposer  )  [virtual]
 

Definition at line 90 of file jdkmidi_process.cpp.

00091   {
00092   }


Member Function Documentation

int jdkmidi::MIDIProcessorTransposer::GetTransposeChannel int  chan  )  const [inline]
 

Definition at line 89 of file process.h.

References trans_amount.

00090         {
00091           return trans_amount[chan];
00092         }

bool jdkmidi::MIDIProcessorTransposer::Process MIDITimedBigMessage msg  )  [virtual]
 

Implements jdkmidi::MIDIProcessor.

Definition at line 103 of file jdkmidi_process.cpp.

References jdkmidi::MIDIMessage::GetChannel(), jdkmidi::MIDIMessage::GetNote(), jdkmidi::MIDIMessage::IsChannelMsg(), jdkmidi::MIDIMessage::IsNoteOff(), jdkmidi::MIDIMessage::IsNoteOn(), jdkmidi::MIDIMessage::IsPolyPressure(), jdkmidi::MIDIMessage::SetNote(), and trans_amount.

00104   {
00105     if( msg->IsChannelMsg() )
00106     {   
00107       if( msg->IsNoteOn() || msg->IsNoteOff() || msg->IsPolyPressure() )
00108       {
00109         int trans = trans_amount[ msg->GetChannel() ];
00110         
00111         int new_note = ((int)msg->GetNote())+trans;
00112         
00113         if( trans>127 || trans<0 )
00114         {
00115           // delete event if out of range
00116           return false;
00117         }     
00118         else
00119         {
00120           // set new note number
00121           msg->SetNote( (unsigned char)new_note );
00122         }
00123         
00124       }
00125     }
00126     
00127     return true;
00128   }

void jdkmidi::MIDIProcessorTransposer::SetAllTranspose int  trans  ) 
 

Definition at line 95 of file jdkmidi_process.cpp.

References trans_amount.

00096   {
00097     for( int chan=0; chan<16; ++chan )
00098     {
00099       trans_amount[chan]=val;
00100     }
00101   } 

void jdkmidi::MIDIProcessorTransposer::SetTransposeChannel int  chan,
int  trans
[inline]
 

Definition at line 84 of file process.h.

References trans_amount.

00085         {
00086           trans_amount[chan] = trans;
00087         }


Member Data Documentation

int jdkmidi::MIDIProcessorTransposer::trans_amount[16] [private]
 

Definition at line 98 of file process.h.


The documentation for this class was generated from the following files: