//------------------------------------------------------------------------- // Filename: player.hh // Version: $Id: player.hh,v 1.1.4.4 1999/06/09 10:14:03 erik Exp $ // Copyright: Copyright (C) 1999, Erik Mouw (J.A.K.Mouw@its.tudelft.nl) // Author: Erik Mouw // Description: MIDI player // Created at: Sun Mar 28 23:23:55 1999 // Modified by: Erik Mouw // Modified at: Wed May 26 16:48:07 1999 //------------------------------------------------------------------------- // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #ident "$Id: player.hh,v 1.1.4.4 1999/06/09 10:14:03 erik Exp $" #ifndef musica_player_hh #define musica_player_hh #include "sequence.hh" #include "mididevice.hh" class midiPlayer { private: long int startTime; // time we started playing long int lastEventTime; // time of last played event long int nextEventTime; // time of next event to be played midiSequence *sequence; int relTempoNumerator; int relTempoDenominator; double ffwdSpeed; int division; int number; long int tempo; int hours, minutes, seconds, frames, fraction; int numerator, denominator, clocks, bb; int signature, key; midiDevice *device; bool playing; bool startPlaying; bool doFastForward; long int nextNote(void); public: midiPlayer(void) { division = 120; tempo = 1L; relTempoNumerator = relTempoDenominator = 1; startTime = 0L; lastEventTime = 0L; sequence = 0; device = 0; playing = false; doFastForward = false; ffwdSpeed = 4.0; } bool setSequence(midiSequence *theSequence); midiSequence* getSequence(void) { return(sequence); }; bool setDevice(midiDevice *theDevice); void setDivision(int n); void sequenceNumber(int n); void endOfTrack(void); void setTempo(long int t); void smpteOffset(int h, int m, int s, int f, int fr); void timeSignature(int n, int d, int c, int b); void keySignature(int k, int s); void setRelativeTempo(int value); void setFastForwardSpeed(double value); double getFastForwardSpeed(void); void rewind(void); void play(void); void fastForward(bool value); void stop(void); long int doPlay(long int currentTime); }; #endif