# libkmid Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# track.h

    00001 /*  track.h  - class track, which has a midi file track and its events
    00002     This file is part of LibKMid 0.9.5
    00003     Copyright (C) 1997,98,99,2000  Antonio Larrosa Jimenez
    00004     LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libkmid.html
    00005
    00006     This library is free software; you can redistribute it and/or
    00007     modify it under the terms of the GNU Library General Public
    00008     License as published by the Free Software Foundation; either
    00009     version 2 of the License, or (at your option) any later version.
    00010
    00011     This library is distributed in the hope that it will be useful,
    00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014     Library General Public License for more details.
    00015
    00016     You should have received a copy of the GNU Library General Public License
    00017     along with this library; see the file COPYING.LIB.  If not, write to
    00018     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019     Boston, MA 02111-1307, USA.
    00020
    00021     Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>
    00022
    00023 ***************************************************************************/
    00024 #ifndef _TRACK_H
    00025 #define _TRACK_H
    00026
    00027 #include <stdio.h>
    00028 #include <libkmid/dattypes.h>
    00029
    00037 struct MidiEvent
    00038 {
    00044   uchar command;
    00045
    00049   uchar   chn;
    00050
    00054   uchar   note;
    00055
    00059   uchar   vel;
    00060
    00064   uchar   patch;
    00065
    00069   uchar   ctl;
    00070
    00074   uchar   d1;
    00075
    00079   uchar   d2;
    00080
    00084   uchar   d3;
    00085
    00089   uchar   d4;
    00090
    00094   uchar   d5;
    00095
    00099   uchar   d6;
    00100
    00104   ulong length;
    00105
    00109   uchar  *data;
    00110
    00111 };
    00112
    00126 class MidiTrack
    00127 {
    00128   private:
    00129     class MidiTrackPrivate;
    00130     MidiTrackPrivate *d;
    00131
    00132     int id;
    00133
    00134     ulong size;
    00135     uchar *data;
    00136     uchar *ptrdata;
    00137
    00138     bool  note[16][128]; // Notes that are set on or off by this track
    00139     ulong current_ticks; // Total number of ticks since beggining of song
    00140     ulong delta_ticks;   // Delta ticks from previous event to next event
    00141     ulong wait_ticks;    // Wait ticks from previous event in other track
    00142     // to next event in this track
    00143
    00144     ulong currentpos; // Some songs don't have a endoftrack event, so
    00145     // we have to see when currentpos > size
    00146     int endoftrack;
    00147
    00148     ulong readVariableLengthValue(void);
    00149
    00150     uchar lastcommand;  // This is to run light without overbyte :-)
    00151
    00152
    00153     double current_time; // in ms.
    00154     double time_at_previous_tempochange;  // in ms.
    00155     double ticks_from_previous_tempochange; // in ticks
    00156     //  double  time_to_next_event;  // in ms.
    00157     double      time_at_next_event;  // in ms.
    00158     int tPCN;
    00159     ulong       tempo;
    00160
    00161     int power2to(int i);
    00162
    00163   public:
    00172     MidiTrack(FILE *file,int tpcn,int Id);
    00173
    00177     ~MidiTrack();
    00178
    00186     int ticksPassed (ulong ticks);
    00187
    00195     int msPassed    (ulong ms);
    00196
    00200     int currentMs   (double ms);
    00201
    00205     ulong       waitTicks   (void) { return wait_ticks; };
    00206
    00207     //  ulong   waitMs (void) {return time_to_next_event;};
    00208
    00212     double   absMsOfNextEvent (void) { return time_at_next_event; };
    00213
    00217     void        changeTempo(ulong t);
    00218
    00223     void        readEvent(MidiEvent *ev);
    00224
    00228     void        init(void);
    00229
    00233     void        clear(void);
    00234
    00235 };
    00236
    00237 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:28:30 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001