Browse Source

VST hosting: added support for more VST host time flags.

tags/2021-05-28
jules 13 years ago
parent
commit
3ff54f9c33
1 changed files with 44 additions and 6 deletions
  1. +44
    -6
      modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp

+ 44
- 6
modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp View File

@@ -902,7 +902,7 @@ public:
vstHostTime.timeSigDenominator = 4;
vstHostTime.sampleRate = rate;
vstHostTime.samplePos = 0;
vstHostTime.flags = kVstNanosValid; /*| kVstTransportPlaying | kVstTempoValid | kVstTimeSigValid*/;
vstHostTime.flags = kVstNanosValid | kVstAutomationWriting | kVstAutomationReading;
initialise();
@@ -973,10 +973,48 @@ public:
vstHostTime.barStartPos = position.ppqPositionOfLastBarStart;
vstHostTime.flags |= kVstTempoValid | kVstTimeSigValid | kVstPpqPosValid | kVstBarsValid;
if (position.isPlaying)
vstHostTime.flags |= kVstTransportPlaying;
VstInt32 newTransportFlags = 0;
if (position.isPlaying) newTransportFlags |= kVstTransportPlaying;
if (position.isRecording) newTransportFlags |= kVstTransportRecording;
if (newTransportFlags != (vstHostTime.flags & (kVstTransportPlaying | kVstTransportRecording)))
vstHostTime.flags = (vstHostTime.flags & ~(kVstTransportPlaying | kVstTransportRecording)) | newTransportFlags | kVstTransportChanged;
else
vstHostTime.flags &= ~kVstTransportChanged;
switch (position.frameRate)
{
case AudioPlayHead::fps24:
vstHostTime.smpteFrameRate = 0;
vstHostTime.smpteOffset = (long) (position.timeInSeconds * 80 * 24 + 0.5);
vstHostTime.flags |= kVstSmpteValid;
break;
case AudioPlayHead::fps25:
vstHostTime.smpteFrameRate = 1;
vstHostTime.smpteOffset = (long) (position.timeInSeconds * 80 * 25 + 0.5);
vstHostTime.flags |= kVstSmpteValid;
break;
case AudioPlayHead::fps30:
vstHostTime.smpteFrameRate = 3;
vstHostTime.smpteOffset = (long) (position.timeInSeconds * 80 * 30 + 0.5);
vstHostTime.flags |= kVstSmpteValid;
break;
default: break;
}
if (position.isLooping)
{
vstHostTime.cycleStartPos = position.ppqLoopStart;
vstHostTime.cycleEndPos = position.ppqLoopEnd;
vstHostTime.flags |= kVstCyclePosValid;
}
else
vstHostTime.flags &= ~kVstTransportPlaying;
{
vstHostTime.flags &= ~kVstCyclePosValid;
}
}
vstHostTime.nanoSeconds = getVSTHostTimeNanoseconds();
@@ -1456,7 +1494,7 @@ public:
if (i != oldProg)
{
const fxProgram* const prog = (const fxProgram*) (((const char*) (set->programs)) + i * progLen);
if (((const char*) prog) - ((const char*) set) >= dataSize)
if (((const char*) prog) - ((const char*) set) >= (ssize_t) dataSize)
return false;
if (vst_swap (set->numPrograms) > 0)
@@ -1471,7 +1509,7 @@ public:
setCurrentProgram (oldProg);
const fxProgram* const prog = (const fxProgram*) (((const char*) (set->programs)) + oldProg * progLen);
if (((const char*) prog) - ((const char*) set) >= dataSize)
if (((const char*) prog) - ((const char*) set) >= (ssize_t) dataSize)
return false;
if (! restoreProgramSettings (prog))


Loading…
Cancel
Save