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/edittrack.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 /*
00025 **  Copyright 1986 to 1998 By J.D. Koftinoff Software, Ltd.
00026 **
00027 **  All rights reserved.
00028 **
00029 **  No one may duplicate this source code in any form for any reason
00030 **  without the written permission given by J.D. Koftinoff Software, Ltd.
00031 **
00032 */
00033 
00034 #ifndef _JDKMIDI_EDITTRACK_H
00035 #define _JDKMIDI_EDITTRACK_H
00036 
00037 #include "jdkmidi/track.h"
00038 #include "jdkmidi/matrix.h"
00039 #include "jdkmidi/process.h"
00040 
00041 namespace jdkmidi
00042 {
00043   
00044   class MIDIEditTrackEventMatcher
00045     {
00046     public:
00047       MIDIEditTrackEventMatcher();
00048       virtual ~MIDIEditTrackEventMatcher();
00049       
00050       virtual bool Match( const MIDITimedBigMessage &ev ) =0;
00051     };
00052   
00053   
00054   class   MIDIEditTrack 
00055     {
00056     public:
00057       MIDIEditTrack( MIDITrack *track_ );
00058       virtual ~MIDIEditTrack();
00059       
00060       //
00061       // Process applies a MIDI process to all events that are matched
00062       //
00063       
00064       void  Process(
00065         MIDIClockTime start_time,
00066         MIDIClockTime end_time,
00067         MIDIProcessor *process,
00068         MIDIEditTrackEventMatcher *match
00069         );
00070       
00071       //
00072       // Truncate erases all events after a certain time. then
00073       // adds appropriate note off's
00074       //
00075       void    Truncate(MIDIClockTime start_time );
00076       
00077       
00078       //
00079       // this merge function merges two other tracks into this track.
00080       // this is the faster form of merge
00081       //
00082       void  Merge(
00083         MIDITrack *trk1, MIDITrack *trk2,
00084         MIDIEditTrackEventMatcher *match1,
00085         MIDIEditTrackEventMatcher *match2 );
00086       
00087       
00088       //
00089       // this erase function will erase all events from start to end time
00090       // and can be jagged or not.
00091       //
00092       void  Erase(
00093         MIDIClockTime start,
00094         MIDIClockTime end,
00095         bool jagged=true,
00096         MIDIEditTrackEventMatcher *match=0
00097         );
00098       
00099       
00100       
00101       //
00102       // this delete function will delete all events like erase and then
00103       // shift the events over
00104       //
00105       void    Delete(
00106         MIDIClockTime start,
00107         MIDIClockTime end,
00108         bool jagged=true,
00109         MIDIEditTrackEventMatcher *match=0
00110         );
00111       
00112       
00113       //
00114       // this insert function will insert 'length' clicks starting at
00115       // the events at start time.
00116       //
00117       void  Insert(
00118         MIDIClockTime start,
00119         MIDIClockTime length
00120         );
00121       
00122       
00123       //
00124       // this shift function will shift all event times by an offset.
00125       //
00126       void  Shift(
00127         signed long offset,
00128         MIDIEditTrackEventMatcher *match=0
00129         );
00130       
00131     protected:
00132       
00133       MIDIMatrix matrix;
00134       MIDITrack *track;
00135       
00136     private:
00137       
00138     }; 
00139   
00140   
00141 }
00142 
00143 #endif
00144 
00145