VST Time Info


VstTimeInfo

struct VstTimeInfo

VstTimeInfo as requested via audioMasterGetTime (getTimeInfo ()) refers to the current time slice. note the new slice is already started when processEvents () is called.


samplePos

double samplePos;

Current location, Note that it may jump backwards in cycle mode. It must always be valid, and should not cost a lot to ask for. The sample pos is that of the sequencer ('unrolled', that means without cycle jumps). in sequencer stop mode, it simply continues to count. a 32 bit integer is too small for sample positions, and it's a double to make it easier to convert between ppq and samples.


sampleRate

double sampleRate;

It must always be valid, and should not cost a lot to ask for.


nanoSeconds

double nanoSeconds;

System Time related to samplePos (which is related to the first sample in the buffers passed to the process () methods). system time is derived from timeGetTime () on WINDOWS platforms, Microseconds () on MAC platform, UST for MOTIF, and BTimeSource::RealTime () for BEOS.


ppqPos

double ppqPos;

the quarter position related to samplePos. as this is a floating point value, it can be easily converted to any scale. provided that the tempo is also given, any linear positions (like samples, smpte) can also be calculated precisely.

Example :

At tempo 120, 1 quarter makes 1/2 second, so 2.0 ppq translates to 48000 samples at 48kHz sample rate.
.25 ppq is one sixteenth note then. if you need something like 480ppq, you simply multiply ppq by that scaler.


tempo

double tempo;

tempo in Beats Per Minute (no scaling).


barStartPos

double barStartPos;

In 1 pulse (unit) per quarter. Useful in conjunction with Time Signature, or to calculate a precise sample position of a beat or other measure.

Example :

Say we're at bars/beats readout 3.3.3. That's 2 bars + 2 q + 2 sixteenth, makes 2 * 4 + 2 + .25 = 10.25 ppq. at tempo 120, that's 10.25 * .5 = 5.125 seconds, times 48000 = 246000 samples (if my calculator servers me well :-).


cycleStartPos

double cycleStartPos;

locator positions in quarter notes. note the kVstTransportCycleActive flag.


cycleEndPos

double cycleEndPos;

locator positions in quarter notes. note the kVstTransportCycleActive flag.


timeSigNumerator

long timeSigNumerator;

Time Signature; 1/4 has timeSigNumerator == 1 and timeSigDenominator == 4.


timeSigDenominator

long timeSigDenominator;

Time Signature; 1/4 has timeSigNumerator == 1 and timeSigDenominator == 4.


smpteOffset

long smpteOffset;

in SMPTE subframes (bits; 1/80 of a frame). the current smpte position can be calculated using samplePos, sampleRate, and smpteFrameRate.


smpteFrameRate

long smpteFrameRate;

value frames
0 24
1 25
2 24
3 30
4 29.97 df
5 30 df

samplesToNextClock

long samplesToNextClock;

midi clock resolution (24 ppq), can be negative the distance to the next midi clock (24 ppq, pulses per quarter) in samples. unless samplePos falls precicely on a midi clock, this will either be negative such that the previous midi clock is addressed, or positive when referencing the following (future) midi clock.


flags

long flags;

see below


flags

enum flags;


kVstTransportChanged

kVstTransportChanged = 1

something has changed. this is not restricted to start/stop, or location changes but may also be set (once!) to indicate other changes like tempo, cycle state or positions etc.


kVstTransportPlaying

kVstTransportPlaying = 1 << 1

Sequencer is started (running).


kVstTransportCycleActive

kVstTransportCycleActive = 1 << 2

Cycle mode is active.


kVstAutomationWriting

kVstAutomationWriting = 1 << 6

Automation Write mode is activated.


kVstAutomationReading

kVstAutomationReading = 1 << 7

Automation Read mode is activated.


Flags which indicate which of the fields in this VstTimeInfo are valid. SamplePos and sampleRate are always valid.


kVstNanosValid

kVstNanosValid = 1 << 8

The nanoSeconds field in this VstTimeInfo is valid (or requested from getTimeInfo).


kVstPpqPosValid

kVstPpqPosValid = 1 << 9

the ppqPos field in this VstTimeInfo is valid (or requested from getTimeInfo ()).


kVstTempoValid

kVstTempoValid = 1 << 10

the tempo field in this VstTimeInfo is valid (or requested from getTimeInfo ()).


kVstBarsValid

kVstBarsValid = 1 << 11

the barStartPos field in this VstTimeInfo is valid (or requested from getTimeInfo ()).


kVstCyclePosValid

kVstCyclePosValid = 1 << 12

the cycleStartPos and cycleEndPos fields in this VstTimeInfo are valid (or requested from getTimeInfo ()).


kVstTimeSigValid

kVstTimeSigValid = 1 << 13

the timeSigNumerator and timeSigDenominator fields in this VstTimeInfo are valid (or requested from getTimeInfo ()).


kVstSmpteValid

kVstSmpteValid = 1 << 14

the smpteOffset and smpteFrameRate fields in this VstTimeInfo are valid (or requested from getTimeInfo ()).


kVstClockValid

kVstClockValid = 1 << 15

the samplesToNextClock field in this VstTimeInfo is valid (or requested from getTimeInfo ()).


getTimeInfo (->host)

virtual VstTimeInfo* getTimeInfo (long filter);

A Plug will request time info by calling the function getTimeInfo(long mask) which returns a VstTimeInfo pointer (or NULL if not implemented by the host). The mask parameter is composed of the same flags which will be found in the flags field of VstTimeInfo when returned, that is, if you need information about tempo, the parameter passed to getTimeInfo should have the kVstTempoValid flag set.

This request and delivery system is important, as a request like this may cause significant calculations at the application's end, which may take a lot of our precious time. This obviously means you should only set those flags that are required to get the information you need. Also please be aware that requesting information does not necessarily mean that that information is provided in return. Check the flags field in the VstTimeInfo structure to see if your request was actually met.

filter A mask indicating which fields are requested, as some items may require extensive conversions. See the flags in VstTimeInfo.
return A pointer to a VstTimeInfo structure or null if not implemented by the host.

tempoAt (->host)

virtual long tempoAt (long position);

Gets the tempo at position. Note that this call may cause heavy calculations on the application side.

position Sample frame.
return Tempo (in bpm * 10000).

Sample position and other time info can be obtained though VstTimeInfo.



Copyright ©2003 Steinberg Media Technologies GmbH. All Rights Reserved.