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

include/jdkmidi/process.h

Go to the documentation of this file.
00001 /*
00002  *  libjdkmidi-2004 C++ Class Library for MIDI
00003  *
00004  *  Copyright (C) 2004  J.D. Koftinoff Software, Ltd.
00005  *  www.jdkoftinoff.com
00006  *  jeffk@jdkoftinoff.com
00007  *
00008  *  *** RELEASED UNDER THE GNU GENERAL PUBLIC LICENSE (GPL) April 27, 2004 ***
00009  *
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 */
00024 #ifndef _JDKMIDI_PROCESS_H
00025 #define _JDKMIDI_PROCESS_H
00026 
00027 #include "jdkmidi/msg.h"
00028 #include "jdkmidi/sysex.h"
00029 
00030 namespace jdkmidi
00031 {
00032   class MIDIProcessor;
00033   class MIDIMultiProcessor;
00034   class MIDIProcessorTransposer;
00035   class MIDIProcessor;
00036   
00037   
00038   class MIDIProcessor 
00039     {
00040     public:
00041       MIDIProcessor();
00042       virtual ~MIDIProcessor();
00043       
00044       virtual bool Process( MIDITimedBigMessage *msg ) = 0;
00045     }; 
00046   
00047   class MIDIMultiProcessor : public MIDIProcessor 
00048     {
00049     public:
00050       MIDIMultiProcessor( int num_processors );
00051       virtual ~MIDIMultiProcessor();
00052       
00053       // MIDIProcessors given to a MIDIMultiProcessor are NOT owned
00054       // by MIDIMultiProcessor.
00055       
00056       void SetProcessor( int position, MIDIProcessor *proc )
00057         {
00058           processors[position]=proc;
00059         }   
00060       
00061       MIDIProcessor *GetProcessor( int position )
00062         {
00063           return processors[position];
00064         }     
00065       
00066       const MIDIProcessor *GetProcessor( int position ) const
00067         {
00068           return processors[position];
00069         }
00070       
00071       virtual bool Process( MIDITimedBigMessage *msg );
00072       
00073     private:
00074       MIDIProcessor **processors;
00075       int num_processors;
00076     }; 
00077   
00078   class MIDIProcessorTransposer : public MIDIProcessor 
00079     {
00080     public:
00081       MIDIProcessorTransposer();
00082       virtual ~MIDIProcessorTransposer();
00083       
00084       void SetTransposeChannel( int chan, int trans )
00085         {
00086           trans_amount[chan] = trans;
00087         }
00088       
00089       int GetTransposeChannel( int chan ) const
00090         {
00091           return trans_amount[chan];
00092         }
00093       
00094       void SetAllTranspose( int trans );
00095       
00096       virtual bool Process( MIDITimedBigMessage *msg );
00097     private:
00098       int trans_amount[16];
00099     }; 
00100   
00101   class MIDIProcessorRechannelizer : public MIDIProcessor 
00102     {
00103     public:
00104       MIDIProcessorRechannelizer();
00105       virtual ~MIDIProcessorRechannelizer();
00106       
00107       void SetRechanMap( int src_chan, int dest_chan )
00108         {
00109           rechan_map[src_chan] = dest_chan;
00110         }
00111       
00112       int GetRechanMap( int src_chan ) const
00113         { 
00114           return rechan_map[src_chan];
00115         }
00116       
00117       void SetAllRechan( int dest_chan );
00118       
00119       virtual bool Process( MIDITimedBigMessage *msg );
00120       
00121     private:
00122       
00123       int rechan_map[16];
00124     }; 
00125 }
00126 
00127 #endif