00001 /* 00002 * libjdkmidi-2004 C++ Class Library for MIDI 00003 * 00004 * Copyright (C) 2004 J.D. Koftinoff Software, Ltd. 00005 * www.jdkoftinoff.com 00006 * jeffk@jdkoftinoff.com 00007 * 00008 * *** RELEASED UNDER THE GNU GENERAL PUBLIC LICENSE (GPL) April 27, 2004 *** 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 #ifndef _JDKMIDI_MANAGER_H 00025 #define _JDKMIDI_MANAGER_H 00026 00027 #include "jdkmidi/msg.h" 00028 #include "jdkmidi/sysex.h" 00029 #include "jdkmidi/driver.h" 00030 #include "jdkmidi/sequencer.h" 00031 #include "jdkmidi/tick.h" 00032 00033 namespace jdkmidi 00034 { 00035 class MIDIManager : public MIDITick 00036 { 00037 public: 00038 MIDIManager( 00039 MIDIDriver *drv, 00040 MIDISequencerGUIEventNotifier *n=0, 00041 MIDISequencer *seq_=0 00042 ); 00043 00044 virtual ~MIDIManager(); 00045 00046 void Reset(); 00047 00048 // to set and get the current sequencer 00049 void SetSeq( MIDISequencer *seq ); 00050 MIDISequencer *GetSeq(); 00051 const MIDISequencer *GetSeq() const; 00052 00053 // to get the driver that we use 00054 MIDIDriver *GetDriver() 00055 { 00056 return driver; 00057 } 00058 00059 00060 // to set and get the system time offset 00061 void SetTimeOffset( unsigned long off ); 00062 unsigned long GetTimeOffset(); 00063 00064 // to set and get the sequencer time offset 00065 void SetSeqOffset( unsigned long seqoff ); 00066 unsigned long GetSeqOffset(); 00067 00068 00069 // to manage the playback of the sequencer 00070 void SeqPlay(); 00071 void SeqStop(); 00072 void SetRepeatPlay( 00073 bool flag, 00074 unsigned long start_measure, 00075 unsigned long end_measure 00076 ); 00077 00078 00079 // status request functions 00080 bool IsSeqPlay() const; 00081 bool IsSeqStop() const; 00082 bool IsSeqRepeat() const; 00083 00084 // inherited from MIDITick 00085 virtual void TimeTick( unsigned long sys_time ); 00086 00087 protected: 00088 00089 virtual void TimeTickPlayMode( unsigned long sys_time_ ); 00090 virtual void TimeTickStopMode( unsigned long sys_time_ ); 00091 00092 MIDIDriver *driver; 00093 00094 MIDISequencer *sequencer; 00095 00096 unsigned long sys_time_offset; 00097 unsigned long seq_time_offset; 00098 00099 volatile bool play_mode; 00100 volatile bool stop_mode; 00101 00102 MIDISequencerGUIEventNotifier *notifier; 00103 00104 volatile bool repeat_play_mode; 00105 long repeat_start_measure; 00106 long repeat_end_measure; 00107 00108 00109 }; 00110 00111 00112 } 00113 00114 #endif