Old 07-14-2020, 03:49 PM   #1
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default Need help with my demo script(solved)

Eliseat pointed out, that my demoscript in my VideoProcessor-docs doesn't work.

After working out, that I accidentally had a & written as & I made it work, but: only on the master track.

And I have no idea, why that is.

So here's the code. It should be able to turn the video on/off and, as I said, it works brillant on the master track, so I can turn the video on and off. But as soon as I put it onto a regular track, it doesn't work anymore.
For some reason, the blit-function doesn't do anything. I only manage to draw the black rectangle but that's it.

Even more strange: when I comment out the input_track-line, it still works on master-track.

It used to work, but it doesn't anymore and I'm somehow too stupid to figure it out.
Has anybody of you an idea?

Code:
        // A small demo-script that turns video on&off
        //@param 1:VideoOnOff 'Video Off(0) On(1)' 1 0 1 0.5 1

        frame=input_track(0); // variable frame set with the videoframe from the first 
                              // videoitem in the project at a given position
  
        gfx_fillrect(0,0,project_w,project_h); // deletes last frame, by putting a black rectangle on top of it
                                               // to prevent from having the last frame(s) be shown indefinately

        //Now, put the picture to the framebuffer -> outputting the video
        gfx_blit(frame,  // the current video-frame
                    1,   // don't preserve aspect-ratio
                    0,0, // put upper right corner of the video at position 0,0
                    project_w*VideoOnOff,project_h*VideoOnOff // size of the video width, height, 
                                                              //   multiplied by the VideoOnOff-Parameter
                                                              //   1=video squeezed to 100% height & width 
                                                              //   0=video squeezed to 0% height & width
                    );
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 07-18-2020 at 08:44 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-15-2020, 05:19 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Ok, I think I understood, what the problem is:

The function input_track does not return the input for the current-track, only the tracks above the current track, not even if I put -1 as parameter.
So the script works on track 2(if a video is playing in track 1) and the master-track but not on track 1, no matter if a video is playing on track 1 at all.

So I need to alter the script for my docs, as this is too complicated for a simple demo-script, that shall show some basics.

@eliseat
Thanks for pointing it out. I made the script wrong in the first place.
It also occurred to me, that I didn't document the @param-statements yet, so I will add them too.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-16-2020, 12:06 PM   #3
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Sorry, I didn't know this was such a complicated case. I thought this is your metier like the thousands of APIs you've created.

But it also would be great to have a starting point in video processor programming.

By the way. Many thanks for the fast reaction.
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Old 07-16-2020, 03:09 PM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

You're welcome

My API has the benefit to be in Lua. Coding in EEL2 is still more a mystery to me than anything else

I have plans though, to do some more stuff on the video-processor-end, including click-/ and draggable gui-elements in the video-processor-window at some point. I conceptually know, how to do it but I still have too much other stuff to do, until I can go into this.

But I'm looking forward to it, as the video-processor is still very "underharvested" yet
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-17-2020, 05:22 AM   #5
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Mespotine, maybe you should take a look at amalgamas black curtain code which works great and offers to move a black rectangle over the video background. Its not an on/off switch like your example was supposed to. But it could be a good base to find out, why your code doesn't work on video tracks but the master.

Here you go:
Code:
// Crop Image (optional let behind image through)
//@param1:w_size 'Horizontal Crop' 0 0 1 0.5 0.01
//@param2:x_pos 'Fine tune x_pos' 0 -1 1 0 0.01
//@param4:h_size 'Vertical Crop' 0 0 1 0.5 0.01
//@param5:y_pos 'Fine tune y_pos' 0 -1 1 0 0.01
//@param7:back 'Let back image' 0 0 1 0.5 1

back = back == 0 ? -5000 : 1;
gfx_blit(back);
input_info(0, w, h);
gfx_blit(0, 1, 
(w_size*w)/2, (h_size*h)/2, 
w - (w_size*w), h - (h_size*h), 
(w_size*w)/2 - x_pos*(w_size*w)/2, (h_size*h)/2 - y_pos*(h_size*h)/2, 
w - (w_size*w), h - (h_size*h) );
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Old 07-17-2020, 11:08 AM   #6
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,433
Default

Video on/off... maybe I am not getting what you are after, but is it not as simple as:

Code:
//@param 1:on_off 'video on/off' 0 0 1 0.5 1

src=0;

input_info(src,w,h) ? ( project_w = w; project_h = h; ); 

on_off ? gfx_blit(src) : gfx_fillrect(0, 0, project_w, project_h);
Or even simpler

Code:
//@param 1:on_off 'video on/off' 0 0 1 0.5 1

src=0;

input_info(src,w,h) ? ( project_w = w; project_h = h; ); 

on_off != 1 ? gfx_fillrect(0, 0, project_w, project_h);
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is online now   Reply With Quote
Old 07-17-2020, 11:28 AM   #7
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

The idea is to say, that many vp-presets work like:

1 Get the image

2 Do something with it(make the screen black or tilt the image or something)

3 Blit it

Yes, it could be done more compact but that would loose this conceptual idea behind most video processor presets.
It's written that way purely for educational reasons, not to be a perfect example of compact coding.
The idea must be understandable for people new to Eel, as Eel is a quite compact, yet hard to understand language. So I tried to avoid Eel-language principles as good as possible, as it's aimed to people completely new to video processor. .

I already worked out a new one so I will update that code online soon as well.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:07 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.