player.h Source File (libkmid Library)

| # libkmid Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# player.h

    00001 /*  player.h  - class MidiPlayer. Plays a set of tracks
    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 _PLAYER_H
    00025 #define _PLAYER_H
    00026
    00027 #include <libkmid/dattypes.h>
    00028 #include <libkmid/midfile.h>
    00029 #include <libkmid/deviceman.h>
    00030 #include <libkmid/track.h>
    00031 #include <libkmid/notearray.h>
    00032
    00047 struct SpecialEvent
    00048 {
    00052   int id;
    00053
    00059   ulong diffmilliseconds;
    00060
    00067   ulong absmilliseconds;
    00068
    00072   int ticks;
    00073
    00088   int type;
    00089
    00093   char text[1024];
    00094
    00098   ulong tempo;
    00103   int num;
    00108   int den;
    00109
    00120   struct SpecialEvent *next;
    00121
    00126 };
    00127
    00128
    00137 struct PlayerController
    00138 {
    00139   volatile ulong  ticksTotal;
    00140   volatile ulong  ticksPlayed;
    00141   volatile double millisecsPlayed;
    00142   volatile ulong  beginmillisec;
    00143
    00144   volatile int tempo;
    00145   volatile int num;
    00146   volatile int den;
    00147
    00148   volatile int SPEVprocessed;
    00149   volatile int SPEVplayed;
    00150
    00156   volatile int OK;
    00157
    00161   volatile int playing;
    00162
    00166   volatile int paused;
    00167
    00171   volatile int moving;
    00172
    00176   volatile int finished;
    00177
    00183   volatile int message; // set one of the following :
    00184
    00185 #define PLAYER_DOPAUSE  1
    00186 #define PLAYER_DOSTOP   2
    00187 #define PLAYER_SETPOS   4
    00188 #define PLAYER_HALT     8
    00189
    00190   volatile ulong gotomsec; //milliseconds to go to,if player_setpos is set
    00191
    00195   volatile int error;
    00196
    00201   volatile int gm;
    00202
    00208   volatile int volumepercentage ;
    00209
    00214   volatile bool forcepgm[16];
    00215
    00220   volatile int pgm[16];
    00221
    00225   volatile double ratioTempo;
    00226
    00231   volatile bool isSendingAllNotesOff;
    00232
    00233   volatile MidiEvent *ev;
    00234 };
    00235
    00236
    00259 class MidiPlayer
    00260 {
    00261   class MidiPlayerPrivate;
    00262   MidiPlayerPrivate *d;
    00263
    00264   DeviceManager *midi;
    00265   MidiFileInfo *info;
    00266   MidiTrack **tracks;
    00267   SpecialEvent *spev;
    00268   NoteArray *na;
    00269
    00270   int songLoaded;
    00271
    00272   PlayerController *ctl;
    00273
    00274   bool parsesong;
    00275   bool generatebeats;
    00276
    00277   void removeSpecialEvents(void);
    00278   void parseSpecialEvents(void);
    00279   void insertBeat(SpecialEvent *ev,ulong ms,int num,int den);
    00280   void generateBeats(void);
    00281
    00282   //NoteArray *parseNotes(void);
    00283   void debugSpecialEvents(void);
    00284   public:
    00285
    00291   MidiPlayer(DeviceManager *midi_,PlayerController *pctl);
    00292
    00296   ~MidiPlayer();
    00297
    00304   int loadSong(const char *filename);
    00305
    00310   void removeSong(void);
    00311
    00316   int isSongLoaded(void) { return songLoaded; };
    00317
    00322   SpecialEvent *specialEvents() { return spev; };
    00323
    00332   NoteArray *noteArray(void) { return na; };
    00333
    00334
    00354   void play(bool calloutput=false,void output(void) = 0);
    00355
    00361   void setParseSong(bool b = true);
    00362
    00367   void setGenerateBeats(bool b = false);
    00368
    00374   MidiFileInfo *information(void) { return info; };
    00375
    00385   void setPos(ulong gotomsec, class MidiStatus *midistat);
    00386
    00391   void setTempoRatio(double ratio);
    00392
    00393 };
    00394
    00395 #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