Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 08-21-2016, 05:00 AM   #1
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
Default API -Can't set Start Offset in take if Stretch Markers

It seems that you can't use the API command "SetMediaItemTakeInfo_Value(take, "D_STARTOFFS", offset)" to set the "Start in source" parameter if there are Stretch Markers in the take.

With a simple example (thanks mpl):
Code:
offset = 0.40
item =  reaper.GetMediaItem(0, 0)
take = reaper.GetActiveTake(item)
reaper.SetMediaItemTakeInfo_Value(take, "D_STARTOFFS", offset) 
--reaper.UpdateArrange()
reaper.UpdateItemInProject( item )
This will set the "Start in source:" box in Media item properties, Take properties to 0.4 seconds, but not the take itself, and leave this 0.4s as an offset between the box and the actual take.

This issue occurs even with one unstretched SM in a take, and removing it enables the API function again and also re-synchronises the "Start in source:" box and the actual take display.


REAPER 5.23x64, Win7-64Pro.




>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is offline   Reply With Quote
Old 08-23-2016, 09:04 AM   #2
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
Default

I've duplicated this on two machines, on XP32 and on Win7-64Pro.



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is offline   Reply With Quote
Old 08-24-2016, 03:08 AM   #3
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
Default

Code:
offset = -0.10
item =  reaper.GetMediaItem(0, 0)
take = reaper.GetActiveTake(item)
reaper.SetMediaItemTakeInfo_Value(take, "D_STARTOFFS", offset) 

for i = 1,  reaper.GetTakeNumStretchMarkers( take ) do
  retval, pos, srcpos = reaper.GetTakeStretchMarker( take, i-1   )
  reaper.SetTakeStretchMarker( take, i-1, pos-offset, srcpos )
end

reaper.UpdateItemInProject( item )
mpl is offline   Reply With Quote
Old 08-24-2016, 12:12 PM   #4
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
Default

So, looping through the SM indexes, reading the SM positions and writing-back, setting them to their exact same positions jogs the start-offset write to take effect?

ie, effectively refreshing all the SMs in a take?



Was this something you stumbled on or a known workaround? I'm presuming here that this is not an intentional functionality?

Well this will unstick my workflow jam, thank you, but it does seem a bit of a bodge fix for what must be a bug..?


Has this been know about before now? I did a Google search on the forums and didn't spot the same issue.

Thanks for finding this/pointing it out, mpl. Could we have a proper fix please, Devs, -while you're tinkering with the SMs?




>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is offline   Reply With Quote
Old 08-24-2016, 07:57 PM   #5
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
Default

I discovered these things while coding quantize tool. Well, maybe you are right. Current behavior is enough for my needs.
mpl is offline   Reply With Quote
Old 08-25-2016, 04:08 PM   #6
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
Default

Thanks for your help mpl, I've got there in the end.

Please devs can you fix this API SetMediaItemTakeInfo_Value function for "D_STARTOFFS", as the workaround can get really unweildy -if you move the start offset in a take with stretching, the start-offset is in source time, but the P-move to refresh the SMs (and make the offset follow the F2 start offset) is in item time.

Surely this non-updating of the Stretch Markers' parameters by this API function is a bug?

Many thanks, in anticipation...




>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is offline   Reply With Quote
Old 08-26-2016, 05:55 AM   #7
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,737
Default

Yeah, I suppose this API should report/adjust the effective start offset when stretch markers are active. Some day... for now use mpl's lovely workaround code (FWIW that's what the API function would have to do internally as well...
Justin is offline   Reply With Quote
Old 10-24-2021, 03:07 AM   #8
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Quote:
Originally Posted by Justin View Post
Yeah, I suppose this API should report/adjust the effective start offset when stretch markers are active. Some day... for now use mpl's lovely workaround code (FWIW that's what the API function would have to do internally as well...

Maybe 5 years later, aka now/soonish, is "some day"? :P
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 10-24-2021, 06:45 AM   #9
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Perhaps a new API, that would work like when one types the offset in the Item Properties window, would be the best choice, in order for existing scripts, that use the mpl work-around, to not break.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma 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 01:27 PM.


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