• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libkmid
 

libkmid

  • libkmid
track.h
1 /* track.h - class track, which has a midi file track and its events
2  This file is part of LibKMid 0.9.5
3  Copyright (C) 1997,98,99,2000 Antonio Larrosa Jimenez
4  LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libkmid.html
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 
21  Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>
22 
23 ***************************************************************************/
24 #ifndef _TRACK_H
25 #define _TRACK_H
26 
27 #include <stdio.h>
28 #include <libkmid/dattypes.h>
29 
37 struct MidiEvent
38 {
44  uchar command;
45 
49  uchar chn;
50 
54  uchar note;
55 
59  uchar vel;
60 
64  uchar patch;
65 
69  uchar ctl;
70 
74  uchar d1;
75 
79  uchar d2;
80 
84  uchar d3;
85 
89  uchar d4;
90 
94  uchar d5;
95 
99  uchar d6;
100 
104  ulong length;
105 
109  uchar *data;
110 
111 };
112 
126 class MidiTrack
127 {
128  private:
129  class MidiTrackPrivate;
130  MidiTrackPrivate *d;
131 
132  int id;
133 
134  ulong size;
135  uchar *data;
136  uchar *ptrdata;
137 
138  bool note[16][128]; // Notes that are set on or off by this track
139  ulong current_ticks; // Total number of ticks since beginning of song
140  ulong delta_ticks; // Delta ticks from previous event to next event
141  ulong wait_ticks; // Wait ticks from previous event in other track
142  // to next event in this track
143 
144  ulong currentpos; // Some songs don't have a endoftrack event, so
145  // we have to see when currentpos > size
146  int endoftrack;
147 
148  ulong readVariableLengthValue(void);
149 
150  uchar lastcommand; // This is to run light without overbyte :-)
151 
152 
153  double current_time; // in ms.
154  double time_at_previous_tempochange; // in ms.
155  double ticks_from_previous_tempochange; // in ticks
156  // double time_to_next_event; // in ms.
157  double time_at_next_event; // in ms.
158  int tPCN;
159  ulong tempo;
160 
161  int power2to(int i);
162 
163  public:
172  MidiTrack(FILE *file,int tpcn,int Id);
173 
177  ~MidiTrack();
178 
186  int ticksPassed (ulong ticks);
187 
195  int msPassed (ulong ms);
196 
200  int currentMs (double ms);
201 
205  ulong waitTicks (void) { return wait_ticks; }
206 
207  // ulong waitMs (void) {return time_to_next_event;};
208 
212  double absMsOfNextEvent (void) { return time_at_next_event; }
213 
217  void changeTempo(ulong t);
218 
223  void readEvent(MidiEvent *ev);
224 
228  void init(void);
229 
233  void clear(void);
234 
235 };
236 
237 #endif

libkmid

Skip menu "libkmid"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libkmid

Skip menu "libkmid"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for libkmid by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |