Browse Source

Added loop position indicators to CurrentPositionInfo (only enabled in VSTs)

tags/2021-05-28
jules 13 years ago
parent
commit
46ae142d8a
4 changed files with 37 additions and 4 deletions
  1. +3
    -0
      modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm
  2. +3
    -0
      modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp
  3. +16
    -4
      modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  4. +15
    -0
      modules/juce_audio_processors/processors/juce_AudioPlayHead.h

+ 3
- 0
modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm View File

@@ -499,6 +499,9 @@ public:
info.ppqPositionOfLastBarStart = 0;
info.isPlaying = false;
info.isRecording = false;
info.isLooping = false;
info.ppqLoopStart = 0;
info.ppqLoopEnd = 0;
switch (lastSMPTETime.mType)
{


+ 3
- 0
modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp View File

@@ -722,6 +722,9 @@ protected:
info.isRecording = false;
info.ppqPosition = ticks / 960000.0;
info.ppqPositionOfLastBarStart = 0; //xxx no idea how to get this correctly..
info.isLooping = false;
info.ppqLoopStart = 0;
info.ppqLoopEnd = 0;
// xxx incorrect if there are tempo changes, but there's no
// other way of getting this info..


+ 16
- 4
modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp View File

@@ -655,7 +655,7 @@ public:
bool getCurrentPosition (AudioPlayHead::CurrentPositionInfo& info)
{
const VstTimeInfo* const ti = getTimeInfo (kVstPpqPosValid | kVstTempoValid | kVstBarsValid //| kVstCyclePosValid
const VstTimeInfo* const ti = getTimeInfo (kVstPpqPosValid | kVstTempoValid | kVstBarsValid | kVstCyclePosValid
| kVstTimeSigValid | kVstSmpteValid | kVstClockValid);
if (ti == nullptr || ti->sampleRate <= 0)
@@ -665,12 +665,12 @@ public:
if ((ti->flags & kVstTimeSigValid) != 0)
{
info.timeSigNumerator = ti->timeSigNumerator;
info.timeSigNumerator = ti->timeSigNumerator;
info.timeSigDenominator = ti->timeSigDenominator;
}
else
{
info.timeSigNumerator = 4;
info.timeSigNumerator = 4;
info.timeSigDenominator = 4;
}
@@ -713,7 +713,19 @@ public:
}
info.isRecording = (ti->flags & kVstTransportRecording) != 0;
info.isPlaying = (ti->flags & kVstTransportPlaying) != 0 || info.isRecording;
info.isPlaying = (ti->flags & (kVstTransportRecording | kVstTransportPlaying)) != 0;
info.isLooping = (ti->flags & kVstTransportCycleActive) != 0;
if ((ti->flags & kVstCyclePosValid) != 0)
{
info.ppqLoopStart = ti->cycleStartPos;
info.ppqLoopEnd = ti->cycleEndPos;
}
else
{
info.ppqLoopStart = 0;
info.ppqLoopEnd = 0;
}
return true;
}


+ 15
- 0
modules/juce_audio_processors/processors/juce_AudioPlayHead.h View File

@@ -106,6 +106,21 @@ public:
*/
bool isRecording;
/** The current cycle start position in pulses-per-quarter-note.
Note that not all hosts or plugin formats may provide this value.
@see isLooping
*/
double ppqLoopStart;
/** The current cycle end position in pulses-per-quarter-note.
Note that not all hosts or plugin formats may provide this value.
@see isLooping
*/
double ppqLoopEnd;
/** True if the transport is currently looping. */
bool isLooping;
//==============================================================================
bool operator== (const CurrentPositionInfo& other) const noexcept;
bool operator!= (const CurrentPositionInfo& other) const noexcept;


Loading…
Cancel
Save