+ if (value & (kVstPpqPosValid)) {
+ timeinfo->ppqPos = ppqPos;
+ newflags |= kVstPpqPosValid;
+ }
+
+ if (value & (kVstBarsValid)) {
+ timeinfo->barStartPos = ppqBar;
+ newflags |= kVstBarsValid;
+ }
+
+ } catch (...) {
+ /* relax */
+ }
+ }
+
+ if (value & (kVstSmpteValid)) {
+ Timecode::Time t;
+
+ session->timecode_time (now, t);
+
+ timeinfo->smpteOffset = (t.hours * t.rate * 60.0 * 60.0) +
+ (t.minutes * t.rate * 60.0) +
+ (t.seconds * t.rate) +
+ (t.frames) +
+ (t.subframes);
+
+ timeinfo->smpteOffset *= 80.0; /* VST spec is 1/80th frames */
+
+ if (session->timecode_drop_frames()) {
+ if (session->timecode_frames_per_second() == 30.0) {
+ timeinfo->smpteFrameRate = 5;
+ } else {
+ timeinfo->smpteFrameRate = 4; /* 29.97 assumed, thanks VST */
+ }
+ } else {
+ if (session->timecode_frames_per_second() == 24.0) {
+ timeinfo->smpteFrameRate = 0;
+ } else if (session->timecode_frames_per_second() == 24.975) {
+ timeinfo->smpteFrameRate = 2;
+ } else if (session->timecode_frames_per_second() == 25.0) {
+ timeinfo->smpteFrameRate = 1;
+ } else {
+ timeinfo->smpteFrameRate = 3; /* 30 fps */
+ }
+ }
+ newflags |= (kVstSmpteValid);
+ }
+
+ if (session->actively_recording ()) {
+ newflags |= kVstTransportRecording;
+ }
+
+ if (plug->transport_speed () != 0.0f) {
+ newflags |= kVstTransportPlaying;
+ }
+
+ if (session->get_play_loop ()) {
+ newflags |= kVstTransportCycleActive;
+ Location * looploc = session->locations ()->auto_loop_location ();
+ if (looploc) try {
+ double ppqBar;
+ Timecode::BBT_Time bbt;
+
+ bbt = session->tempo_map ().bbt_at_frame_rt (looploc->start ());
+ timeinfo->cycleStartPos = vst_ppq (tm, bbt, ppqBar);
+
+ bbt = session->tempo_map ().bbt_at_frame_rt (looploc->end ());
+ timeinfo->cycleEndPos = vst_ppq (tm, bbt, ppqBar);
+
+ newflags |= kVstCyclePosValid;
+ } catch (...) { }