Building on top of this script:
https://forum.cockos.com/showthread.php?t=170727
I used the global memory (gmem) to get the values from the stock REAPER smpte reader and feeding it to the Overlay window.
You put the smpte reader with this preset on your ltc track
and the video processor with the other preset on your video track.
Works great!
Here's the smpte preset:
Code:
desc:SMPTE LTC Send to Video Processor
//tags: utility visualization
in_pin:input
out_pin:none
slider1:0<0,3,1.0{30,24,25,29.97}>Frame Rate
options:gmem=lexa_smpte
@init
minthresh=10^(-80/20);
threshenv=exp(-1/(0.1*srate)); // 100ms
gfx_clear=-1;
syncstate=0;
itm1=otm1=0;
thresh = 1; // ~-10dB
lastsign=1;
sillen=0;
buf=0;
bufpos=0;
gotbit=-1;
syncpos=-1;
blitparmbuf=1000;
frates=2000;
frates[0]=30;
frates[1]=24;
frates[2]=25;
frates[3]=30*1000/1001;
@slider
pulsesize = (srate / frates[slider1] / (80.0 * 2.0));
@sample
// remove DC offset
otm1=0.999*otm1 + spl0 - itm1; itm1=spl0; s=otm1;
// s has DC offset removed sample
sillen+=1;
sillen > pulsesize * 2.2 ?
(
syncpos=-1;
sillen=0;
gotbit=-1;
syncstate=1;
);
thresh = thresh*threshenv + abs(s)*(1-threshenv);
thresh < minthresh?thresh=minthresh;
(s < -thresh*0.8 && lastsign > 0) || (s > thresh*0.8 && lastsign < 0) ? (
lastsign=-lastsign;
gotbit+=1;
sillen > pulsesize*1.8 ? // done with bit
(
gotbit=min(gotbit,1);
sillen=0;
buf[bufpos]=gotbit;
(bufpos += 1) >= 80 ? bufpos=0;
syncpos >= 0 ? syncpos += 1;
(syncpos < 0 || syncpos >= 80) ?
(
syncpos=-1;
// try to get sync
(
buf[(bufpos+64)%80]==0 &&
buf[(bufpos+65)%80]==0 &&
buf[(bufpos+66)%80]==1 &&
buf[(bufpos+67)%80]==1 &&
buf[(bufpos+68)%80]==1 &&
buf[(bufpos+69)%80]==1 &&
buf[(bufpos+70)%80]==1 &&
buf[(bufpos+71)%80]==1 &&
buf[(bufpos+72)%80]==1 &&
buf[(bufpos+73)%80]==1 &&
buf[(bufpos+74)%80]==1 &&
buf[(bufpos+75)%80]==1 &&
buf[(bufpos+76)%80]==1 &&
buf[(bufpos+77)%80]==1 &&
buf[(bufpos+78)%80]==0 &&
buf[(bufpos+79)%80]==1) ?
(
new_f=buf[(bufpos+0)%80]+
buf[(bufpos+1)%80]*2 +
buf[(bufpos+2)%80]*4 +
buf[(bufpos+3)%80]*8 +
10*(
buf[(bufpos+8)%80] +
buf[(bufpos+9)%80]*2;// +
// buf[(bufpos+10)%80]*4
);
new_s=buf[(bufpos+16)%80]+
buf[(bufpos+17)%80]*2 +
buf[(bufpos+18)%80]*4 +
buf[(bufpos+19)%80]*8 +
10*(
buf[(bufpos+24)%80] +
buf[(bufpos+25)%80]*2+
buf[(bufpos+26)%80]*4
);
new_m=buf[(bufpos+32)%80]+
buf[(bufpos+33)%80]*2 +
buf[(bufpos+34)%80]*4 +
buf[(bufpos+35)%80]*8 +
10*(
buf[(bufpos+40)%80] +
buf[(bufpos+41)%80]*2+
buf[(bufpos+42)%80]*4
);
new_h=(buf[(bufpos+48)%80]+
buf[(bufpos+49)%80]*2 +
buf[(bufpos+50)%80]*4 +
buf[(bufpos+51)%80]*8 +
10*(
buf[(bufpos+56)%80] +
buf[(bufpos+57)%80]*2
));
hours=new_h; minutes=new_m; seconds=new_s; frames=new_f;
gmem[1] = new_h;
gmem[2] = new_m;
gmem[3] = new_s;
gmem[4] = new_f;
new_time = ((hours*80 + minutes)*80+seconds)*100+frames;
syncpos=0;
syncstate=2;
) :
(
syncstate=0;
);
);
gotbit=-1;
);
);
Here's the Video Processor preset:
Code:
// Timecode overlay
font="Helvetica";
//@param1:size 'text height' 0.1 0.01 0.5 0.25 0.01
//@param2:ypos 'y position' 0.90 0 1 0.5 0.01
//@param3:xpos 'x position' 0.5 0 1 0.5 0.01
//@param4:border 'border' 0.03 0 1 0.5 0.01
//@param5:fgc 'text bright' 1.0 0 1 0.5 0.01
//@param6:fga 'text alpha' 1.0 0 1 0.5 0.01
//@param7:bgc 'bg bright' 0 0 1 0.5 0.01
//@param8:bga 'bg alpha' 0.5 0 1 0.5 0.01
//@gmem=lexa_smpte
offset = 3600*h_off + 60*m_off + s_off + f_off/framerate;
time_value = time / (ceil(framerate)/framerate) + offset;
hours = gmem[1];
minutes = gmem[2];
seconds = gmem[3];
frames = gmem[4];
#timecode = sprintf(#, "%02d:", hours);
#timecode += sprintf(#, "%02d:", minutes);
#timecode += sprintf(#, "%02d:", seconds);
#timecode += sprintf(#, "%02d", frames);
gfx_blit(0,1);
gfx_setfont(size*project_h,font,'');
gfx_str_measure(#timecode,txtw,txth);
yt = (project_h- txth*(1+border*2))*ypos;
gfx_set(bgc,bgc,bgc,bga);
gfx_fillrect(xpos * (project_w-txtw*(1+border*2)), yt, txtw*(1+border*2), txth*(1+border*2));
gfx_set(fgc,fgc,fgc,fga);
gfx_str_draw(#timecode,xpos * (project_w-txtw),yt+txth*border);