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

Reply
 
Thread Tools Display Modes
Old 12-08-2021, 08:51 AM   #1
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default [FIXED] ReaScript Master Track P_EXT: Various storage & clearing bugs

[Fixed in 6.43!]

P_EXT data on the Master Track is lost on project reload, unlike P_EXT in regular tracks, items, etc.

I also tested P_EXT in Master Track (tempo) envelope and it's affected by this same bug.

This is a nasty bug for scripters since Master Track envelopes are currently the only place devs can save arbitrary data that is affected by undo points.

Last edited by MonkeyBars; 12-10-2021 at 01:49 PM.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 09:43 AM   #2
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 13,708
Default

P_EXT is currently not supported for the master track itself, we can look at adding that.

I think it is saved/loaded correctly for other master objects like the tempo map envelope, though.
schwa is offline   Reply With Quote
Old 12-08-2021, 09:57 AM   #3
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Thanks for chiming in!

P_EXT does store data on the Master Track itself already, as well as the tempo envelope, but neither of these P_EXT locations persist across project loads. That's probably a better way to phrase the actual bug here.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 10:02 AM   #4
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Also please note that, unlike its tempo envelope P_EXT, the Master Track P_EXT is not tied to the Undo History. Not sure what the intended behavior is.

Here is my test of how P_EXT values are stored in the Undo History.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 10:03 AM   #5
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 13,708
Default

Quote:
Originally Posted by MonkeyBars View Post
Thanks for chiming in!

P_EXT does store data on the Master Track itself already, as well as the tempo envelope, but neither of these P_EXT locations persist across project loads. That's probably a better way to phrase the actual bug here.

Can you check that again or give a specific example regarding the tempo envelope, or any object other than the master track itself? This works as expected here:

Code:
tr=reaper.GetMasterTrack(0)
env=reaper.GetTrackEnvelopeByName(tr, "Tempo map")
reaper.GetSetEnvelopeInfo_String(env, "P_EXT:foo", "bar", 1)
If the project is saved, this appears in the .RPP and after close/reopen is read back properly by GetSetEnvelopeInfo_String:

Code:
  <TEMPOENVEX
    EGUID {2588176B-3CAD-49DD-8D83-B532BA43AAC6}
    ACT 0 -1
    VIS 1 0 1
    LANEHEIGHT 0 0
    ARM 0
    DEFSHAPE 1 -1 -1
    <EXT
      foo bar
    >
  >
schwa is offline   Reply With Quote
Old 12-08-2021, 11:47 AM   #6
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Quote:
Originally Posted by schwa View Post
Can you check that again or give a specific example regarding the tempo envelope, or any object other than the master track itself?

If the project is saved, this appears in the .RPP and after close/reopen is read back properly by GetSetEnvelopeInfo_String:

Code:
  <TEMPOENVEX
    EGUID {2588176B-3CAD-49DD-8D83-B532BA43AAC6}
    ACT 0 -1
    VIS 1 0 1
    LANEHEIGHT 0 0
    ARM 0
    DEFSHAPE 1 -1 -1
    <EXT
      foo bar
    >
  >
Actually, you have provided the state chunk, not output from GetSetEnvelopeInfo_String()! I also see the P_EXT data in the state chunk, but P_EXT value is NOT returned by Info_String() functions (only) after project reload.

SO:

Master Track P_EXT data indeed DOES persist across project reload, BUT is only reflected in state chunk and is NOT returned properly by Info_String() function(s). (I only tested Tempo envelope but assume this is the same bug for any Master Track P_EXT.)

Changed thread subject to reflect

Last edited by MonkeyBars; 12-08-2021 at 11:58 AM.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 12:17 PM   #7
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 13,708
Default

Quote:
Originally Posted by schwa View Post
If the project is saved, this appears in the .RPP and after close/reopen is read back properly by GetSetEnvelopeInfo_String
for example if you run this script

Code:
tr=reaper.GetMasterTrack(0)
env=reaper.GetTrackEnvelopeByName(tr,"Tempo map")
reaper.GetSetEnvelopeInfo_String(env,"P_EXT:foo","bar",1)
and then close the project and reopen it, then this script

Code:
tr=reaper.GetMasterTrack(0)
env=reaper.GetTrackEnvelopeByName(tr,"Tempo map")
rc,str=reaper.GetSetEnvelopeInfo_String(env,"P_EXT:foo","",0)
reaper.ShowConsoleMsg(str)
displays "bar". As far as I can tell, saving and loading P_EXT data is working as expected for the tempo envelope, and all other objects *except* for the master track itself.

Last edited by schwa; 12-08-2021 at 12:29 PM.
schwa is offline   Reply With Quote
Old 12-08-2021, 12:31 PM   #8
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Quote:
Originally Posted by schwa View Post
repeating myself:



for example if you run this script

Code:
tr=reaper.GetMasterTrack(0)
env=reaper.GetTrackEnvelopeByName(tr,"Tempo map")
reaper.GetSetEnvelopeInfo_String(env,"P_EXT:foo","bar",1)
and then close the project and reopen it, then this script

Code:
tr=reaper.GetMasterTrack(0)
env=reaper.GetTrackEnvelopeByName(tr,"Tempo map")
rc,str=reaper.GetSetEnvelopeInfo_String(env,"P_EXT:foo","",0)
reaper.ShowConsoleMsg(str)
displays "bar". As far as I can tell, saving and loading P_EXT data is working as expected for the tempo envelope, and all other objects *except* for the master track itself.
I was doing nearly the identical thing with my test LUA.

But just in case, I tried exactly your code, and cannot replicate your results in 6.42.

I get blank string with the second script after project reload. Then while keeping the project open I can run the 1st script and repeat the output script, and "bar" appears.

Oh wow! I just updated to yesterday's build 6.42+1207 and it's fixed! Any idea what recent code change repaired the bug?!

Thank you so much for testing this with me, Schwa! Very encouraging.

Last edited by MonkeyBars; 12-08-2021 at 01:54 PM.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 12:36 PM   #9
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Quote:
Originally Posted by schwa View Post
As far as I can tell, saving and loading P_EXT data is working as expected for the tempo envelope, and all other objects *except* for the master track itself.
Actually, I just tested the Master Track P_EXT data retrieval after project restart and it is working properly for me in 6.42+1207. Are you sure you saw the bug?

Last edited by MonkeyBars; 12-08-2021 at 01:54 PM.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 12:57 PM   #10
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 13,708
Default

I'm moderately confident that P_EXT is working as expected for the tempo envelope, in both the 6.42 released version and the current prerelease builds.

I'm highly confident that P_EXT is not supported for the master track, in either the 6.42 release version or the current prerelease builds.
schwa is offline   Reply With Quote
Old 12-08-2021, 01:04 PM   #11
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

I'm just reporting the results of my tests in a portable install.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 01:09 PM   #12
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 13,708
Default

Could you just check your results please? This is a challenging discussion if we're not on the same page.


Write P_EXT data to the tempo envelope in a test project using a reascript, save the project and close out of it.

Open the project in a text editor to verify that the <TEMPOENVEX block contains the <EXT block that you wrote.

Open the project normally and read the P_EXT data back using a reascript.


If any of those steps fails, could you report which one please?
schwa is offline   Reply With Quote
Old 12-08-2021, 01:13 PM   #13
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,506
Default

The test script persists the data for me with stock 6.42. Both tests outlined by schwa pass for me.
tack is offline   Reply With Quote
Old 12-08-2021, 01:45 PM   #14
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 5,649
Default

Quote:
Originally Posted by schwa View Post
I'm highly confident that P_EXT is not supported for the master track, in either the 6.42 release version or the current prerelease builds.
It is actually, but only as long as the project is opened. It's not stored in the projectfile, though.


How to recreate:

1. create a new project

2. create a P_EXT for the master-track and check, if it is available:

Code:
-- create P_EXT in the master track
reaper.GetSetMediaTrackInfo_String(reaper.GetMasterTrack(0,0), "P_EXT:Test", "This is a a test more", true)

-- this wil return the value of the P_EXT just created
retval, PEXT = reaper.GetSetMediaTrackInfo_String(reaper.GetMasterTrack(0,0), "P_EXT:Test", "", false)
In this code, PEXT will contain the value we just wrote into it, as expected.

Now:

3. Save the project

4. Close the project

5. Reopen the project

6. Try to access the P_EXT again:

Code:
-- returns empty string now
retval, PEXT = reaper.GetSetMediaTrackInfo_String(reaper.GetMasterTrack(0,0), "P_EXT:Test", "", false)
Now, the P_EXT is gone and the function returns just an empty string.
It looks like, as if P_EXTs in the master track are kept in memory, but not written into the statechunk and(when in undo-block-functions) are not added to the undo-list.

It's also not existing in the rpp-file of the saved project. Also not, when adding the project to the render-queue and reading the rpp-file from there.


Tested on Reaper 6.42 on Windows 7.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish

Last edited by Meo-Ada Mespotine; 12-08-2021 at 01:59 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-08-2021, 01:50 PM   #15
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 5,649
Default

Quote:
Originally Posted by MonkeyBars View Post
Actually, I just tested the Master Track P_EXT data retrieval after project restart and it is working properly for me in 6.42+1107. Are you sure you saw the bug?
This is odd. Did the bug get fixed without being known by anyone before? XD

Great to hear, though.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-08-2021, 01:53 PM   #16
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Wow, this is really odd. I am testing in macOS if it makes any difference. What OS are tack and schwa on?

MAP, would you mind testing in 6.42+1207?
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 02:00 PM   #17
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 5,649
Default

Will try.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-08-2021, 02:02 PM   #18
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 13,708
Default

Sorry to be bigfooting this thread, but the signal to noise is a bit low, so I want to be clear.

I'm certain P_EXT for the master track does not persist when saving/reloading the project, in any REAPER build including +dev1207. It has never been supported. We will probably add support for this in the next prerelease build though.

As far as I can tell, P_EXT for the project tempo envelope does persist when saving/reloading the project and that has been supported properly for a long time, including in 6.42 and in the current prerelease builds. But it's possible there are some cases where this isn't working as expected. If somebody has a reproducible case that *doesn't* work, please give as much detail as possible. But like I said, as far as I can tell this is working properly.
schwa is offline   Reply With Quote
Old 12-08-2021, 02:12 PM   #19
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 5,649
Default

Ah, now I get what you meant and it matches what I observed.

Thnx for considering adding it to the next dev-release.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-08-2021, 02:29 PM   #20
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Okay!

I've done some more testing and am definitely able to reproduce the bug.

The distingushing factor appears to be that the Master Track data is tied to Reaper load, not project load.

Reproducing the bug requires restarting Reaper. The reason I thought it was tied to the update was because after update, Reaper opened without a project, which didn't flush the Master Track data.. or something? I can't test more now
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 02:43 PM   #21
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Confirmed Master Track P_EXT may be stored per Reaper boot. Not tied to project.
  1. Write Master Track P_EXT OR Tempo map P_EXT
  2. Save project
  3. Reboot Reaper
  4. Load project
  5. Output Master Track P_EXT with GetSetMediaTrackInfo_String()
Console result: Empty string
  1. Write Master Track P_EXT OR Tempo map P_EXT
  2. Save project
  3. Close project
  4. Load project
  5. Output Master Track P_EXT with GetSetMediaTrackInfo_String()
Console result: Stored string

Last edited by MonkeyBars; 12-08-2021 at 03:53 PM.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 03:55 PM   #22
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Very strange. I just booted up Reaper 6.42 and loaded the project, and I'm getting the string on the first try. So this is intermittent...

Perhaps I am making errors in my testing? I'm trying to identify the cause of the bug appearing.

I just tested the tempo envelope P_EXT and am getting it on Reaper restart, but not Master Track P_EXT.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 04:05 PM   #23
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Further tests:
  1. Load project
  2. Store Tempo map P_EXT with GetSetEnvelopeInfo_String()
  3. Save project
  4. Close project (to empty project)
  5. Output Tempo map P_EXT with GetSetEnvelopeInfo_String() to console
  6. Result: Stored string!!
  7. Load project
  8. Output Tempo map P_EXT to console with GetSetEnvelopeInfo_String()
  9. Result: Empty string!!
  10. Output Tempo map state chunk to console
  11. Result: P_EXT data is present!!

So it seems to be a bug in GetSet...Info_String() that isn't correctly flushing object data between project loads?

Last edited by MonkeyBars; 12-08-2021 at 04:11 PM.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 04:13 PM   #24
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 13,708
Default

Ah, it's a bug that the extended state of the master track envelopes isn't cleared when the project is cleared. A fix for that may or may not make it into the next build.
schwa is offline   Reply With Quote
Old 12-08-2021, 04:22 PM   #25
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Thanks schwa.

Confirmed with Master Track P_EXT as well (not just envelope) – not flushed in state chunk on project close.

But Master Track P_EXT is not being loaded afresh on project load, which accounts for the confusing QA here.

The desired behavior of course is flush on project close and load on project load.

Last edited by MonkeyBars; 12-08-2021 at 04:34 PM.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 04:35 PM   #26
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

I'm also noticing that when script writes data to the Master Track, the project is not marked as dirty. It could simply be a matter of calling the project dirty method after setting data values... hopefully.

So the combo of not clearing data and sometimes not saving appears to be causing the erroneous behavior.
MonkeyBars is offline   Reply With Quote
Old 12-08-2021, 05:03 PM   #27
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 1,738
Default

Okay I think there are 2 bugs and a gotcha here:
  • Master Track P_EXT doesn't get saved with project data
  • Master Track P_EXT incl. envelopes don't flush on project close
  • Master Track P_EXT incl. envelopes Set() doesn't mark project as dirty
Scripts not marking project dirty was confusing us and causing our false positives with tempo envelope, as we thought we were saving project when we were not. Naughty amateur QA engineers!

Last edited by MonkeyBars; 12-09-2021 at 04:30 PM.
MonkeyBars 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 09:27 PM.


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