root/trunk/libjdkmidi/trunk/include/jdkmidi/multitrack.h

Revision 555, 4.0 kB (checked in by jeffk@…, 4 months ago)

latex documentation started. autobuild dir switched to magicmakefile v6

Line 
1/*
2 *  libjdkmidi-2004 C++ Class Library for MIDI
3 *
4 *  Copyright (C) 2004  J.D. Koftinoff Software, Ltd.
5 *  www.jdkoftinoff.com
6 *  jeffk@jdkoftinoff.com
7 *
8 *  *** RELEASED UNDER THE GNU GENERAL PUBLIC LICENSE (GPL) April 27, 2004 ***
9 *
10 *  This program is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License as published by
12 *  the Free Software Foundation; either version 2 of the License, or
13 *  (at your option) any later version.
14 *
15 *  This program is distributed in the hope that it will be useful,
16 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 *  GNU General Public License for more details.
19 *
20 *  You should have received a copy of the GNU General Public License
21 *  along with this program; if not, write to the Free Software
22 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23*/
24/*
25** Copyright 1986 to 1998 By J.D. Koftinoff Software, Ltd.
26**
27** All rights reserved.
28**
29** No one may duplicate this source code in any form for any reason
30** without the written permission given by J.D. Koftinoff Software, Ltd.
31**
32*/
33
34#ifndef JDKMIDI_MULTITRACK_H
35#define JDKMIDI_MULTITRACK_H
36
37#include "jdkmidi/track.h"
38
39namespace jdkmidi
40{
41
42  class MIDIMultiTrack;
43  class MIDIMultiTrackIteratorState;
44  class MIDIMultiTrackIterator;
45 
46  class MIDIMultiTrack
47  {
48    public:
49   
50      MIDIMultiTrack ( int max_num_tracks_=64, bool deletable_=true );
51      virtual ~MIDIMultiTrack();
52     
53      void SetTrack ( int trk, MIDITrack *t );
54      MIDITrack *GetTrack ( int trk );
55      const MIDITrack *GetTrack ( int trk ) const;
56      int GetNumTracks() const
57      {
58        return num_tracks;
59      }
60     
61     
62      void Clear();
63     
64      int GetClksPerBeat() const
65      {
66        return clks_per_beat;
67      }
68     
69      void SetClksPerBeat ( int c )
70      {
71        clks_per_beat = c;
72      }
73     
74    protected:
75   
76      MIDITrack **tracks;
77      const int num_tracks;
78      bool deletable;
79     
80      int  clks_per_beat;
81     
82    private:
83
84      const MIDIMultiTrack & operator = ( const MIDIMultiTrack & );
85      MIDIMultiTrack ( const MIDIMultiTrack & );
86  };
87 
88  class MIDIMultiTrackIteratorState
89  {
90    public:
91   
92      MIDIMultiTrackIteratorState ( int num_tracks_=64 );
93      MIDIMultiTrackIteratorState ( const MIDIMultiTrackIteratorState &m );
94      virtual ~MIDIMultiTrackIteratorState();
95     
96      const MIDIMultiTrackIteratorState & operator = ( const MIDIMultiTrackIteratorState &m );
97     
98      int GetNumTracks() const
99      {
100        return num_tracks;
101      }
102      int GetCurEventTrack() const
103      {
104        return cur_event_track;
105      }
106      MIDIClockTime GetCurrentTime() const
107      {
108        return cur_time;
109      }
110     
111      void Reset();
112      int FindTrackOfFirstEvent();
113     
114      MIDIClockTime cur_time;
115      int cur_event_track;
116      int num_tracks;
117      int *next_event_number;
118      MIDIClockTime *next_event_time;
119  };
120 
121  class MIDIMultiTrackIterator
122  {
123    public:
124   
125      MIDIMultiTrackIterator ( MIDIMultiTrack *mlt );
126      virtual ~MIDIMultiTrackIterator();
127     
128     
129      void GoToTime ( MIDIClockTime time );
130     
131      bool GetCurEventTime ( MIDIClockTime *t ) const;
132      bool GetCurEvent ( int *track, MIDITimedBigMessage **msg ) const;
133      bool GoToNextEvent();
134     
135      bool GoToNextEventOnTrack ( int track );
136     
137      const MIDIMultiTrackIteratorState &GetState() const
138      {
139        return state;
140      }
141     
142      MIDIMultiTrackIteratorState &GetState()
143      {
144        return state;
145      }
146     
147      void SetState ( const MIDIMultiTrackIteratorState &s )
148      {
149        state = s;
150      }
151     
152      MIDIMultiTrack * GetMultiTrack()
153      {
154        return multitrack;
155      }
156      const MIDIMultiTrack * GetMultiTrack() const
157      {
158        return multitrack;
159      }
160     
161    protected:
162   
163      MIDIMultiTrack *multitrack;
164      MIDIMultiTrackIteratorState state;
165  };
166 
167}
168
169#endif
170
Note: See TracBrowser for help on using the browser.