00001 #ifndef __CVstTempo__ 00002 #define __CVstTempo__ 00003 00004 #include <Exceptions/CException.hpp> 00005 #include <audioeffectx.h> 00006 #include <Basics/CCountedObject.hpp> 00007 #include <Music/CTimeSignature.hpp> 00008 00009 // =========================================================================== 00010 00011 using Exponent::Exceptions::CException; 00012 using Exponent::Basics::CCountedObject; 00013 using Exponent::Music::CTimeSignature; 00014 00015 // =========================================================================== 00016 00017 namespace Exponent 00018 { 00019 namespace Vst 00020 { 00041 class CVstTempo : public CCountedObject 00042 { 00044 EXPONENT_CLASS_DECLARATION; 00047 // =========================================================================== 00048 00049 public: 00050 00055 struct SSongInformation 00056 { 00057 bool m_tempoIsValid; 00058 bool m_timeSignatureIsValid; 00059 bool m_ppqPositionIsValid; 00060 bool m_barPositionIsValid; 00061 bool m_samplesToNextBarIsValid; 00062 bool m_samplesPerBeatIsValid; 00064 bool m_transportChanged; 00065 bool m_transportIsPlaying; 00067 CTimeSignature m_timeSignature; 00068 double m_bpm; 00069 double m_ppqPosition; 00070 double m_barPosition; 00071 double m_samplePosition; 00073 long m_samplesToNextBar; 00074 long m_samplesPerBeat; 00079 void initialise() 00080 { 00081 m_tempoIsValid = false; 00082 m_timeSignatureIsValid = false; 00083 m_ppqPositionIsValid = false; 00084 m_barPositionIsValid = false; 00085 m_transportChanged = false; 00086 m_transportIsPlaying = false; 00087 m_samplesToNextBarIsValid = false; 00088 m_samplesPerBeatIsValid = false; 00089 m_bpm = 0.0; 00090 m_ppqPosition = 0.0; 00091 m_barPosition = 0.0; 00092 m_samplePosition = 0.0; 00093 m_samplesToNextBar = 0; 00094 m_samplesPerBeat = 0; 00095 m_timeSignature.setTimeSignature(4, 4); 00096 } 00097 }; 00098 00099 // =========================================================================== 00100 00101 const static long CVST_TEMPO_DEFAULT_VST_FLAGS = kVstTempoValid | kVstTransportChanged | kVstBarsValid | kVstPpqPosValid | kVstTimeSigValid; 00102 const static long CVST_TEMPO_TEMPO_ONLY_FLAG = kVstTempoValid; 00104 // =========================================================================== 00105 00109 CVstTempo(); 00110 00114 virtual ~CVstTempo(); 00115 00120 void initialiseFromAudioEffectX(AudioEffectX *theEffect); 00121 00122 // =========================================================================== 00123 00128 bool getTempoInformation(const long flags = CVST_TEMPO_DEFAULT_VST_FLAGS); 00129 00134 bool lastTempoIsValid() const { return m_lastTempoValid; } 00135 00140 SSongInformation *getSongInformation() const { return m_songInformation; } 00141 00142 // =========================================================================== 00143 00144 protected: 00145 00146 // =========================================================================== 00147 00148 AudioEffectX *m_theEffect; 00149 bool m_lastTempoValid; 00150 SSongInformation *m_songInformation; 00151 }; 00152 } 00153 } 00154 #endif // End of CVstTempo.hpp