From 3b2498d74a5202538a5d74c1cfcea205fb63b73b Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 5 Sep 2007 12:57:13 +0000 Subject: [PATCH] --- .../audio/processors/juce_AudioPlayHead.h | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 src/juce_appframework/audio/processors/juce_AudioPlayHead.h diff --git a/src/juce_appframework/audio/processors/juce_AudioPlayHead.h b/src/juce_appframework/audio/processors/juce_AudioPlayHead.h new file mode 100644 index 0000000000..62602c1ba3 --- /dev/null +++ b/src/juce_appframework/audio/processors/juce_AudioPlayHead.h @@ -0,0 +1,124 @@ +/* + ============================================================================== + + This file is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright 2004-7 by Raw Material Software ltd. + + ------------------------------------------------------------------------------ + + JUCE can be redistributed and/or modified 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. + + JUCE 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 JUCE; if not, visit www.gnu.org/licenses or write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + ------------------------------------------------------------------------------ + + If you'd like to release a closed-source product which uses JUCE, commercial + licenses are also available: visit www.rawmaterialsoftware.com/juce for + more information. + + ============================================================================== +*/ + +#ifndef __JUCE_AUDIOPLAYHEAD_JUCEHEADER__ +#define __JUCE_AUDIOPLAYHEAD_JUCEHEADER__ + + +//============================================================================== +/** + A subclass of AudioPlayHead can supply information about the position and + status of a moving play head during audio playback. + + One of these can be supplied to an AudioProcessor object so that it can find + out about the position of the audio that it is rendering. + + @see AudioProcessor::setPlayHead, AudioProcessor::getPlayHead +*/ +class JUCE_API AudioPlayHead +{ +protected: + //============================================================================== + AudioPlayHead() {} + +public: + virtual ~AudioPlayHead() {} + + //============================================================================== + /** Frame rate types. */ + enum FrameRateType + { + fps24 = 0, + fps25 = 1, + fps2997 = 2, + fps30 = 3, + fps2997drop = 4, + fps30drop = 5, + fpsUnknown = 99 + }; + + //============================================================================== + /** This structure is filled-in by the AudioPlayHead::getCurrentPosition() method. + */ + struct CurrentPositionInfo + { + /** The tempo in BPM */ + double bpm; + + /** Time signature numerator, e.g. the 3 of a 3/4 time sig */ + int timeSigNumerator; + /** Time signature denominator, e.g. the 4 of a 3/4 time sig */ + int timeSigDenominator; + + /** The current play position, in seconds from the start of the edit. */ + double timeInSeconds; + + /** For timecode, the position of the start of the edit, in seconds from 00:00:00:00. */ + double editOriginTime; + + /** The current play position in pulses-per-quarter-note. + + This is the number of quarter notes since the edit start. + */ + double ppqPosition; + + /** The position of the start of the last bar, in pulses-per-quarter-note. + + This is the number of quarter notes from the start of the edit to the + start of the current bar. + + Note - this value may be unavailable on some hosts, e.g. Pro-Tools. If + it's not available, the value will be 0. + */ + double ppqPositionOfLastBarStart; + + /** The video frame rate, if applicable. */ + FrameRateType frameRate; + + /** True if the transport is currently playing. */ + bool isPlaying; + + /** True if the transport is currently recording. + + (When isRecording is true, then isPlaying will also be true). + */ + bool isRecording; + }; + + //============================================================================== + /** Fills-in the given structure with details about the transport's + position at the start of the current processing block. + */ + virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0; +}; + + +#endif // __JUCE_AUDIOPLAYHEAD_JUCEHEADER__