Old 08-09-2020, 06:00 AM   #1
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default region repeat

Hi
region repeat doesn't exist yet, does it?
Maybe you could build it that way

Last edited by Dragonetti; 08-09-2020 at 08:26 AM.
Dragonetti is offline   Reply With Quote
Old 08-09-2020, 06:54 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

What do you mean with region-repeat. Duplication on an existing region?
__________________
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 08-09-2020, 07:51 AM   #3
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default

The region is repeated 8 times in the example above, currently we are repeating the 5th time
Dragonetti is offline   Reply With Quote
Old 08-09-2020, 08:38 AM   #4
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

Try something like this to loop Region under cursor

Code:
function loopRegionRegionUnderPlay()
	local playpos = reaper.GetPlayPositionEx(proj)
	local editpos = reaper.GetCursorPositionEx(proj)
	local pos = playpos
	local isStopped = reaper.GetPlayStateEx(proj) == 0
	if isStopped then pos = editpos end
	local markeridx, regionidx = reaper.GetLastMarkerAndCurRegion(0, pos)
	if regionidx then
	  local _, _, x, y = reaper.EnumProjectMarkers3(0,regionidx)
	  reaper.GetSet_LoopTimeRange(1, 1, x, y, 0)
	end
	local isRepeat = reaper.GetSetRepeat(-1) == 1
	if not isRepeat then
		reaper.GetSetRepeat(1) --Set Repeat
	end
end
Using Action markers this can be automatically triggered easily.

Then using extstates you can build a counter in the function everytime it is triggered

Your "Repeat off" action should reset the extstate to zero.

Done.

Last edited by lexaproductions; 08-13-2020 at 05:53 AM.
lexaproductions is offline   Reply With Quote
Old 08-09-2020, 01:16 PM   #5
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default

Thanks lexaproductions
but I don't understand.
The script doesn't do anything to me. Should it turn on the repeat function of a region?
Dragonetti is offline   Reply With Quote
Old 08-10-2020, 04:31 AM   #6
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

Code:
function loopRegionUnderPlay()
	local playpos = reaper.GetPlayPositionEx(0)
	local editpos = reaper.GetCursorPositionEx(0)
	local pos = playpos
	local isStopped = reaper.GetPlayStateEx(0) == 0
	if isStopped then pos = editpos end
	local markeridx, regionidx = reaper.GetLastMarkerAndCurRegion(0, pos)
	if regionidx then
	  local _, _, x, y = reaper.EnumProjectMarkers3(0,regionidx)
	  reaper.GetSet_LoopTimeRange(1, 1, x, y, 0)
	end
	local isRepeat = reaper.GetSetRepeat(-1) == 1
	if not isRepeat then
		reaper.GetSetRepeat(1) --Set Repeat
	end
end 

loopRegionUnderPlay()
Try this

It should set the loop points to the current region and Enable the repeat mode.

Last edited by lexaproductions; 08-13-2020 at 05:53 AM.
lexaproductions is offline   Reply With Quote
Old 08-10-2020, 04:57 AM   #7
sinkmusic
Human being with feelings
 
sinkmusic's Avatar
 
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
What do you mean with region-repeat. Duplication on an existing region?
I think Dragonetti want Reaper to behave like a hardware Midi sequencer (or like Ableton Live can do in session view) :
- play your song/project
- when the playhead is at the region, repeat (loop playback) X times
- then continue regular playback
etc

@Dragonetti, I think that PLaytime should allow you to do that
https://www.helgoboss.org/projects/playtime/

By the way, your suggestion (in the original post) is very clever !
sinkmusic is offline   Reply With Quote
Old 08-10-2020, 10:30 AM   #8
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default

I only recently discovered the function "region" for myself.
I think it would be very appropriate to quickly repeat a region, it doesn't bother anyone. The default would of course be 1.
Dragonetti is offline   Reply With Quote
Old 08-10-2020, 04:52 PM   #9
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

I understood the request. Using a function like the one I posted, you could easily setup a counter in it with user input. And then using Action markers to trigger it.
lexaproductions is offline   Reply With Quote
Old 08-12-2020, 09:39 PM   #10
lexaproductions
Human being with feelings
 
Join Date: Jan 2013
Posts: 1,126
Default

Hey Dragonetti, here are 2 scripts I quickly made. It will answer your needs for now.

One is the actual action and the other one is the "Add Action Marker" function that will ask you how many times you want to loop your region.

For it to work, you need to do three things:
1- Add the lua actions in your list.
2- Right-Click on the LoopRegion.lua action and copy the command ID
3- Open the AddLoopRegionActionMarker.lua file in a text editor and paste your Command ID over the one that's currently there.

Then to operate the whole thing, you simply place your cursor within a region and fire the Add Action Marker action. It will ask you how many times you want.

Let me know if it works.
lexaproductions is offline   Reply With Quote
Old 08-12-2020, 10:00 PM   #11
Embass
Human being with feelings
 
Embass's Avatar
 
Join Date: Jan 2014
Posts: 923
Default

You can use this:
SWS/S&M: Open/close Region Playlist window
Embass is offline   Reply With Quote
Old 08-13-2020, 04:28 AM   #12
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default

@lexaproduction
Thank you, The script seems to be quite suitable for live use.
but for the way I work, I find the sws region playlist clearer.
Dragonetti 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 07:14 AM.


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