Hi antwan,
antwan wrote:How to use the VstTimeInfo flags. I was trying to read about this, but didn't quite understand. For instance if I'm interested in for example kVstTransportPlaying (as its called in the VST SDK... not sure if that constant is available in Usine SDK)?
The VstTimeInfoFlags enumeration isn't actually defined in the Usine SDK...
...but you can do it if needed by adding the following code before your YourModule class definition, in the YourModule.h file.
Directly from the VST SDK 2.4, in the plugin interface file aeffectx.h :
Code: Select all
//-------------------------------------------------------------------------------------------------------
/** Flags used in #VstTimeInfo. */
//-------------------------------------------------------------------------------------------------------
enum VstTimeInfoFlags
{
//-------------------------------------------------------------------------------------------------------
kVstTransportChanged = 1, ///< indicates that play, cycle or record state has changed
kVstTransportPlaying = 1 << 1, ///< set if Host sequencer is currently playing
kVstTransportCycleActive = 1 << 2, ///< set if Host sequencer is in cycle mode
kVstTransportRecording = 1 << 3, ///< set if Host sequencer is in record mode
kVstAutomationWriting = 1 << 6, ///< set if automation write mode active (record parameter changes)
kVstAutomationReading = 1 << 7, ///< set if automation read mode active (play parameter changes)
kVstNanosValid = 1 << 8, ///< VstTimeInfo::nanoSeconds valid
kVstPpqPosValid = 1 << 9, ///< VstTimeInfo::ppqPos valid
kVstTempoValid = 1 << 10, ///< VstTimeInfo::tempo valid
kVstBarsValid = 1 << 11, ///< VstTimeInfo::barStartPos valid
kVstCyclePosValid = 1 << 12, ///< VstTimeInfo::cycleStartPos and VstTimeInfo::cycleEndPos valid
kVstTimeSigValid = 1 << 13, ///< VstTimeInfo::timeSigNumerator and VstTimeInfo::timeSigDenominator valid
kVstSmpteValid = 1 << 14, ///< VstTimeInfo::smpteOffset and VstTimeInfo::smpteFrameRate valid
kVstClockValid = 1 << 15 ///< VstTimeInfo::samplesToNextClock valid
//-------------------------------------------------------------------------------------------------------
};
The way to use it is not Usine or SDK related, but more C language knowledge
To understand and using it, it's little more complex, i'll try to stay simple
kVstXXXXXXXX in the enum are bite mask, coded with the
Bitwise Left Shift operator. I let you follow the link for precisions...
but finally, the kVstTransportPlaying variable contain '000000000000010' (so, one bite left shifted by on), ok ?
And to extract the info from the flags, you use the
Bitewise AND operator (link for precisions)
so :
Code: Select all
if (pTriggerButtonTest->pMasterInfo->pTimeInfo->flags & kVstTransportPlaying) {
...
}
where pTriggerButtonTest->pMasterInfo->pTimeInfo->flags & kVstTransportPlaying is TRUE if the flags second bite from the right contain 1, that is.
Hope it's not too complex, welcome in C world
It's not finish, but i have a question.
Now, we have a test who return true when the host sequencer is playing, but what you want to do exactly, detecting when it begin to play ?