|
|
|
01-12-2015, 02:09 PM
|
#121
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
Thanks Justin! I will have to do it via script, unfortunately there is no windows frame menu in OSX.
|
|
|
01-12-2015, 02:18 PM
|
#122
|
Human being with feelings
Join Date: Mar 2009
Posts: 370
|
Maybe a bit more old school, but wouldn't
AddTrackFX_ByName(MediaTrack* track, int fx, str fxname)
a sweet thing to have ?
|
|
|
01-12-2015, 02:22 PM
|
#123
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,924
|
Quote:
Originally Posted by Justin
The script can do it via script (so you can do it in response to gfx.getchar() being the right character, or add a context menu item). Also a right click in the window frame (at least in win32) has the menu item by default.
|
Win7-64 has the menu too.
>
|
|
|
01-12-2015, 02:30 PM
|
#124
|
Human being with feelings
Join Date: Mar 2011
Location: London
Posts: 1,211
|
Quote:
Originally Posted by planetnine
Win7-64 has the menu too.
|
Yes, because Win7-64 uses win32 too.
|
|
|
01-13-2015, 08:23 AM
|
#125
|
Human being with feelings
Join Date: Feb 2011
Posts: 159
|
spk77, here's a new version for layouting.
There's two new classes Widget and Container.
Each gui element should be a subclass of Widget.
The Container can layout either vertically or horizontally.
If you want to use this stuff, feel free to ask for help.
|
|
|
01-13-2015, 10:28 AM
|
#126
|
Human being with feelings
Join Date: Jan 2007
Location: Erfurt
Posts: 784
|
nice, but why everything in pink?
|
|
|
01-13-2015, 10:37 AM
|
#127
|
Human being with feelings
Join Date: Feb 2011
Posts: 159
|
For debugging purposes. All containers (and, uh, buttons, too) have a pink backgroud. Comment line 307 to make it less pink.
|
|
|
01-13-2015, 12:46 PM
|
#128
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by kuus0
spk77, here's a new version for layouting.
There's two new classes Widget and Container.
Each gui element should be a subclass of Widget.
The Container can layout either vertically or horizontally.
If you want to use this stuff, feel free to ask for help.
|
Thanks!
Here's a little update for "Button class": https://stash.reaper.fm/22921/button.zip
(It's the same script you posted, only the Button class is updated)
- added these (methods?):
- Button:set_color(r,g,b,a)
f.ex. play_btn:set_color(1,1,0,0.5)
- Button:set_label_color(r,g,b,a)
f.ex. play_btn:label_color(1,1,1,1)
- If some function is "attached" to a button, the attached function is executed when lmb is released on the button. (otherwise it's cancelled):
(By the way, how to keep the button labels centered?)
Last edited by spk77; 01-13-2015 at 12:56 PM.
|
|
|
01-13-2015, 01:01 PM
|
#129
|
Human being with feelings
Join Date: Jan 2007
Location: Erfurt
Posts: 784
|
Quote:
Originally Posted by spk77
Thanks!
Here's a little update for "Button class": https://stash.reaper.fm/22921/button.zip
(It's the same script you posted, only the Button class is updated)
- added these (methods?):
- Button:set_color(r,g,b,a)
f.ex. play_btn:set_color(1,1,0,0.5)
- Button:set_label_color(r,g,b,a)
f.ex. play_btn:label_color(1,1,1,1)
- If some function is "attached" to a button, the attached function is executed when lmb is released on the button. (otherwise it's cancelled):
(By the way, how to keep the button labels centered?)
|
the look is completely different in OSX
|
|
|
01-13-2015, 01:08 PM
|
#130
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by axel_ef
the look is completely different in OSX
|
Sorry, these lines were commented out while making the gif:
line 60:
Code:
function Rect:draw()
gfx.set(1,0,1,.2)
--gfx.rect(self.x, self.y, self.w, self.h);
gfx.set(0,0,1,1)
end
line 184:
Code:
function Widget:draw()
self.rect:draw()
x2 = (self.rect.w - self.min_w) / 2 + self.rect.x
--gfx.rect(x2, self.rect.y, self.min_w, self.rect.h);
end
(Play and stop button colors are randomized)
Last edited by spk77; 01-13-2015 at 01:14 PM.
|
|
|
01-13-2015, 01:58 PM
|
#131
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
|
|
|
01-15-2015, 08:06 AM
|
#132
|
Human being with feelings
Join Date: Feb 2011
Posts: 159
|
Quote:
Originally Posted by spk77
|
Cool, making progress!
Here's a new version of the button thing.
There's a lot of things I've changed. Two main things are:
- 'Notify lists': They are used to notify listeners about changes. There's a mouse listener thing using these lists (starting at line 564). The implementation should be pretty easy to follow. You can add a functions which are called when mouse button went down/up or when the mouse cursor has moved.
- Parameter lists to the Button as a table. Now you can say Button({label="Play", help_text="plays it", onClick = function ...}). I would take this further with colors, e.g. fg=Color(1,0,1,1) (There's no color object yet).
Ask if you have any questions.
|
|
|
01-15-2015, 11:45 AM
|
#133
|
Human being with feelings
Join Date: Aug 2013
Posts: 1,355
|
So who's doing a file browser?
|
|
|
01-15-2015, 12:00 PM
|
#134
|
Human being with feelings
Join Date: Feb 2011
Posts: 159
|
Quote:
Originally Posted by Lazarus
So who's doing a file browser?
|
Be my guest
I see only os.execute, is there no other way to access directories?
|
|
|
01-15-2015, 12:04 PM
|
#135
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by Lazarus
So who's doing a file browser?
|
Who is doing a MCP window with RMS meters?
|
|
|
01-15-2015, 01:24 PM
|
#136
|
Human being with feelings
Join Date: Jun 2009
Location: South, UK
Posts: 14,214
|
Quote:
Originally Posted by heda
Who is doing a MCP window with RMS meters?
|
hmmm... RMS meters.. yes please!
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
|
|
|
01-15-2015, 02:39 PM
|
#137
|
Human being with feelings
Join Date: Aug 2013
Posts: 1,355
|
Quote:
Originally Posted by kuus0
I see only os.execute, is there no other way to access directories?
|
Well, it looks like lfs has 5.3 support now so it would probably be best for file stuff to have that compiled in with Reaper. I see there is a way with io.popen dir/ls to get info though.
Quote:
Be my guest
|
Err... oh look, there's my bus.....
|
|
|
01-18-2015, 02:51 AM
|
#138
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Compress or expand selected envelope points
Quote:
Originally Posted by kuus0
Cool, making progress!
Here's a new version of the button thing.
There's a lot of things I've changed. Two main things are:
- 'Notify lists': They are used to notify listeners about changes. There's a mouse listener thing using these lists (starting at line 564). The implementation should be pretty easy to follow. You can add a functions which are called when mouse button went down/up or when the mouse cursor has moved.
- Parameter lists to the Button as a table. Now you can say Button({label="Play", help_text="plays it", onClick = function ...}). I would take this further with colors, e.g. fg=Color(1,0,1,1) (There's no color object yet).
Ask if you have any questions.
|
Thanks again! For some reason, importing "notify-list.lua" doesn't work on my computer...My scripts are in C:\REAPER\scripts.
Here's a tool for compressing/expanding selected "track volume" or "track volume pre-fx" envelopes:
https://stash.reaper.fm/22960/Compres...e%20points.lua
(I think this works in the same way as SWS/FNG: Compress/expand amplitude of selected envelope points around midpoint)
Couldn't get "Undo" working correctly yet. I'm trying to add an undo point exactly in the same way as in "MIDI velocity tool" (it works in that script but not in this Lua script)
|
|
|
01-18-2015, 12:58 PM
|
#139
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Hmmm... math.log10(number value) doesn't seem to work...
If I try...
Code:
x = math.log10(100)
...I get
Code:
... scripts\Compress or expand selected envelope points.lua:340: attempt to call a nil value (field 'log10')
math.log(number value) seems to work.
math.log10
Return the base 10 logarithm of a given number. The number must be positive.
> = math.log10(100)
2
|
|
|
01-18-2015, 01:42 PM
|
#140
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Post#141 updated - "Undo bug" is now fixed.
Now it creates an undo point when lmb is released:
This works:
Code:
reaper.Undo_OnStateChangeEx("Compress or expand envelope points", -1, -1)
I use this at the end of the mainloop:
Code:
-- add undo point if necessary
if undo_block == 1 and compress.mouse_state == 0 then
undo_block = 0
reaper.Undo_OnStateChangeEx("Compress or expand envelope points", -1, -1)
end
"undo_block" flag is set when dragging starts.
Last edited by spk77; 01-18-2015 at 01:50 PM.
|
|
|
01-18-2015, 01:47 PM
|
#141
|
Human being with feelings
Join Date: Feb 2011
Posts: 159
|
I don't know what you're doing, but it looks interesting
Can't find log10 in here:
http://www.lua.org/manual/5.3/manual.html
Try this instead:
The notify-list.lua has to be somewhere in cpath:
Code:
reaper.ShowConsoleMsg(package.cpath)
EDIT: It's package.path, not cpath. See Lazarus's comment below.
Last edited by kuus0; 02-01-2015 at 06:06 AM.
|
|
|
01-18-2015, 01:58 PM
|
#142
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by kuus0
I don't know what you're doing, but it looks interesting
|
Then there's at least two of us
Quote:
Originally Posted by kuus0
|
I think I have a wrong (older) manual in the bookmarks, thanks.
reaper.ShowConsoleMsg(package.cpath) shows:
C:\REAPER\?.dll;C:\REAPER\..\lib\lua\5.3\?.dll;C:\ REAPER\loadall.dll;.\?.dll
|
|
|
01-31-2015, 05:34 PM
|
#143
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
Quote:
Originally Posted by spk77
Here's a tool for compressing/expanding selected "track volume" or "track volume pre-fx" envelopes:
|
Hey cool, thanks for sharing!
I found it a bit too specific, though, supporting only track volume envelopes, so I quickly attempted to generalize it for all parameter envelopes, including take envelopes, simply by changing the volume-specific stuff:
line 162:
Code:
- env = reaper.GetSelectedTrackEnvelope(0)
+ env = reaper.GetSelectedEnvelope(0)
line 166 (changed only text):
Code:
- gfx.printf("Please select a 'Track volume envelope'")
+ gfx.printf("Please select an envelope")
lines 169-173 (commented out):
Code:
- if env_name ~= "Volume" and env_name ~= "Volume (Pre-FX)" then
- gfx.x = gui.error_msg_x
- gfx.y = gui.error_msg_y
- gfx.set(1,0,0,1)
- gfx.printf("Please select a 'Track volume envelope'") return end
+-- if env_name ~= "Volume" and env_name ~= "Volume (Pre-FX)" then
+-- gfx.x = gui.error_msg_x
+-- gfx.y = gui.error_msg_y
+-- gfx.set(1,0,0,1)
+-- gfx.printf("Please select a 'Track volume envelope'") return end
line 279 (changed only text):
Code:
- gfx.init("Compress or expand selected volume envelope points", 300, 120)
+ gfx.init("Compress or expand selected envelope points", 300, 120)
This seems to work ok - only did very limited testing, though.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
01-31-2015, 07:16 PM
|
#144
|
Human being with feelings
Join Date: Aug 2013
Posts: 1,355
|
Quote:
Originally Posted by kuus0
The notify-list.lua has to be somewhere in cpath:
Code:
reaper.ShowConsoleMsg(package.cpath)
|
Just a note to say that I missed this, but for future reference cpath is for binaries and path is for lua packages. That's why spk77's has dll Lua search things returned for cpath.
Another note is that if you want to add to it, then you can see that the final path does not have a semicolon after it so...
Code:
package.path=package.path..";".."C:\\blah\\?.lua"
..you need to precede it with the semicolon. Shown a bit too obviously above.
|
|
|
02-01-2015, 03:31 PM
|
#145
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by Banned
Hey cool, thanks for sharing!
I found it a bit too specific, though, supporting only track volume envelopes, so I quickly attempted to generalize it for all parameter envelopes, including take envelopes, simply by changing the volume-specific stuff:
|
I wasn't sure if it would "break" something - that's why it supports only track volume envelopes
(This doesn't handle the "Pan envelope" correctly: Pan envelope range = -1 to 1 AFAIR)
|
|
|
02-02-2015, 02:09 AM
|
#146
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
Quote:
Originally Posted by spk77
I wasn't sure if it would "break" something - that's why it supports only track volume envelopes
(This doesn't handle the "Pan envelope" correctly: Pan envelope range = -1 to 1 AFAIR)
|
You never know until you try. I hadn't tested it with pan yet. I think the parameter min/max values can (in many cases) be retrieved programmatically, though, so that might fix things.
I also quickly tried to add a slider for the 'center' value, but didn't succeed - I don't understand how to use your nifty pseudo-object for that yet.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
02-02-2015, 10:09 AM
|
#147
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
IDE bug: "Tab" key isn't working when editing EEL scripts, but it's working with Lua (Win XP32, REAPER v5pre8)
Now the envelope compressor tool should work with all track/take envelopes except mute/pitch envelopes:
(will upload the script soon - I'm trying to divide it into modules...having troubles with importing/paths...)
|
|
|
02-02-2015, 10:48 AM
|
#148
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Quote:
Originally Posted by spk77
Now the envelope compressor tool should work with all track/take envelopes except mute/pitch envelopes:
|
That's great spk77.
Looking forward to see your script and learn Lua.
We need more Lua examples devs!
|
|
|
02-02-2015, 01:29 PM
|
#149
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Does someone know if we can set take FX envelope and take FX envelope points with reascript ? (EDIT : and.... adding FX to take, in fact ! - or copy paste take FX with envelope)
I just see in GetTakeEnvelopeByName in the API.
@spk77
Very promising !
|
|
|
02-02-2015, 03:20 PM
|
#150
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by heda
That's great spk77.
Looking forward to see your script and learn Lua.
We need more Lua examples devs!
|
Quote:
Originally Posted by X-Raym
Does someone know if we can set take FX envelope and take FX envelope points with reascript ? (EDIT : and.... adding FX to take, in fact ! - or copy paste take FX with envelope)
I just see in GetTakeEnvelopeByName in the API.
@spk77
Very promising !
|
Thanks!
Lua examples would be nice. (Local vs global variables in Lua are a bit confusing to me)
I'm trying to figure out how to get the script path (ie "currently executing script" path)
Got this match pattern somewhere from the internet...
Code:
function msg(m)
return reaper.ShowConsoleMsg(tostring(m) .. "\n")
end
full_path = "x:\\a\\b\\c\\d.lua"
msg("Full path: " .. full_path)
msg("Filename removed: " .. full_path:match("(.*".."\\"..")"))
msg("\n")
output:
Code:
Full path: x:\a\b\c\d.lua
Filename removed: x:\a\b\c\
This seems to work for me (hope I'm doing this right...)
Adding script path to package path:
Code:
function msg(m)
return reaper.ShowConsoleMsg(tostring(m) .. "\n")
end
local info = debug.getinfo(1,'S');
reaper.ShowConsoleMsg("")
local full_script_path = info.source
msg("Full path: \n" .. full_script_path)
msg("\n")
local script_path = full_script_path:sub(2,-5) -- remove "@" and "file extension" from path name
msg("'@' and '.lua' removed: \n" .. script_path)
msg("\n")
package.path = package.path .. ";" .. script_path:match("(.*".."\\"..")") .. "?.lua"
msg("Package path: \n" .. package.path)
output:
Code:
Full path:
@C:\REAPER\Scripts\Lua scripts\Add script path to package_path\Add script path to package_path.lua
'@' and '.lua' removed:
C:\REAPER\Scripts\Lua scripts\Add script path to package_path\Add script path to package_path
Package path:
C:\REAPER\lua\?.lua;C:\REAPER\lua\?\init.lua;C:\REAPER\?.lua;C:\REAPER\?\init.lua;C:\REAPER\..\share\lua\5.3\?.lua;C:\REAPER\..\share\lua\5.3\?\init.lua;.\?.lua;.\?\init.lua;C:\REAPER\Scripts\Lua scripts\Add script path to package_path\?.lua
(the blue part is added to the package path)
Last edited by spk77; 02-02-2015 at 03:26 PM.
|
|
|
02-03-2015, 08:32 AM
|
#151
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Trying to make an OS detection function...could someone on Mac test this script, thank you.
It should output "True" on windows system and "False" on other OSes.
Code:
--Should return true on Windows systems (it checks the path separator)
function is_win_os()
return package.config:sub(1,1) == "\\"
end
reaper.ShowConsoleMsg(tostring(is_win_os()) .. "\n")
Last edited by spk77; 02-03-2015 at 08:40 AM.
|
|
|
02-03-2015, 08:47 AM
|
#152
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
Quote:
Originally Posted by spk77
Trying to make an OS detection function...
|
Doesn't this work from the Reaper API?
Code:
C: const char* GetOS()
EEL: bool GetOS(#retval)
Lua: string reaper.GetOS()
Python: String RPR_GetOS()
Returns "Win32", "Win64", "OSX32", "OSX64", or "Other"
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
02-03-2015, 08:49 AM
|
#153
|
Human being with feelings
Join Date: Dec 2011
Posts: 406
|
Works for me (false) on Mac 10.7.5
|
|
|
02-03-2015, 08:51 AM
|
#154
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by Xenakios
Doesn't this work from the Reaper API?
Code:
C: const char* GetOS()
EEL: bool GetOS(#retval)
Lua: string reaper.GetOS()
Python: String RPR_GetOS()
Returns "Win32", "Win64", "OSX32", "OSX64", or "Other"
|
Completely missed that function, thanks!
..and thanks for the testing, Nixon
|
|
|
02-03-2015, 01:12 PM
|
#155
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
IDE filename/path bug (Win32, reaper v5pre10) (Should these bug reports be posted in the "R5 Bug Reports here" -thread?):
Scandic alphabets in path/filenames don't work:
Here's "get_script_path" function:
Code:
function get_script_path()
local script_path = debug.getinfo(1,'S').source;
if reaper.GetOS() == "Win32" or reaper.GetOS() == "Win64" then
script_path = script_path:match("(.*".."\\"..")"):sub(2) -- remove "@"
else
script_path = script_path:match("(.*".."/"..")"):sub(2)
end
return script_path
end
-- test
reaper.ShowConsoleMsg(get_script_path())
Any better ways to get the script directory?
Last edited by spk77; 02-03-2015 at 01:21 PM.
|
|
|
02-03-2015, 03:50 PM
|
#156
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
BR_GetMouseCursorContext_MIDI
Just a quick demo of BR_GetMouseCursorContext_MIDI.
For some reason, I had to made +2 to output noteRow to make it seems lile "under the cursor" (that's why I speak about it here, I don't know if it's normal or not).
Here a demo with X-Raym_Select all MIDI notes with same pitch right of the mouse.eel, based on spk77's Select all MIDI notes and events at the right of the cursor
I don't know what do you think of that,
but I think it can be very useful why editing MIDI drums part !
Last edited by X-Raym; 02-04-2015 at 03:09 AM.
|
|
|
02-04-2015, 01:40 AM
|
#157
|
Human being with feelings
Join Date: Dec 2014
Posts: 417
|
Nice one X-Raym,
Just to let you know the link for the MIDI note select script isn't working, however I was able to get it by going to your github page.
A version that also retained any previous note selections would be nice.
|
|
|
02-04-2015, 03:05 AM
|
#158
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@NextLevel
Oh you are right, it is because I renamed the file
So here for you, to use with two shortcuts IN MIDI editor :
I also optimized the script from the post above.
BUT
As you can see on this GIF demo, BR_GetMouseCursorContext_MIDI doesn't seem very consistent between zoom levels... (that's why I added +2, but it broke when zooming. If noteRow is set to 0, then it is broken when zoom level is low)
Do you think I must report it somewhere ?
Last edited by X-Raym; 02-04-2015 at 03:11 AM.
|
|
|
02-04-2015, 08:54 AM
|
#159
|
Human being with feelings
Join Date: Jun 2009
Location: South, UK
Posts: 14,214
|
Is this possible?
Nice work again X-Raym!
So the "contents" of the audio item say slip leftwards with the "left edge" staying still but the "right edge" of that item shrinks by the same amount that you have slipped the item's contents by.
This should also be possible the other way too. If you make the item's "contents" slip rightwards the "left edge" of the item stays still but the "right edge" expands rightwards.
This would be so useful for sound design as I often want to slip a sound earlier or later but also increase or decrease the right edge to keep the exact same end time.
Anyone know?
If not, It's a mouse modifier request!
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
Last edited by musicbynumbers; 02-04-2015 at 10:14 AM.
|
|
|
02-04-2015, 09:20 AM
|
#160
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@musicbynumbers
Thanks you very much
Hmmm that's a totally different thing. I'm note sure to fully understand what you are looking for, but indeed, it looks like more a mouse modifier feature request !
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 08:53 AM.
|