notearray.h

00001 /*  notearray.h  - NoteArray class, which holds an array of notes
00002     This file is part of LibKMid 0.9.5
00003     Copyright (C) 1998,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., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.                                                  
00020 
00021     Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>
00022 
00023 ***************************************************************************/
00024 #ifndef NOTEARRAY_H
00025 #define NOTEARRAY_H
00026 
00027 #include <libkmid/dattypes.h>
00028 #include <kdelibs_export.h>
00029 
00038 class KMID_EXPORT NoteArray
00039 {
00040   private:
00041     class NoteArrayPrivate;
00042     NoteArrayPrivate *d;
00043 
00044   public:
00045   struct noteCmd {
00049     ulong ms; 
00050 
00054     int chn;
00055 
00059     int cmd; 
00060 
00066     int note; 
00067   };
00068   
00069   private:
00070   noteCmd *data;
00071   ulong totalAllocated;
00072 
00073   ulong last;
00074   noteCmd *lastAdded;
00075 
00080   noteCmd *it;
00081 
00082   noteCmd *pointerTo(ulong pos);
00083 
00084   public:
00088   NoteArray(void);
00092   ~NoteArray();
00093 
00100   void at(ulong pos, ulong ms,int chn,int cmd,int note);
00101 
00106   void at(ulong pos, noteCmd s);
00107 
00111   noteCmd at(int pos);
00112 
00118   void add(ulong ms,int chn,int cmd,int note);
00119 
00126   void iteratorBegin(void) { it=data; };
00127 
00131   noteCmd *get(void)       { return it; };
00132 
00136   void next(void);
00137 
00142   void moveIteratorTo(ulong ms,int *pgm=NULL);
00143 };
00144 
00145 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys