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

libkmid

  • libkmid
player.h
1 /* player.h - class MidiPlayer. Plays a set of tracks
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 _PLAYER_H
25 #define _PLAYER_H
26 
27 #include <libkmid/dattypes.h>
28 #include <libkmid/midfile.h>
29 #include <libkmid/deviceman.h>
30 #include <libkmid/track.h>
31 #include <libkmid/notearray.h>
32 #include <kdemacros.h>
33 
48 struct SpecialEvent
49 {
53  int id;
54 
60  ulong diffmilliseconds;
61 
68  ulong absmilliseconds;
69 
73  int ticks;
74 
89  int type;
90 
94  char text[1024];
95 
99  ulong tempo;
104  int num;
109  int den;
110 
121  struct SpecialEvent *next;
122 
127 };
128 
129 
138 struct PlayerController
139 {
140  volatile ulong ticksTotal;
141  volatile ulong ticksPlayed;
142  volatile double millisecsPlayed;
143  volatile ulong beginmillisec;
144 
145  volatile int tempo;
146  volatile int num;
147  volatile int den;
148 
149  volatile int SPEVprocessed;
150  volatile int SPEVplayed;
151 
157  volatile int OK;
158 
162  volatile int playing;
163 
167  volatile int paused;
168 
172  volatile int moving;
173 
177  volatile int finished;
178 
184  volatile int message KDE_DEPRECATED; // set one of the following :
185 
186 #define PLAYER_DOPAUSE 1
187 #define PLAYER_DOSTOP 2
188 #define PLAYER_SETPOS 4
189 #define PLAYER_HALT 8
190 
191  volatile ulong gotomsec; //milliseconds to go to,if player_setpos is set
192 
196  volatile int error;
197 
202  volatile int gm;
203 
209  volatile int volumepercentage ;
210 
215  volatile bool forcepgm[16];
216 
221  volatile int pgm[16];
222 
226  volatile double ratioTempo;
227 
232  volatile bool isSendingAllNotesOff;
233 
234  volatile MidiEvent *ev;
235 };
236 
237 
260 class KMID_EXPORT MidiPlayer
261 {
262  class MidiPlayerPrivate;
263  MidiPlayerPrivate *d;
264 
265  DeviceManager *midi;
266  MidiFileInfo *info;
267  MidiTrack **tracks;
268  SpecialEvent *spev;
269  NoteArray *na;
270 
271  int songLoaded;
272 
273  PlayerController *ctl;
274 
275  bool parsesong;
276  bool generatebeats;
277 
278  void removeSpecialEvents(void);
279  void parseSpecialEvents(void);
280  void insertBeat(SpecialEvent *ev,ulong ms,int num,int den);
281  void generateBeats(void);
282 
283  //NoteArray *parseNotes(void);
284  void debugSpecialEvents(void);
285  public:
286 
292  MidiPlayer(DeviceManager *midi_,PlayerController *pctl);
293 
297  ~MidiPlayer();
298 
305  int loadSong(const char *filename);
306 
311  void removeSong(void);
312 
317  int isSongLoaded(void) { return songLoaded; }
318 
323  SpecialEvent *specialEvents() { return spev; }
324 
333  NoteArray *noteArray(void) { return na; }
334 
335 
355  void play(bool calloutput=false,void output(void) = 0);
356 
362  void setParseSong(bool b = true);
363 
368  void setGenerateBeats(bool b = false);
369 
375  MidiFileInfo *information(void) { return info; }
376 
386  void setPos(ulong gotomsec, class MidiStatus *midistat);
387 
392  void setTempoRatio(double ratio);
393 
394 };
395 
396 #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.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |