Old 11-27-2022, 12:45 AM   #1
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default Bug GetPlayPosition2()

Code:
 
function print(...) 
    local t = {}
    for i, v in ipairs( { ... } ) do
        t[i] = tostring( v )
    end
    reaper.ShowConsoleMsg( table.concat( t, " " ) .. "\n" )
end


function loop()
    local next_pos =  reaper.GetPlayPosition2(  )
    print(next_pos)

    reaper.defer(loop)
end

reaper.defer(loop)


if the transport stops the value still runs, if the transport pauses it does pauses the tempo .

Wonder if that is the desired behavior
daniellumertz is offline   Reply With Quote
Old 11-27-2022, 03:29 AM   #2
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

It may be a bug or not. Maybe the function needs improvement. When you stop playback, where is play position? You don't know, me neither. But when you stop playback, edit cursor is placed to that time, so you could check playstate. Here is a tip:
PHP Code:
if reaper.GetPlayState() > 0 then
    pos 
reaper.GetPlayPosition2()
else
    
pos reaper.GetCursorPosition()
end 
The author is jonboy3650:
https://forum.cockos.com/showpost.ph...83&postcount=3
vitalker is online now   Reply With Quote
Old 11-28-2022, 08:49 AM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Does it stop at all or does it run "forever"?


Edit: works longer than 30 seconds. I'd consider this a bug...

Edit2:
Funny: Changing the playrate also changes the speed of the playposition after stop so something's still playing in some capacity...
__________________
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 02-20-2023, 03:34 AM   #4
Buy One
Human being with feelings
 
Buy One's Avatar
 
Join Date: Sep 2019
Posts: 1,132
Default

Have bumped into it as well. When the transport doesn't run the value is constantly being updated.

As many times as the function is executed with no running transport, without defer loop and while the edit cursor stays put, that many times the value will be greater than the previous.

It's as if the function updated the play position on its own.

The initial time though depends on the edit cursor position which seems logical. So once transport starts the value changes to the one corresponding to the current edit cursor position.
__________________
https://github.com/Buy-One/REAPER-scripts (175)
REAPER is a DAW whose user guide file is larger than its installation file

Last edited by Buy One; 02-20-2023 at 03:43 AM.
Buy One 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:30 AM.


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