Old 01-08-2018, 04:42 PM   #1
mrlimbic
Human being with feelings
 
mrlimbic's Avatar
 
Join Date: Nov 2009
Location: UK
Posts: 669
Default JSFX special variable bug?

In my JSFX I need to know if the project is stopped or paused.

However reaper is reporting play_state wrong.

If you pause the project, it reports it is still playing.

Can someone confirm this for me please?

// play_state is the current playback state of REAPER (0=stopped, <0=error, 1=playing, 2=paused, 5=recording, 6=record paused)

Pause the project and see what value you get.
__________________
Vordio - Post Production Toolkit
http://vordio.net
mrlimbic is offline   Reply With Quote
Old 01-08-2018, 08:05 PM   #2
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,737
Default

That state value is only updated when audio is processed, and audio is not processed while paused, so the value is never updated.

For now, you could just look at the project time not being updated for a while (it is also worth noting play_position also won't be updated while paused, and both will not be updated if the JSFX is bypassed).
Justin is offline   Reply With Quote
Old 01-08-2018, 10:58 PM   #3
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,774
Default

All this to be checked in @block ? (To me it does not seem to make sense to check in @init or @slider, but the OP did not say.)

Rather obviously the play_position stays the same with the next @block when paused.

-Michael
mschnell is online now   Reply With Quote
Old 01-09-2018, 09:27 AM   #4
mrlimbic
Human being with feelings
 
mrlimbic's Avatar
 
Join Date: Nov 2009
Location: UK
Posts: 669
Default

Quote:
Originally Posted by Justin View Post
That state value is only updated when audio is processed, and audio is not processed while paused, so the value is never updated.

For now, you could just look at the project time not being updated for a while (it is also worth noting play_position also won't be updated while paused, and both will not be updated if the JSFX is bypassed).
That is a problem as my plugin should only send sysex midi messages when the project is NOT playing. It basically sends an MMC locate message when you move the cursor so an external video engine shows the correct frame. MTC is only useful while playing but not during editing.

How do I get project time from a JSFX to check that? I didn't see it on the special variable or function list.

PS I wish REAPER sent MMC natively during stopped/paused state so that scrub, cursor moves etc worked. My plugin is a workaround for people with video performance problems (it can be hit or miss at high resolutions) or need video features that are not in reaper (like ADR overlays).
__________________
Vordio - Post Production Toolkit
http://vordio.net
mrlimbic is offline   Reply With Quote
Old 01-09-2018, 10:14 AM   #5
mrlimbic
Human being with feelings
 
mrlimbic's Avatar
 
Join Date: Nov 2009
Location: UK
Posts: 669
Default

Quote:
Originally Posted by Veto View Post
Stuff in @block and @sample doesn't seem to run at all on pause, except when the track is record armed too (I have "Run FX when stopped" checked).
That was new to me.

See also this thread: https://forum.cockos.com/showthread.php?t=43522




You questions were directed at Justin but I think he means something like this:
PHP Code:
@gfx
paused
=0;
lplay_position==play_position paused=1;
lplay_position=play_position
Ah. So gfx will still get called even while paused?
__________________
Vordio - Post Production Toolkit
http://vordio.net
mrlimbic is offline   Reply With Quote
Old 01-09-2018, 10:45 AM   #6
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,774
Default

Quote:
Originally Posted by Veto View Post
play_state is a inbuilt global variable, no need for any code anywhere if you monitor it in the IDE.
In JSFX the code always is in an @.... section (i.e. event handler). The inbuilt global variables are initialized when such a section is started. This might be different depending on the section and depending on the point in time when the section is started. I suppose they are not modified while a secetion is executed.

Hence the "where" is very relvant.

-Michael
mschnell is online now   Reply With Quote
Old 01-09-2018, 10:53 AM   #7
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,774
Default

Quote:
Originally Posted by Justin View Post
That state value is only updated when audio is processed, and audio is not processed while paused, so the value is never updated.
If input monitoring is activated for the thread, audio supposedly is processed (and with that @block is executed) also when stopped.

Hence it should be possible to check the state and to send midi messages there.

-Michael
mschnell is online now   Reply With Quote
Old 01-09-2018, 12:39 PM   #8
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
Default

Quote:
Originally Posted by mrlimbic View Post
PS I wish REAPER sent MMC natively during stopped/paused state so that scrub, cursor moves etc worked. My plugin is a workaround for people with video performance problems (it can be hit or miss at high resolutions) or need video features that are not in reaper (like ADR overlays).
I might as well add something here:

Most film composers like to decouple their music machine from the video machine. Not for performance reasons, but for the fact that the video machine is completely independent from the DAW. For example, when having composed a cue, I import it in my project on my video machine. That way, I have the whole movie and its music at my disposal, without the need to load precedent cues in my DAW project.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is online now   Reply With Quote
Old 01-09-2018, 12:52 PM   #9
mrlimbic
Human being with feelings
 
mrlimbic's Avatar
 
Join Date: Nov 2009
Location: UK
Posts: 669
Default

Quote:
Originally Posted by _Stevie_ View Post
Most film composers like to decouple their music machine from the video machine.
Same goes for Foley & ADR. The video playback is likely to be in another room entirely and not connected directly to any DAW monitor windows.

It also may need to go through an A/V output device and reaper doesn't support external A/V devices.
__________________
Vordio - Post Production Toolkit
http://vordio.net
mrlimbic is offline   Reply With Quote
Old 01-09-2018, 03:18 PM   #10
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,774
Default

Quote:
Originally Posted by Veto View Post
an empty JSFX and the IDE opened.
I don't suppose that in this case the IDE shows correctly enough what the realtime behavior of a JSFX will be, as it does not show if any JSFX code even will is executed at all.

Its easy enough to create an appropriate JSFX and copy the play_position and play_state variables in local variable is @block, @gfx or wherever and watch these values with sliders or in the IDE.

-Michael

Last edited by mschnell; 01-09-2018 at 03:25 PM.
mschnell is online now   Reply With Quote
Old 01-09-2018, 03:22 PM   #11
mrlimbic
Human being with feelings
 
mrlimbic's Avatar
 
Join Date: Nov 2009
Location: UK
Posts: 669
Default

The “MMC locate" plugin is now in my mrlimbic reapack repo.

https://raw.githubusercontent.com/mr...ster/index.xml

Apart from the pause issue it seems to be working for me with Video Slave 3 and Mitti demos. XJadeo doesn't support MMC locate yet but I have requested it on their github.

Just avoid using the enter key for now.

Limitations: Drop-frame timecodes are not yet supported, only Non-drop timecodes.
__________________
Vordio - Post Production Toolkit
http://vordio.net

Last edited by mrlimbic; 01-09-2018 at 05:39 PM.
mrlimbic is offline   Reply With Quote
Old 01-09-2018, 03:23 PM   #12
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,774
Default

Quote:
Originally Posted by Veto View Post
Not sure if I understand you right here, input monitoring doesn't seem to have any effect. All what matters is if the track with the JSFX is armed or not.
I don't see what the "armed" state could have to do with if or if not @block is executed (meaning that "audio is processed", as Justin stated).

OTOH if input monitor is activated "audio is processed" and @block is called in stop state. This is exactly the way my Live playing setup works (with VSTs and multiple JSFX which I partly did myself). I never press "start" or "record" in this setup, nor is any input armed.

-Michael
mschnell is online now   Reply With Quote
Old 01-09-2018, 05:40 PM   #13
mrlimbic
Human being with feelings
 
mrlimbic's Avatar
 
Join Date: Nov 2009
Location: UK
Posts: 669
Default

Quote:
Originally Posted by mrlimbic

Looks great, thanks! But your index link needs a fix.
Fixed. Somehow copy & paste mangled it.

https://raw.githubusercontent.com/mr...ster/index.xml
__________________
Vordio - Post Production Toolkit
http://vordio.net
mrlimbic 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 08:20 AM.


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