Old 04-05-2019, 05:27 AM   #361
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by Edgemeal View Post
Seems once a context menu or an input dialog is open the script stops running code and only continues when they are closed, not sure how you get around that, multiple scripts maybe?
That's my approach to get rid of the csv-comma-limitation of GetUserInputs.
Still working on the details, though.


BTW, is there a command, with which I would be able to add a gui-element to a window? Like "CB_ADD" or something?
I would love to add buttons and checkboxes and I think, there must be a way, but have no clue if at all.
Edit again: this looks promising so I'll experiment with that: https://cboard.cprogramming.com/wind...nt-window.html
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 04-05-2019 at 06:18 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 04-05-2019, 07:47 AM   #362
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

Quote:
Originally Posted by Breeder View Post
Maybe try with autohotkey...

See, looks quite easy...it's mostly for one time only usage because you want your windows to be at the same position at all times etc...unless of course you want it to be reusable - then you will have to invest a bit more time

P.S.
Don't forget to use "Active Window Info (Windows Spy)" that comes installed with AHK. You can easily see which coordinates to use for MouseClick commands with it...
Okay, I'm back at this again today. I was trying to figure out how to get a menu item selected. There isn't an example of this in your code, and I've had a hard time finding documentation, as AHK is SO wide-ranging in its use.

But it occurred to me that maybe I can use a mouse-down, mouse-move, mouse-up combo to do that, so I'll try that today...

I've also had a strange problem with window spy popping up a window that indicates it's recording, whenever I try to freeze the values to copy them.
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 04-05-2019, 11:25 AM   #363
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Posts: 2,436
Default

Quote:
Originally Posted by woodslanding View Post
But it occurred to me that maybe I can use a mouse-down, mouse-move, mouse-up combo to do that, so I'll try that today...
That's how I used it too - I can't offer proper help here cause I've used it just a couple of times for small and simple tasks so for me it was enough just to send mouse and keyboard commands without other AHK stuff. Everything else I forgot as soon as the script was done xd

I'm sure you'll figure it out - it's good knowledge to have when it comes to Windows in general and may prove useful for all sorts of stuff in the long run.
Breeder is offline   Reply With Quote
Old 04-06-2019, 02:56 AM   #364
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

Hey guys,

I am trying to make a script that adds comments in the Source Media tab of the project bay. Its my first attempt to use the js_window functions so i think i need some help here.

I downloaded "Control ID Under Mouse" by Edgemeal (thanks!) and i cant see the "comment" field in the source media tab has an ID (its just a big SysListView32 ID that includes all the columns you can see on this tab). If you double click on Comment though, another window pops up and this one has an id (1007).

I thought of a reaper.JS_Window_Find + reaper.JS_Window_FindChildByID combo script but that wont work cause it seems the new comment window is not a child of the Project Bay window.

Any idea on how to approach this? Thanks!

Oh...would be great to have a look at several scripts that play with those kind of things so i dont have to ask here again and again, so if you can point some of these out i´d be happy to investigate a little bit.
reapero is offline   Reply With Quote
Old 04-08-2019, 09:01 AM   #365
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by mespotine View Post
Is it okay, when I put your function into my Ultraschall-API? It could be quite useful for many others as well...
Hmmm, sending keys from script may not always work as expected! If user launches the script via keyboard that uses a modifier key like the Control key then when the script sends a key it will actually be detected by REAPER as Control + the key the script is sending! (I've even used this quirk to my advantage in one personal script.)

For example, Since there isn't a way to select a listview item I was sending arrow keys to the Undo History listview, if I launch the script with F9 key it works great, but if launched with say Control+F9 then REAPER detects the keys as Control+Arrow keys and the selected track volume gets nudged instead.

EDIT: Workaround idea to prevent script from sending a modifier key plus normal keys (like Arrow down) the script itself is sending,...
Code:
-- If Control or Shift pressed then wait until user releases the key(s)!
::chkKeys::
cntrl = reaper.JS_Mouse_GetState(4)
shift = reaper.JS_Mouse_GetState(8)
if cntrl == 4 or shift == 8 then goto chkKeys end
-- If ALT key pressed then my script won't work correctly, so just warn and exit!
alt = reaper.JS_Mouse_GetState(16)
if alt == 16 then
  reaper.MB("Its best NOT to use ALT key to launch this script!", "WARNING", 0)
else
  Main()
end
reaper.defer(function () end)

Last edited by Edgemeal; 04-08-2019 at 10:27 PM. Reason: workaround idea
Edgemeal is offline   Reply With Quote
Old 04-09-2019, 07:32 AM   #366
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

@juliansader

I've worked yesterday with HWNDs again, toying around with them on Mac as well and I may have a solution for your "function crashes on Mac, when passing non existing window"-problem.
Before checking, whether a hwnd is a valid hwnd, I check first, using ValidatePtr, whether the identifier is an existing HWND*-identifier at all.

See the following Lua-code:

Code:
function IsValidHWND(HWND)
  if reaper.ValidatePtr(HWND, "HWND*")==false then return false end
  if pcall(reaper.JS_Window_GetTitle, HWND, "")==false then return false end
  return true
end
Maybe this works as well in C, so you can get rid of the no-hwnd-crashes-Reaper-problem for Mac that way.
My tests on Windows and Mac were very promising...
__________________
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 04-09-2019, 08:23 AM   #367
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by mespotine View Post
Before checking, whether a hwnd is a valid hwnd, I check first, using ValidatePtr, whether the identifier is an existing HWND*-identifier at all.
if reaper.ValidatePtr(HWND, "HWND*")==false then return false end
Wow! Does this really work? I didn't know that "HWND*" is a valid argument for ValidatePtr, and I have in fact submitted a FR for precisely this: ReaScript: ValidatePtr type "Window*", to prevent crashes.

Checking the validity of a HWND before calling a function such as GetTitle is indeed what I do in my own scripts, using MIDIEditor_GetMode or JS_Window_IsWindow. (MIDIEditor_GetMode has been fixed on macOS in the recent REAPER update.) As I mention in the FR, IsWindow is fortunately faster I expected, so it shouldn't affect the responsiveness of scripts. (Although, DockIsChildOfDock is still about 10x faster.)

EDIT: I just check, and "HWND" works! (without the "*", since the "H" already implies a pointer.) Sheesh, why isn't this important feature documented?

EDIT 2: Googled this, and found:
Quote:
Originally Posted by Justin View Post
Yeah it allows unknown types... which PCM_Source* is. PCM_source* only works (at the moment) if the PCM_source exists in the current project. Fixing that to also include PCM_Source_CreateFromFile() via Lua/EEL (Lua/EEL scripts are accidentally completely permissive for invalid PCM_sources, which is the cause of the hang issue).

ValidatePtr("HWND") should already work, calling IsWindow(), which may be of limited usefulness (IsWindow() should be avoided really)

Last edited by juliansader; 04-09-2019 at 08:36 AM.
juliansader is offline   Reply With Quote
Old 04-09-2019, 08:34 AM   #368
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

It doesn't check for a valid HWND, afaik, but it returns, if a identifier points to a valid and existing object in general.
If you put this before your check for a valid hwnd, this should prevent the no hwnd available problem.

So still both are needed but at least, it worked
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 04-09-2019 at 08:59 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 04-09-2019, 08:58 AM   #369
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Oh, and while I'm at it: I tried to change the font-style in the console, using WM_SETFONT but for some reasons, this didn't work on Mac. Could this be a bug in your extension or in Swell?
If the latter, I'll open a bug-report on that.
__________________
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 04-09-2019, 03:19 PM   #370
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

How do you unpack JS_VKeys_GetState data ?

More general question, how to use it properly ? How to say for eg (I want to see if "R" is pressed ?" ?)

Last edited by X-Raym; 04-09-2019 at 03:25 PM.
X-Raym is offline   Reply With Quote
Old 04-09-2019, 09:30 PM   #371
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

In Lua, use string.byte() to access a specific key:

Code:
OK, state = reaper.JS_VKeys_GetState()
if state:byte(VirtualKeyCode) ~= 0 then ...
using virtual key codes.

Or compare an entire range:
Code:
zeroStr = string.rep("\0", 0xDE)
if state:sub(1,0xDE) ~= zeroStr then ...

Last edited by juliansader; 04-09-2019 at 09:48 PM.
juliansader is offline   Reply With Quote
Old 04-09-2019, 10:59 PM   #372
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

Can you also please show how to use new JS_Compositing?
Sexan is offline   Reply With Quote
Old 04-09-2019, 11:23 PM   #373
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

1) Get HWND of target REAPER window
2) Create LICE system bitmap. (System bitmaps can be blitted to windows. Non-system bitmaps can only be blitted to other LICE bitmaps.)
3) Composite the window and bitmap.
4) Whenever the window is re-painted, the bitmap will be blitted into the window (with per-pixel alpha blending).
5) To force a window to re-paint, use JS_Window_InvalidateRect.

Code:
editor = reaper.MIDIEditor_GetActive()
midiview = reaper.JS_Window_FindChildByID(editor, 1001)

bm = reaper.JS_LICE_LoadPNG("/path/to/PNG_transparency_demonstration_1.png")
w = reaper.JS_LICE_GetWidth(bm)
h = reaper.JS_LICE_GetHeight(bm)
sbm = reaper.JS_LICE_CreateBitmap(true, w, h)

t = 0
angle = 0
function loop()
    if reaper.ValidatePtr(midiview, "HWND") then
        local curTime = reaper.time_precise()
        if curTime > t+1/20 then
            t = curTime
            angle = angle+0.1
            reaper.JS_LICE_Clear(sbm, 0)
            reaper.JS_LICE_RotatedBlit(sbm, 0, 0, w, h, bm, 0, 0, w, h, angle, 0, 0, true, 1, "COPY")
            reaper.JS_Window_InvalidateRect(midiview, 0, 0, w, h, true) 
        end
        reaper.defer(loop)
    end
end

function exit()
    reaper.JS_Composite_Unlink(midiview, sbm)
    -- The extension will automatically unlink any destroyed bitmap,
    --    and will destroy any remaining bitmap when REAPER quits,
    --    so there shouldn't be memory leaks.
    reaper.JS_LICE_DestroyBitmap(bm) 
    reaper.JS_LICE_DestroyBitmap(sbm)
    -- Re-paint to clear the window
    if reaper.ValidatePtr(midiview, "HWND") then 
        reaper.JS_Window_InvalidateRect(midiview, 0, 0, w, h, true) 
    end
end

reaper.atexit(exit)

cOK = reaper.JS_Composite(midiview, 0, 0, w, h, sbm, 0, 0, w, h)
if cOK == 1 then
    loop()
end
juliansader is offline   Reply With Quote
Old 04-10-2019, 12:04 AM   #374
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

is this supposed to flicker like crazy when drawing? the image flickers
W10, reaper 5.972 your latest github dll x64



edit: upon restarting the script its little less but still flickers

anyway not sure if I've "port" it right for fillrect

https://raw.githubusercontent.com/Go...ha/Area_51.lua

Last edited by Sexan; 04-10-2019 at 12:41 AM.
Sexan is offline   Reply With Quote
Old 04-10-2019, 03:14 AM   #375
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@juliansader


Many thanks !


You just open the door of continuous push shortcuts !



X-Raym is offline   Reply With Quote
Old 04-10-2019, 07:02 AM   #376
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Could you elaborate what's different to assigning scripts to keys in the action list?
When using this method, scripts are also executed constantly.

And can we also assign modifier keys?
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-10-2019, 07:21 AM   #377
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Quote:
Could you elaborate what's different to assigning scripts to keys in the action list?
Keyboard shortcut or toolbar button trigger a script when run.


This script run in backward to allow to do certain things if a key is press, if a key / multuple is released, or if a key is maintained, or if a key is maintained other a certain period of time. A bit more scenarios are possible then, it is not press-to-run.

See the thread I linked for more infos :P

Exemple usage : display a toolbar only WHILE a key is pressed.
X-Raym is offline   Reply With Quote
Old 04-10-2019, 07:25 AM   #378
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Ahhh! So it's a toggle (on key down)! Like the "SWS/BR Toggle play from edit cursor and solo item and track under mouse for DURATION", right?
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-10-2019, 07:42 AM   #379
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@_Stevie_
Not a toggle, more like SWS/BR: Play from mouse cursor position and solo item and track under mouse for the duration (perform until shortcut released)
X-Raym is offline   Reply With Quote
Old 04-10-2019, 07:47 AM   #380
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Sorry, that's what I meant! Looked up the wrong action
Well, that's totally awesome. I might have to adjust a lot of scripts haha.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-10-2019, 07:50 AM   #381
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@Stevie
It works well with toggle action cause you can have the aciton toggle a keydown, and toggle back at key up :P
I invite you to join the thread I link above for more detail above this,


and keep this thread for more direct question on js_reascriptAPI extension :P
X-Raym is offline   Reply With Quote
Old 04-10-2019, 08:00 AM   #382
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

You are right! Will jump on that thread. I'm drowning in tabs... La galère!
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 04-10-2019, 01:04 PM   #383
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

Is you guys ready for the start of something beautiful ? Thanks to this awesome extension, this is the very early area selection script




Btw I still need help fixing this graphics voodoo,its on my github

Required: latest Julians extension API from github

Hardcoded "DEL"key to delete stuff in area selection for testing

Last edited by Sexan; 04-10-2019 at 02:06 PM.
Sexan is offline   Reply With Quote
Old 04-10-2019, 01:17 PM   #384
nappies
Human being with feelings
 
nappies's Avatar
 
Join Date: Dec 2017
Posts: 302
Default

Sexan, really nice!This can drastically change the workflow. I hope that Julian or some guys will help you with it!
nappies is offline   Reply With Quote
Old 04-10-2019, 03:06 PM   #385
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Cool, Sexan do you have also an Alk2 workflow ready for Reaper? Possibly done using action items or action takes? A take named !40046 would trigger that action for example. Same as with action markers. Then it could be easily possible each item itself could tell what should happen with it, action wise, the fact all actions are built into the item itself, and not into the markers, makes it easy to duplicate, and you can get same concept elsewhere in arrange.

As Alk2 is working track based, such action items on various tracks, would be a good starting point. The item actions could tell something like, start record for 8 bars, then stop record.
TonE is offline   Reply With Quote
Old 04-11-2019, 02:30 AM   #386
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@TonE
use Heda script to create markers from items in real time. this will solve your issue.
X-Raym is offline   Reply With Quote
Old 04-11-2019, 04:26 AM   #387
Embass
Human being with feelings
 
Embass's Avatar
 
Join Date: Jan 2014
Posts: 923
Default

Is there a better way to get trackview window?

I want to get this window:
https://drive.google.com/file/d/12L8...ew?usp=sharing

My script:
https://drive.google.com/file/d/1yqw...ew?usp=sharing
Embass is offline   Reply With Quote
Old 04-11-2019, 04:56 AM   #388
Embass
Human being with feelings
 
Embass's Avatar
 
Join Date: Jan 2014
Posts: 923
Default

I can get ref to track object like this:
Track_obj = reaper.JS_Window_GetLongPtr(track_window_handle, "USERDATA")

Is there a way to get track window handle from track obj?

I'm talking about this window:
https://drive.google.com/file/d/1D7l...ew?usp=sharing
Embass is offline   Reply With Quote
Old 04-11-2019, 08:26 AM   #389
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Thanks X-Raym, how are you using it? Thanks also to HeDA for implementing and sharing it!
Do you have the name of the script, so I can test it?
Got it, HeDA Regions&Markers from Items v0.96, needs track names like Markers 300, and item note text will be used as marker text.
Did a quick test with !40046 in item notes. If the empty item is at time = 0, it does not work, but moving it a bit to the right it works. It might be possible action markers at time = 0 have problems in general. Anyway, seems to work, thanks for the hint. This opens up new creative options, e.g. implementing something like Alk2 inside Reaper, or even better stuff, as there is no end to actions as we all know. If there are two tracks at same time position I guess both actions would run, or just one of them, anyway those are corner cases, not so important for now. It seems action markers have problem at loop start, no matter on which time position. So looping and action markers seems to be troublesome. I like how muting empty items also removes/mutes the action markers, very cool. So you do not have to delete them, just mute them, later bring them back if you want or need them again.

As there are note on, note off, cool would be having similarly action on, action off*, when item ends action off would be run, e.g. stop recording, action on could run start recording, as the simplest useful example. Not sure how I can achieve this now using only a single item? I guess we need new actions like, start recording and stop recording after n bars. For n = 1,2,4,8,16 at least, meaning 5 new actions. Most powerful would be an action like start rec and stop record at item end. Combining this with add a new track from track template n, then start-stop recording is already all you need, together with automatic arming of selected tracks enabled. You can load any track template, thus any sound you wish, you can record for the duration of the item length, and it is open to infinity, as it adds the 'track space' it needs, just by adding a new track, so does not depend on any prepared arrangement, only those empty items need to be arranged, where you want to record which track template, and rest would happen automatically. I think this is more or less the Alk2 concept.

* Thanks to a hint of ashcat_lt this is possible via midi notes in items used together with MIDIReaControlPath.

Last edited by TonE; 04-12-2019 at 11:14 AM.
TonE is offline   Reply With Quote
Old 04-11-2019, 09:47 AM   #390
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

Julian can you please give me a hand with this graphics/bliting stuff? I really do not understand the concept what to blit how to blit and when to blit
Sexan is offline   Reply With Quote
Old 04-11-2019, 10:08 AM   #391
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@Sexan
As Shakespear said:

"To blit or not to blit... That is the question."
X-Raym is offline   Reply With Quote
Old 04-11-2019, 10:24 AM   #392
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

"Whether 'tis more performant in the script to suffer the tearing and aliasing of outrageous redraws, or to take pixels from a sea of frame buffers and, by blitting, render them"
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 04-11-2019, 10:39 AM   #393
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

haha, and then we have my epileptic blit

blitting shit around like there is no tomorrow, everything over everything
Sexan is offline   Reply With Quote
Old 04-11-2019, 10:55 AM   #394
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Sexan View Post
Julian can you please give me a hand with this graphics/bliting stuff? I really do not understand the concept what to blit how to blit and when to blit
Are you referring to the new JS_Composite functions, or GDI and LICE blitting in general?

The idea behind the JS_Composite functions are discussed in the FR thread Extension API: Link LICE bitmap to REAPER window, for seamless integration into UI. The functions are an experimental attempt to hack this feature until Cockos implements them natively.

As I noted in the FR thread, in my own tests, the compositing seems to work very well on Linux and macOS, but unfortunately still glitches on Windows. As far as I can tell, the larger the bitmap, the more it glitches when the window or the LICE bitmap is animated, as you discovered in the post above.

Another approach is to use GDI to write directly to a window in each defer cycle. Strangely, this does not work at all in Linux, and only works in some window on macOS.
juliansader is offline   Reply With Quote
Old 04-11-2019, 11:07 AM   #395
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

JS_Composite, this issue is what I had before with GDI and LICE also, then you did some magic and it stopped.

Right now I'm not even sure if I captured the Reaper screen to blit with fillrect.

This is the original version with GDI/LICE AFTER you fixed this same issue I'm having above (post #85 and #89 page 3) but now with new API:


I suspect I'm copying same screen again and again with new API. But maybe this is not even possible with new API ?

Last edited by Sexan; 04-11-2019 at 11:14 AM.
Sexan is offline   Reply With Quote
Old 04-11-2019, 11:29 AM   #396
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

anyway did this gentleman did something different (something that can help you code wise) with marquee zoom?

https://github.com/reaper-oss/sws/blob/master/Zoom.cpp

He is also using WM_PAINT to draw

EDIT:
Cannot properly test,but as I see there is also some flicker when scrolling while the zoom is activated so I've guess the same issue is there

Last edited by Sexan; 04-11-2019 at 11:39 AM.
Sexan is offline   Reply With Quote
Old 04-12-2019, 11:17 AM   #397
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Quote:
Originally Posted by Sexan View Post
haha, and then we have my epileptic blit

blitting shit around like there is no tomorrow, everything over everything
Seems like Reaper arrange moving towards Photoshop, cool. You could paint over existing items using different colors, and based on painted colors something would happen.
TonE is offline   Reply With Quote
Old 04-12-2019, 02:52 PM   #398
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

v0.982 has been uploaded, with new audio functions by Xenakios!

(Except for Linux x64, since I haven't been able to figure out how to get Travis CI to compile with std=c++14 on Linux x64.)

EDIT: Got Linux x64 working.

Last edited by juliansader; 04-13-2019 at 03:18 AM.
juliansader is offline   Reply With Quote
Old 04-12-2019, 03:09 PM   #399
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Sexan View Post
Julian can you please give me a hand with this graphics/bliting stuff? I really do not understand the concept what to blit how to blit and when to blit
I think the trick the minimize glitching (on WindowsOS) is to make the blitting as fast and simple as possible. On v0.982, I tried the following, and it worked well with practically no glitching:

Create a very simple transparent bitmap, and then, in the draw function, instead of changing the bitmap, change the destination RECT:

Code:
bm = reaper.JS_LICE_CreateBitmap(true, 1, 1)
reaper.JS_LICE_Clear(bm, 0x77AA0000)
Replace this:
Code:
  reaper.JS_LICE_Clear(combineBmp, 0)
  reaper.JS_LICE_Blit(combineBmp, 0, 0, ASbmp, 0, 0, 5000, 5000, 1, "COPY" ) 
  reaper.JS_LICE_FillRect(combineBmp, aX,aY,aW,aH, 0xFF0000, 0.5, "COPY")
  reaper.JS_Window_InvalidateRect(track_window, 0, 0, W, H, true)
with:
Code:
  reaper.JS_Composite(track_window, aX, aY, aW, aH, bm, 0, 0, 1, 1)
  reaper.JS_Window_InvalidateRect(track_window, 0, 0, W, H, true)
juliansader is offline   Reply With Quote
Old 04-12-2019, 03:51 PM   #400
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

You da maaaaaan! Working beautifully!

EDIT: Updated version on Github if anyone wants to play with it (you can only delete stuff ATM, but maybe someone is really excited about that.... you never know...)

Thank you very much Julian! da maaaaaaaan!

And it's not even hitting ANY cpu

Last edited by Sexan; 04-12-2019 at 04:38 PM.
Sexan 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 06:47 PM.


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