OpenShot Library | libopenshot-audio 0.2.0
juce_AudioPlayHead.h
1
2/** @weakgroup juce_audio_basics-audio_play_head
3 * @{
4 */
5/*
6 ==============================================================================
7
8 This file is part of the JUCE library.
9 Copyright (c) 2017 - ROLI Ltd.
10
11 JUCE is an open source library subject to commercial or open-source
12 licensing.
13
14 The code included in this file is provided under the terms of the ISC license
15 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16 To use, copy, modify, and/or distribute this software for any purpose with or
17 without fee is hereby granted provided that the above copyright notice and
18 this permission notice appear in all copies.
19
20 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22 DISCLAIMED.
23
24 ==============================================================================
25*/
26
27namespace juce
28{
29
30//==============================================================================
31/**
32 A subclass of AudioPlayHead can supply information about the position and
33 status of a moving play head during audio playback.
34
35 One of these can be supplied to an AudioProcessor object so that it can find
36 out about the position of the audio that it is rendering.
37
38 @see AudioProcessor::setPlayHead, AudioProcessor::getPlayHead
39
40 @tags{Audio}
41*/
43{
44protected:
45 //==============================================================================
46 AudioPlayHead() = default;
47
48public:
49 virtual ~AudioPlayHead() = default;
50
51 //==============================================================================
52 /** Frame rate types. */
54 {
55 fps23976 = 0,
56 fps24 = 1,
57 fps25 = 2,
58 fps2997 = 3,
59 fps30 = 4,
60 fps2997drop = 5,
61 fps30drop = 6,
62 fps60 = 7,
63 fps60drop = 8,
64 fpsUnknown = 99
65 };
66
67 //==============================================================================
68 /** This structure is filled-in by the AudioPlayHead::getCurrentPosition() method.
69 */
71 {
72 /** The tempo in BPM */
73 double bpm;
74
75 /** Time signature numerator, e.g. the 3 of a 3/4 time sig */
77 /** Time signature denominator, e.g. the 4 of a 3/4 time sig */
79
80 /** The current play position, in samples from the start of the timeline. */
82 /** The current play position, in seconds from the start of the timeline. */
84
85 /** For timecode, the position of the start of the timeline, in seconds from 00:00:00:00. */
87
88 /** The current play position, in units of quarter-notes. */
90
91 /** The position of the start of the last bar, in units of quarter-notes.
92
93 This is the time from the start of the timeline to the start of the current
94 bar, in ppq units.
95
96 Note - this value may be unavailable on some hosts, e.g. Pro-Tools. If
97 it's not available, the value will be 0.
98 */
100
101 /** The video frame rate, if applicable. */
103
104 /** True if the transport is currently playing. */
106
107 /** True if the transport is currently recording.
108
109 (When isRecording is true, then isPlaying will also be true).
110 */
112
113 /** The current cycle start position in units of quarter-notes.
114 Note that not all hosts or plugin formats may provide this value.
115 @see isLooping
116 */
118
119 /** The current cycle end position in units of quarter-notes.
120 Note that not all hosts or plugin formats may provide this value.
121 @see isLooping
122 */
124
125 /** True if the transport is currently looping. */
127
128 //==============================================================================
129 bool operator== (const CurrentPositionInfo& other) const noexcept;
130 bool operator!= (const CurrentPositionInfo& other) const noexcept;
131
132 void resetToDefault();
133 };
134
135 //==============================================================================
136 /** Fills-in the given structure with details about the transport's
137 position at the start of the current processing block. If this method returns
138 false then the current play head position is not available and the given
139 structure will be undefined.
140
141 You can ONLY call this from your processBlock() method! Calling it at other
142 times will produce undefined behaviour, as the host may not have any context
143 in which a time would make sense, and some hosts will almost certainly have
144 multithreading issues if it's not called on the audio thread.
145 */
146 virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0;
147
148 /** Returns true if this object can control the transport. */
149 virtual bool canControlTransport() { return false; }
150
151 /** Starts or stops the audio. */
152 virtual void transportPlay (bool shouldStartPlaying) { ignoreUnused (shouldStartPlaying); }
153
154 /** Starts or stops recording the audio. */
155 virtual void transportRecord (bool shouldStartRecording) { ignoreUnused (shouldStartRecording); }
156
157 /** Rewinds the audio. */
158 virtual void transportRewind() {}
159};
160
161} // namespace juce
162
163/** @}*/
A subclass of AudioPlayHead can supply information about the position and status of a moving play hea...
virtual bool canControlTransport()
Returns true if this object can control the transport.
FrameRateType
Frame rate types.
virtual void transportPlay(bool shouldStartPlaying)
Starts or stops the audio.
virtual void transportRecord(bool shouldStartRecording)
Starts or stops recording the audio.
virtual bool getCurrentPosition(CurrentPositionInfo &result)=0
Fills-in the given structure with details about the transport's position at the start of the current ...
virtual void transportRewind()
Rewinds the audio.
#define JUCE_API
This macro is added to all JUCE public class declarations.
This structure is filled-in by the AudioPlayHead::getCurrentPosition() method.
int timeSigDenominator
Time signature denominator, e.g.
double ppqPositionOfLastBarStart
The position of the start of the last bar, in units of quarter-notes.
double ppqLoopEnd
The current cycle end position in units of quarter-notes.
int timeSigNumerator
Time signature numerator, e.g.
double ppqLoopStart
The current cycle start position in units of quarter-notes.
bool isPlaying
True if the transport is currently playing.
double ppqPosition
The current play position, in units of quarter-notes.
FrameRateType frameRate
The video frame rate, if applicable.
bool isLooping
True if the transport is currently looping.
int64 timeInSamples
The current play position, in samples from the start of the timeline.
double editOriginTime
For timecode, the position of the start of the timeline, in seconds from 00:00:00:00.
double timeInSeconds
The current play position, in seconds from the start of the timeline.
bool isRecording
True if the transport is currently recording.