03-30-2020, 10:38 AM | #1 |
Human being with feelings
Join Date: Mar 2018
Posts: 14
|
Oscilloscope tweak
I made a small tweak to the Decorative Oscilloscope with Blitter code. I've only applied it to mode 0, the horizontal mode, but it could easily be adapted to the vertical mode as well... the circular version would be trickier.
I've added in a "prevy" variable that keeps track of the y position of the previous dot. Then instead of drawing a square dot, it draws a rectangle the height of the difference between the current and previous, thus completing the lines so you don't have floating dots. It looks pretty nice on point count = full width of video and point size = 3. Code:
) : ( //this is the main loop for mode 0 loop(dotcount, getpt(); xp = project_w * (cx - 0.5 + i / dotcount); yp = project_h * (cy + (l+r)*.25*gain); i == 0 ? prevy = yp; top = min(yp, prevy); bot = max(yp, prevy); gfx_fillrect(xp-dotsize*.5,top-dotsize*.5,dotsize,dotsize+bot-top); prevy = yp; i+=1; ); ); Last edited by KeithHandy; 03-30-2020 at 11:11 AM. Reason: Add a photo |
04-06-2020, 07:12 AM | #2 | |
Human being with feelings
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
|
Quote:
Many thanks There is a syntax error in line 1 col 6. Maybe a copy and paste error? Edit: Ah I get it. This is a code to replace part of the main code that's shipped with Reaper. Greetings
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Last edited by Eliseat; 04-06-2020 at 07:20 AM. |
|
04-06-2020, 10:39 AM | #3 |
Human being with feelings
Join Date: Mar 2018
Posts: 14
|
Yeah, sorry for any lack of clarity on that. It's the third block of the if-then section that covers each of the three "modes".
|
04-07-2020, 02:35 AM | #4 |
Human being with feelings
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
|
No Problem. Its not forbidden to post original video plugin codes in this forum. Some of the shipped Reaper video presets were even posted here in the first place. So in cases like this its maybe a good idea to post the whole changed plugin code to avoid confusion. Its always better to keep everything as simple as possible.
Greetings from Cologne Eli Edit: So this creates a line rather then floating dots. Nice. Here is the full code Oscilloscope with Blitter (lines instead of dots): Code:
//Decorative Oscilloscope with Blitter (requires JSFX video sample peeker) //@gmem=jsfx_to_video //@param 1:mode "mode" 0 0 2 0 1 //@param 2:dotcount "point count" 1200 10 5000 400 10 //@param 3:dotsize "point size" 4 2 40 20 1 //@param 4:gain_db "gain (dB)" -6 -80 12 -12 1 //@param 5:zoom_amt "blitter zoom" .27 -.5 1 .1 0.01 //@param 6:fadespeed "blitter persist" .8 0 1 .1 0.01 //@param 7:filter "blitter filter" 1 0 1 0 1 //@param 8:fg_r "foreground R" 1 0 1 .5 .02 //@param 9:fg_g "foreground G" 1 0 1 .5 .02 //@param 10:fg_b "foreground B" 1 0 1 .5 .02 //@param 11:bg_r "background R" 0 0 1 .5 .02 //@param 12:bg_g "background G" 0 0 1 .5 .02 //@param 13:bg_b "background B" 0 0 1 .5 .02 //@param 14:cx "center X" .5 0 1 .5 .01 //@param 15:cy "center Y" .5 0 1 .5 .01 last_frame && fadespeed > 0 ? ( xo = project_w*zoom_amt*.25; yo = project_h*zoom_amt*.25; gfx_mode=filter>0?0x100:0; xo < 0 ? gfx_blit(last_frame,0); gfx_blit(last_frame,0,0,0,project_w,project_h,xo,yo,project_w-xo*2,project_h-yo*2); ); gfx_set(bg_r,bg_g,bg_b,last_frame ? (1-fadespeed) : 1); gfx_a>.001 ? gfx_fillrect(0,0,project_w,project_h); bufplaypos = gmem[0]; bufwritecursor = gmem[1]; bufsrate = gmem[2]; bufstart = gmem[3]; bufend = gmem[4]; nch = gmem[5]; gain = 10^(gain_db*(1/20)); dt=max(bufplaypos - project_time,0); dt*bufsrate < dotcount ? underrun_cnt+=1; rdpos = bufwritecursor - ((dt*bufsrate - dotcount)|0)*nch; rdpos < bufstart ? rdpos += bufend-bufstart; gfx_set(fg_r,fg_g,fg_b,1); function getpt() ( l = gmem[rdpos]; r = gmem[rdpos+1]; (rdpos += nch)>=bufend ? rdpos=bufstart; ); i=0; mode==2 ? ( loop(dotcount, getpt(); ang = atan2(l,r); dist = sqrt(sqr(l)+sqr(r)); xp = cx*project_w + ((cos(ang)*dist*gain)*project_h-dotsize)*.5; yp = ((cy*2+sin(ang)*dist*gain)*project_h-dotsize)*.5; gfx_fillrect(xp,yp, dotsize,dotsize); ); ) : mode == 1 ? ( loop(dotcount, getpt(); yp = project_h * (cy - .5 + i / dotcount); xp = project_w * (cx + (l+r)*.25*gain); gfx_fillrect(xp-dotsize*.5,yp-dotsize*.5, dotsize,dotsize); i+=1; ); ) : ( //this is the main loop for mode 0 loop(dotcount, getpt(); xp = project_w * (cx - 0.5 + i / dotcount); yp = project_h * (cy + (l+r)*.25*gain); i == 0 ? prevy = yp; top = min(yp, prevy); bot = max(yp, prevy); gfx_fillrect(xp-dotsize*.5,top-dotsize*.5,dotsize,dotsize+bot-top); prevy = yp; i+=1; ); ); gfx_img_free(last_frame); last_frame=gfx_img_hold(-1);
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Last edited by Eliseat; 04-07-2020 at 02:58 AM. |
Thread Tools | |
Display Modes | |
|
|