|
|
|
12-02-2018, 01:53 PM
|
#1761
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Quote:
Originally Posted by Swi
I will check all this out though. If there is a way to switch to a different snap setting the quantize then switch back, then that will likely work for me. I an auto zoom in then quantized then zoom out thing once but it was hard to look at and took too long.
|
Hmm, why don't you use my scrips: Script: sr_Quantize notes - 1-4.lua, sr_Quantize notes - 1-8, sr_Quantize notes - 1-16 ?
These quantize the notes (1/4, 1/8, 1/16) independently from the grid. The grid is not altered at all.
EDIT: they exist as triplet, swing and human versions (iterative Q in Cub-speech).
EDIT2: strangely, zooming out to see 32 bars worked the same as in the GIF. I'm sure it's some setting in your config.
|
|
|
12-02-2018, 02:13 PM
|
#1762
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
Quote:
Originally Posted by _Stevie_
...I'm sure it's some setting in your config.
|
Maybe. It goes to visible grid here too. I'm on windows 7 x64. I ran into this phenomenon when I went to write this script:
https://forum.cockos.com/showpost.ph...postcount=1555
It seemed to work on grid setting, regardless of visibility, if using the commented out lines.
|
|
|
12-02-2018, 02:13 PM
|
#1763
|
Human being with feelings
Join Date: Apr 2018
Posts: 358
|
Steve, thank you for responding to me. I am fairly frustrated with the quantizing function in general so please forgive me if I'm a little spikey.
To answer your question here, the reason is I get the same result when I am zoomed out that things just quantize to 1 bar or 2 bars depending on the zoom level. This is true for all of these scripts to quantize a 1/4 or 1/8 or 16th. I am trying to figure out why. Aside from that I just want to set the grid or the groove and quantize to the grid or groove.
I just want to hit Q and keep going.
I do use input quantize a lot but for some projects where the groove or swing amount is crucial, this does not really apply.
When doing film or TV stuff have stuff locked down to the grid is very useful for editing and doing notes, so input quantize is great for all the filmy type of stuff but if I'm making some dub or trap stuff then I want to set a groove for the project is crucial and switching back an forth between 33% swing and 11% swing, for example, can make all the difference if a hat and snare work together.
basically, I just want to set the groove for the project or piece of music I am working on and then simply hit the letter Q to execute quantize. The only way I have found for this to work is to have the midi editor open somewhere so I can see the grid and swing value that is currently set and I have a custom action to 1.select all events and 2.Quantize selected events.
This is the only way I have found that I can quantize quickly and knowingly but I still have to be sure the midi editor is the top window...
In addition
I would rather not have my midi editor open because when I do want it open I want it open on my main monitor in front of me, not on the right.
I like the interactive toolbar but it does not stay in my template so I have t load it every time I start a new session then find a proper place for it. which renders it more trouble than it's worth to me.
|
|
|
12-02-2018, 04:12 PM
|
#1764
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
I can imagine, that you are frustrated. This shouldn't work like that. As far as I know, Reaper can't link the zoom to the grid. For that reason, MPL wrote a script to achieve this. Do you maybe have one of these scripts running?
Zoom horizontally, change grid relatively, preserve grid visibility and snap state (mousewheel)
or
Zoom horizontally, change grid relatively (mousewheel)
What happens to the snap to grid dialog, when you zoom in / out?
Does the grid setting change?
Regarding MPLs interactive toolbar: no, you don't have to load it on every startup. Create a custom script and put all the scripts that you want to be loaded on startup and add the script to the SWS Startup actions (Extension -> Startup actions -> Set global start up action)
Last edited by _Stevie_; 12-02-2018 at 04:18 PM.
|
|
|
12-02-2018, 10:44 PM
|
#1765
|
Human being with feelings
Join Date: Apr 2018
Posts: 358
|
I will check out the startup actions for sure. Thanks for that.
I am using the "View:Zoom horizontally (MIDI CC realtive/mousewheel)" for zooming and not the others you mentioned.
My grid settings do not change when zooming
Oddly the new mpl 2.03 version of the quantize tool was working for about an hour (I'm not kidding) but while it was working the gui would not show up. So I had Q assigned to the mpl_Quantize Tool (background).lua script and it was quantizing to grid at any zoom level but the gui that usually opens would not open and somehow it would quantize the way your script does on your machine.
But then the gui came back and now that does not work?
So strange...
|
|
|
12-02-2018, 11:25 PM
|
#1766
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
|
Quote:
Originally Posted by Swi
But then the gui came back and now that does not work?
|
I don`t follow other threads, so it is better to write in a dedicated thread: https://forum.cockos.com/showthread.php?t=165672&page=4
Post there what you are trying to do + your current Quantize Tool preset (if you have GUI opened - from main script menu/Dump current preset cofiguration, otherwise - \Scripts\MPL Scripts\Various\mpl_QuantizeTool_presets\last_save d.qt)
Btw I added quantization preset you somewhere mentioned (MIDI notes to MPC70% SWS groove) as the example. Note, it is no GUI version. You need to load default preset (see Action list) to show GUI back and create/edit presets from script GUI.
Quote:
I am using the "View:Zoom horizontally (MIDI CC realtive/mousewheel)" for zooming and not the others you mentioned.
My grid settings do not change when zooming
|
There is nothing in action 'View:Zoom horizontally' name that says something about grid, so there is no reason to expect changing grid with it.
Last edited by mpl; 12-03-2018 at 01:54 PM.
|
|
|
12-03-2018, 01:32 PM
|
#1767
|
Human being with feelings
Join Date: Apr 2018
Posts: 358
|
Thank you.
I think it's time for a portable install. rebuild my prefs etc.
Thanks for the instruction on the quantize tool. Looking forward to getting all this to work properly.
|
|
|
12-03-2018, 02:13 PM
|
#1768
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Sounds like a good plan, I will check my scripts in the meanwhile. X-Raym gave me some hints.
|
|
|
12-04-2018, 08:31 AM
|
#1769
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
@Swi
I updated the quantize scripts in ReaPack. Update them and see if they work better, now.
|
|
|
12-05-2018, 10:15 AM
|
#1770
|
Human being with feelings
Join Date: Apr 2018
Posts: 358
|
Thank you
Thanks, Steve. I did an update last night and I get the same behavior.
I removed (and saved) my preferences folder (inside appdata/roaming) and booted up reaper then I imported everything but my reascripts from my previous configuration files added reapack and sws and I had the same issue.
Unless someone can tell me what not to install from my previous config files I will have to do this over and over again when I have time. I don't really have a day to figure this out.
Someone mentioned I should try a portable install but I just need to replace the version that is on my main daw. I don't understand how I would replace my main system install with a portable install when I have it done. I guess the advantage of the portable install is that I can go back and forth from it while I rebuild it?
This quantize function is the only thing that is giving me trouble and it is behaving the same for the me2beaset script the sr_script and the mpl_script. I will just quantize in the midi editor until I have time to start over from scratch but it seems very strange that this is my only problem. I am feeling like this issue is cased from a setting that I am just unfamiliar with.
Thank you again for all this.
Cheers
|
|
|
12-05-2018, 10:48 AM
|
#1771
|
Human being with feelings
Join Date: Apr 2018
Posts: 358
|
I do get reapack errors when I "synchronize packages"
They look like this
Stevie Scripts/MIDI Editor/Quantize notes (bundle) v1.32:
Conflict: Scripts\Stevie Scripts\MIDI Editor\sr_Quantize notes - grid.lua is already owned by another package
But I don't know how to resolve these errors. There are 100 errors mostly for scripts in the midi editor.
I may have imported or loaded these one at a time before I learned about reapack.
|
|
|
12-05-2018, 12:14 PM
|
#1772
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Anyone has a code snippet in Lua/EEL to count visible CC lanes in active MIDI editor? Would be lovely if you could share - thank you
|
|
|
12-05-2018, 02:29 PM
|
#1773
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
Quote:
Originally Posted by Breeder
Anyone has a code snippet in Lua/EEL to count visible CC lanes in active MIDI editor? Would be lovely if you could share - thank you
|
Currently the only child controls inside the piano container (text: "midipianoview", classname: "MIDIPianoWindow") are those CC ComboBoxes. So a quick hack would be to just count the children, you could get their text too.
REQUIRES: js_ReaScriptAPI extension
Tested: REAPER 5.963 & js_ReaScriptAPI v0.951
Code:
function print(str)
reaper.ShowConsoleMsg(tostring(str) .. "\n")
end
hWnd = reaper.MIDIEditor_GetActive()
if hWnd == nil then return end
child_hWnd = reaper.JS_Window_FindChild(hWnd, "midipianoview", true)
hWnd_array = reaper.new_array({}, 100)
reaper.JS_Window_ArrayAllChild(child_hWnd, hWnd_array)
child_hWnds = hWnd_array.table()
-- display count
print(#child_hWnds)
-- display controls text
for j = 1, #child_hWnds do
child_hWnds[j] = reaper.JS_Window_HandleFromAddress(child_hWnds[j])
title = reaper.JS_Window_GetTitle(child_hWnds[j], "", 64)
print(title)
end
Last edited by Edgemeal; 12-05-2018 at 02:34 PM.
|
|
|
12-05-2018, 02:35 PM
|
#1774
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by Edgemeal
Currently the only child controls inside the piano container (text: "midipianoview", classname: "MIDIPianoWindow") are those CC ComboBoxes. So a quick hack would be to just count the children, you could get their text too.
REQUIRES: js_ReaScriptAPI extension
Tested: REAPER 5.963 & js_ReaScriptAPI v0.51
Code:
function print(str)
reaper.ShowConsoleMsg(tostring(str) .. "\n")
end
hWnd = reaper.MIDIEditor_GetActive()
if hWnd == nil then return end
child_hWnd = reaper.JS_Window_FindChild(hWnd, "midipianoview", true)
hWnd_array = reaper.new_array({}, 20)
reaper.JS_Window_ArrayAllChild(child_hWnd, hWnd_array)
child_hWnds = hWnd_array.table()
-- display count
print(#child_hWnds)
-- display controls text
for j = 1, #child_hWnds do
child_hWnds[j] = reaper.JS_Window_HandleFromAddress(child_hWnds[j])
title = reaper.JS_Window_GetTitle(child_hWnds[j], "", 64)
print(title)
end
|
Thank you!!!
This is interesting, in SWS I used chunk parsing but that proved tiresome for reasons this solves. To be honest, I would rather use chunk parsing but I remember that there were some corner cases that needed solving and I'm too deep in work to test those. If nothing comes up I'll guess I'll settle for win32 solution.
I actually asked nofish to commit some old changes of mine that never made it to public SWS relese - they export tons of win32 API. Fingers crossed it makes it to final release so we don't have to rely on external extensions or various python/lua hacks for win32.
|
|
|
12-06-2018, 03:02 PM
|
#1775
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Quote:
Originally Posted by Swi
I do get reapack errors when I "synchronize packages"
They look like this
Stevie Scripts/MIDI Editor/Quantize notes (bundle) v1.32:
Conflict: Scripts\Stevie Scripts\MIDI Editor\sr_Quantize notes - grid.lua is already owned by another package
But I don't know how to resolve these errors. There are 100 errors mostly for scripts in the midi editor.
I may have imported or loaded these one at a time before I learned about reapack.
|
That's very strange. Have you retried in the meanwhile?
I would remove all my scripts and re-install them.
|
|
|
12-06-2018, 03:05 PM
|
#1776
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Quote:
Originally Posted by Swi
Thanks, Steve. I did an update last night and I get the same behavior.
I removed (and saved) my preferences folder (inside appdata/roaming) and booted up reaper then I imported everything but my reascripts from my previous configuration files added reapack and sws and I had the same issue.
Unless someone can tell me what not to install from my previous config files I will have to do this over and over again when I have time. I don't really have a day to figure this out.
Someone mentioned I should try a portable install but I just need to replace the version that is on my main daw. I don't understand how I would replace my main system install with a portable install when I have it done. I guess the advantage of the portable install is that I can go back and forth from it while I rebuild it?
This quantize function is the only thing that is giving me trouble and it is behaving the same for the me2beaset script the sr_script and the mpl_script. I will just quantize in the midi editor until I have time to start over from scratch but it seems very strange that this is my only problem. I am feeling like this issue is cased from a setting that I am just unfamiliar with.
Thank you again for all this.
Cheers
|
What I would try: install the portable version. It will install in a different folder and not touch your main Reaper installation at all.
Then, DON'T import your settings, start fresh, install SWS and ReaPack.
Then, test install the scripts and check if they work, now.
|
|
|
12-06-2018, 03:14 PM
|
#1777
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
Quote:
Originally Posted by Swi
Stevie Scripts/MIDI Editor/Quantize notes (bundle) v1.32:
Conflict: Scripts\Stevie Scripts\MIDI Editor\sr_Quantize notes - grid.lua is already owned by another package
|
A few months ago "Quantize notes - grid.lua" was available as its own package. Now it's part of "Quantize notes (bundle)". Looks like you have the old one still installed. Uninstalling the obsolete package from the package browser should allow the new one to install.
(By default, ReaPack v1.1+ asks to remove obsolete packages when synchronizing. The setting controlling this is in "Manage repositories" under Options.)
Last edited by cfillion; 12-06-2018 at 03:24 PM.
|
|
|
12-06-2018, 03:19 PM
|
#1778
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Ahh thanks Christian!
Man, you are reading everywhere and are always up to date with current scripts from contributors. That's insane!
|
|
|
12-07-2018, 12:35 AM
|
#1779
|
Human being with feelings
Join Date: Apr 2018
Posts: 358
|
This is awesome thank you guys
|
|
|
12-09-2018, 06:17 PM
|
#1780
|
Human being with feelings
Join Date: Apr 2018
Posts: 358
|
I must need to do a portable install. How do I move a portable install to my main install after I rebuild it though?
After updated reapack and reinstalling the quantize bundle
Steve your updated script does not work at all in the main window but it does work in the midi editor.
the "SWS/FNG: Quantize itme positions and midi note positions to grid" either crashed reaper or moves all the notes in the midi item to bar one beat one.
the "me2beast quantize midi note positions to project grid" works but only when I zoom in so the visibility is the same as the grid I want to quantize to.
I just updated the mpl_Quatize tool and it's working but only if I open the GUI and dial it in or it will use the last settings. This is okay but still a 2 step process.
It's weird that this seems to be my only issue. It just feels like a setting somewhere.
|
|
|
12-09-2018, 06:44 PM
|
#1781
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
Quote:
Originally Posted by Swi
the "SWS/FNG: Quantize itme positions and midi note positions to grid" either crashed reaper or moves all the notes in the midi item to bar one beat one.
|
Do you have the grid line spacing set to Frames, Measure and/or a non-zero project start offset by any chance?
macOS, Linux or Windows, 32 or 64-bit?
|
|
|
12-09-2018, 10:57 PM
|
#1782
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
|
Quote:
Originally Posted by Swi
I just updated the mpl_Quatize tool and it's working but only if I open the GUI and dial it in or it will use the last settings. This is okay but still a 2 step process.
|
No, you don`t need this.
Create custom action:
1) mpl_QuantizeTool preset - (MPL) Quantize item positions to project grid (no GUI).lua
2) mpl_Quantize Tool (background).lua
3) mpl_QuantizeTool preset - (MPL) Quantize item midi notes to project grid (no GUI).lua
4) mpl_Quantize Tool (background).lua
|
|
|
12-10-2018, 11:54 AM
|
#1783
|
Human being with feelings
Join Date: Apr 2018
Posts: 358
|
Hello all and thank you again.
I did rebuild everything from scratch. I removed everything did an uninstall of Reaper and started over.
I tried importing my setting vie the general/config area of the prefs but that ended up giving me the same issue.
I exported everything I could individually and took a lot of pics of my prefs and midi channel alias names and started over that way and everything worked as advertised but them when I opened my template I had the same issue as before.
I then copied and pasted my tracks from my template to a new empty project and it's all working so far.
To be fair when I started using Reaper I had imported a lot of prefs from a friend so perhaps some of the scripts in there were creating a conflict?
In any case, the problem solved for now. Thank you all.
I am running the reaper5963+dev1208_x64-install
|
|
|
12-10-2018, 06:51 PM
|
#1784
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Glad to hear Swi!
|
|
|
12-20-2018, 09:59 AM
|
#1785
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by Breeder
Anyone has a code snippet in Lua/EEL to count visible CC lanes in active MIDI editor? Would be lovely if you could share - thank you
|
To answer my own request
Code:
local function GetVisibleCCLanes (take)
local visibleLanes = {}
if take ~= nil then
local takeGuid = "GUID " .. reaper.BR_GetMediaItemTakeGUID(take)
local _, chunk = reaper.GetItemStateChunk(reaper.GetMediaItemTake_Item(take), "", false)
local takeGuidLineFound = 0
for line in chunk:gmatch("([^\n]*)\n?") do
-- MIDI take chunk starts with GUID - mark when found
if line == takeGuid then
takeGuidLineFound = 1
else
if takeGuidLineFound == 1 and line == "<SOURCE MIDI" then takeGuidLineFound = 2
elseif takeGuidLineFound >= 2 and line.sub(line, 1, 1) == "<" then takeGuidLineFound = takeGuidLineFound + 1
elseif takeGuidLineFound > 2 and line == ">" then takeGuidLineFound = takeGuidLineFound - 1
elseif takeGuidLineFound == 2 and line == ">" then takeGuidLineFound = 0
end
-- We're inside MIDI take chunk, search for CC lanes data
if takeGuidLineFound == 2 then
local lineTokens = {}
for token in line:gmatch("[^%s]+") do
lineTokens[#lineTokens + 1] = token
end
-- CC lane found, save it
if #lineTokens > 0 and lineTokens[1] == "VELLANE" then
local newLane = {lane = tonumber(lineTokens[2]), height = tonumber(lineTokens[3])}
local saveLane = true
for _, lane in ipairs(visibleLanes) do if lane.lane == newLane.lane then saveLane = false break end end
if saveLane == true then
visibleLanes[#visibleLanes + 1] = newLane
end
end
end
end
end
end
return visibleLanes
end
Last edited by Breeder; 12-20-2018 at 10:18 AM.
|
|
|
12-20-2018, 10:09 AM
|
#1786
|
Human being with feelings
Join Date: May 2009
Location: Montreal
Posts: 123
|
Request : JS version of ADT
Hi.
http://www.nullmedium.de/dev/audioplugins/
If someone could port/recreate that plugin to JS, that would be very appreciated! I don't know how to code...
Thanks in advance!
|
|
|
12-21-2018, 04:36 PM
|
#1787
|
Human being with feelings
Join Date: Feb 2014
Posts: 240
|
Quote:
Originally Posted by jnastic
|
Do you need this EXACT plug? If you just want to stereoize, there's a few JSFX chorus & pseudostereo
|
|
|
12-21-2018, 05:23 PM
|
#1788
|
Human being with feelings
Join Date: Jul 2009
Posts: 7,570
|
requests
for MIDI editor - action that selects the notes at the cursor position within grid size. Just want to use the mouse less, actually its more of a problem with a trackpad.
For file management - collect source media and copy to project media folder.
Essentially same as Project Media Bay function "Copy file to project media directory". but able to be run from Main action list.
|
|
|
12-22-2018, 10:03 AM
|
#1789
|
Human being with feelings
Join Date: May 2009
Location: Montreal
Posts: 123
|
Quote:
Originally Posted by junh1024
Do you need this EXACT plug? If you just want to stereoize, there's a few JSFX chorus & pseudostereo
|
No, not necessarily the exact plugin, but something that emulates it pretty closely. Or something that recreates the Mimiq Doubler ( https://www.tcelectronic.com/Categor...oogtrans(en|en))
I really like the separation it provides to guitars, especially with 2 amps in stereo.
It gives a little bit of movement, more subtle than chorus/delay.
I'll try other JS plugins, but I don't want to use Waves ADT or 3rd party plugins, if possible, at least, for now.
|
|
|
12-27-2018, 11:59 AM
|
#1790
|
Human being with feelings
Join Date: Nov 2010
Location: NY
Posts: 25
|
OSX script to make Reaper have mouse actions like Ableton
Im coming from ableton, and need help getting an Ableton Action script for Reaper on OSX. If anyone already made a script that pretty much makes Reaper behave like Ableton that would be cool to try
|
|
|
01-14-2019, 04:47 PM
|
#1791
|
Human being with feelings
Join Date: Apr 2018
Posts: 358
|
Save tracks as track template with items and envelopes to project folder
It would be so nice if there was an action to
Save selected tracks to track template, including items and envelopes, to project folder subdirectory track templates.
I know I can make another version of the session that has the tracks in it but it would be nice to just save it all this way too so I know where to look without opening several projects.
Helps to keep big session lean and fast after rendering.
|
|
|
01-30-2019, 11:22 PM
|
#1792
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Are my eyes deceiving me or there's no proper API function to delete a single take from item?
|
|
|
01-31-2019, 01:32 AM
|
#1793
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@Breeder
Weird Indeed,
But you can make the take active and the item as only selected and run the Remove active take action,
Or use mpl XML take parser
https://github.com/ReaTeam/ReaScript...TakeChunks.lua
Note that SWS could theorically bring this API function cause there is already some BR (:P) functions to delete takes, here is an extract:
Code:
SNM_TakeParserPatcher takePatcher(mouseInfo.GetItem());
takePatcher.RemoveTake(mouseInfo.GetTakeId());
|
|
|
01-31-2019, 01:37 AM
|
#1794
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by X-Raym
@Breeder
Weird Indeed,
But you can make the take active and the item as only selected and run the Remove active take action,
Or use mpl XML take parser
https://github.com/ReaTeam/ReaScript...TakeChunks.lua
Note that SWS could theorically bring this API function cause there is already some BR (:P) functions to delete takes, here is an extract:
Code:
SNM_TakeParserPatcher takePatcher(mouseInfo.GetItem());
takePatcher.RemoveTake(mouseInfo.GetTakeId());
|
I'm using my creative brain these days so I can only write simple code snippets - anything bigger and it makes me anxious and depressed (lol, but true) - I am hopping for ready-made solution
|
|
|
01-31-2019, 06:09 AM
|
#1795
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
|
I believe, something like this would work (disclaimer: chunking=not stable):
Code:
function ExtractTakeChunks(item)
local retval, chunk = reaper.GetItemStateChunk( item, '', false )
local item_body = chunk:match('<ITEM(.-)NAME')
local tk_chunk_section = chunk:match('(NAME.*)>')
local tk_t = {}
local tk = 0
for line in tk_chunk_section:gmatch('[^\r\n]+') do
if (line:match('NAME ') and tk ==0)
or (line:match('TAKE') and not line:match('TAKE%a'))
or line:match('TAKE SEL')
then tk=tk+1
end
if not tk_t[tk] then tk_t[tk] = '' end
tk_t[tk] = tk_t[tk]..'\n'..line
end
return item_body, tk_t
end
---------------------------------------
function ApplyTakeChunks(item,item_body, tk_chunks)
local set_ch = '<ITEM'..item_body..table.concat(tk_chunks,'')..'\n>'
set_ch = set_ch:gsub('\n+','\n')
-- remove empty first take
if set_ch:match('IID [%d]+\nTAKE') then
local IID = set_ch:match('IID (%d+)')
set_ch = set_ch:gsub('IID [%d]+\nTAKE','IID '..IID)
end
reaper.SetItemStateChunk( item, set_ch, false )
end
---------------------------------------
function DeleteTake(item, takeid)
item_body, tk_chunks = ExtractTakeChunks(item)
table.remove(tk_chunks, takeid+1)
ApplyTakeChunks(item, item_body, tk_chunks)
end
item = reaper.GetSelectedMediaItem(0,0)
DeleteTake(item, 0)
|
|
|
01-31-2019, 07:28 AM
|
#1796
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by mpl
I believe, something like this would work (disclaimer: chunking=not stable):
Code:
function ExtractTakeChunks(item)
local retval, chunk = reaper.GetItemStateChunk( item, '', false )
local item_body = chunk:match('<ITEM(.-)NAME')
local tk_chunk_section = chunk:match('(NAME.*)>')
local tk_t = {}
local tk = 0
for line in tk_chunk_section:gmatch('[^\r\n]+') do
if (line:match('NAME ') and tk ==0)
or (line:match('TAKE') and not line:match('TAKE%a'))
or line:match('TAKE SEL')
then tk=tk+1
end
if not tk_t[tk] then tk_t[tk] = '' end
tk_t[tk] = tk_t[tk]..'\n'..line
end
return item_body, tk_t
end
---------------------------------------
function ApplyTakeChunks(item,item_body, tk_chunks)
local set_ch = '<ITEM'..item_body..table.concat(tk_chunks,'')..'\n>'
set_ch = set_ch:gsub('\n+','\n')
-- remove empty first take
if set_ch:match('IID [%d]+\nTAKE') then
local IID = set_ch:match('IID (%d+)')
set_ch = set_ch:gsub('IID [%d]+\nTAKE','IID '..IID)
end
reaper.SetItemStateChunk( item, set_ch, false )
end
---------------------------------------
function DeleteTake(item, takeid)
item_body, tk_chunks = ExtractTakeChunks(item)
table.remove(tk_chunks, takeid+1)
ApplyTakeChunks(item, item_body, tk_chunks)
end
item = reaper.GetSelectedMediaItem(0,0)
DeleteTake(item, 0)
|
Thank you so much mpl, you the man! /bow /namaste
|
|
|
01-31-2019, 10:28 AM
|
#1797
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
I really hope that SWS is not dead. Breder, you contributed so may useful things! Thank you!
|
|
|
01-31-2019, 11:12 AM
|
#1798
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@_Stevie_
Oh no, it's not.
Breeder's heritage still live :P
|
|
|
01-31-2019, 11:25 AM
|
#1799
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
|
Wow X-Raym! Are you in charge of the repo now?
Then it will definitely be alive
|
|
|
01-31-2019, 11:47 AM
|
#1800
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@Stevie
Oh non I'm not in charge, Tim is
and actually, I almost didn't touch the code, all updates were made by cfillion and nofish :P
We are just trying to merge every updates 2018 new code to propose a new pre-release very soon :P
|
|
|
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 12:22 PM.
|