00001 #ifndef _JDKMIDI_ADVANCEDSEQUENCER_H 00002 00003 #define _JDKMIDI_ADVANCEDSEQUENCER_H 00004 00005 #include "jdkmidi/midi.h" 00006 #include "jdkmidi/msg.h" 00007 #include "jdkmidi/sysex.h" 00008 #include "jdkmidi/multitrack.h" 00009 #include "jdkmidi/filereadmultitrack.h" 00010 #include "jdkmidi/sequencer.h" 00011 #include "jdkmidi/manager.h" 00012 #include "jdkmidi/driver.h" 00013 00014 00015 #include "jdkmidi/driverdump.h" 00016 00017 #include <string> 00018 #include <vector> 00019 00020 #define MAX_WARP_POSITIONS (128) 00021 #define MEASURES_PER_WARP (4) 00022 00023 namespace jdkmidi 00024 { 00025 class AdvancedSequencer 00026 { 00027 public: 00028 AdvancedSequencer(); 00029 virtual ~AdvancedSequencer(); 00030 00031 bool OpenMIDI( int in_port, int out_port, int timer_resolution=5 ); 00032 void CloseMIDI(); 00033 00034 void SetMIDIThruEnable( bool f ); 00035 bool GetMIDIThruEnable() const; 00036 00037 void SetMIDIThruChannel( int chan ); 00038 int GetMIDIThruChannel() const; 00039 00040 void SetMIDIThruTranspose( int val ); 00041 int GetMIDIThruTranspose() const; 00042 00043 bool Load( const char *fname ); 00044 void Reset(); 00045 00046 void GoToMeasure( int measure, int beat=0 ); 00047 void GoToTime( MIDIClockTime t ); 00048 void Play( int clock_offset = 0 ); 00049 void RepeatPlay( bool enable, int start_measure, int end_measure ); 00050 void Pause(); 00051 void Stop(); 00052 00053 bool IsPlay() 00054 { 00055 return mgr.IsSeqPlay(); 00056 } 00057 00058 void UnmuteAllTracks(); 00059 void SoloTrack( int trk ); 00060 void UnSoloTrack(); 00061 void SetTrackMute( int trk, bool f ); 00062 00063 void SetTempoScale( double scale ); 00064 double GetTempoWithoutScale() const; 00065 double GetTempoWithScale() const; 00066 00067 int GetMeasure() const; 00068 int GetBeat() const; 00069 00070 int GetTimeSigNumerator() const; 00071 int GetTimeSigDenominator() const; 00072 00073 int GetTrackNoteCount( int trk ) const; 00074 const char *GetTrackName( int trk ) const; 00075 int GetTrackVolume( int trk ) const; 00076 00077 void SetTrackVelocityScale( int trk, int scale ); 00078 int GetTrackVelocityScale( int trk ) const; 00079 00080 void SetTrackRechannelize( int trk, int chan ); 00081 int GetTrackRechannelize( int trk ) const; 00082 00083 void SetTrackTranspose( int trk, int trans ); 00084 int GetTrackTranspose( int trk ) const; 00085 00086 void ExtractMarkers( std::vector< std::string > *list ); 00087 int GetCurrentMarker() const; 00088 00089 int FindFirstChannelOnTrack(int trk); 00090 00091 void ExtractWarpPositions(); 00092 00093 bool IsChainMode() const { return chain_mode; } 00094 00095 MIDIMultiProcessor thru_processor; 00096 MIDIProcessorTransposer thru_transposer; 00097 MIDIProcessorRechannelizer thru_rechannelizer; 00098 00099 MIDIDriverDump driver; 00100 00101 MIDIMultiTrack tracks; 00102 00103 00104 MIDISequencerGUIEventNotifierText notifier; 00105 00106 MIDISequencer seq; 00107 00108 MIDIClockTime marker_times[1024]; 00109 int num_markers; 00110 00111 MIDIManager mgr; 00112 00113 long repeat_start_measure; 00114 long repeat_end_measure; 00115 bool repeat_play_mode; 00116 00117 int num_warp_positions; 00118 MIDISequencerState *warp_positions[MAX_WARP_POSITIONS]; 00119 00120 bool file_loaded; 00121 bool chain_mode; 00122 }; 00123 00124 } 00125 00126 #endif