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

Reply
 
Thread Tools Display Modes
Old 01-08-2022, 10:44 AM   #1
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,537
Default Arrange view shows "PC" instead of program name

It's debatable whether this is actually a bug or a feature request. Either way, it's a problem for Reaticulate that I don't know how to work around.

By way of background, the new version of Reaticulate regenerates and replaces the global default reabank ("mididefbankprog" in reaper.ini) each time a project is loaded or changed. This dynamicity is really needed for good design reasons (I could get into later if needed), and apart from this one issue seems to work quite well.

The problem surfaces with the feature where REAPER displays program names in the arrange view: it doesn't notice the changed reabank for existing MIDI items. Like so:



I somewhat understand this, because it looks like REAPER is resolving the PCs to names before Reaticulate has a chance to generate and swap in the global reabank (mididefbankprog). So from this perspective, you could say I'm asking for a new feature: a feature that somehow lets me either programmatically change mididefbankprog, or otherwise kick REAPER in the head to notice the change in REAPER.ini.

However, REAPER does notice the change to mididefbankprog. It must, because when I duplicate the item currently showing PCs it properly resolves to the names in the global reabank file that was generated immediately after project load:



So from this perspective, it feels more like a bug than a feature request.

Opening the MIDI editor on the item and closing it again "fixes" it, but the problem returns once the project is closed and then opened again. The problem doesn't return when toggling between project tabs or when reloading the current project without closing it first, even though mididefbankprog is replaced each time in these cases as well. Presumably once REAPER has resolved the PC names, it remembers it between project tab changes or reloads even if the global reabank is swapped out.

Suffice it to say, the expected result here is that REAPER would reevaluate the PC names on existing items when it notices mididefbankprog has changed, without needing to induce this by opening the items in the MIDI editor.

By way of workarounds, I've tried heavy handed measures: rewriting track state chunks, and also rewriting state chunks of all items (which is a hack I use to make REAPER notice reabank changes when the MIDI editor is currently open). I also tried programmatically rewriting the Bank Select events in all items on the the track to different MSB/LSB and then back again to the original (proper) MSB/LSB, to no avail. However even if any of this had worked, I'd desperately want to avoid it, because it's slow as hell, and Reaticulate would have to do it on every project load/tab switch.

I'd be grateful to learn about other ideas for workarounds (especially ones that are inexpensive), but ideally this REAPER's own behavior would change here.

Many thanks!

Last edited by tack; 01-08-2022 at 12:34 PM.
tack is offline   Reply With Quote
Old 01-08-2022, 07:25 PM   #2
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,537
Default

FWIW, I also tried rewriting the track state chunk to include MIDIBANKPROGFN, and then subsequently remove it (because I do need all Reaticulate-managed tracks to use mididefbankprog from REAPER.ini) to no avail.

While assigning a custom Reabank via the MIDI editor is enough to cause REAPER to notice the change and properly update program names for existing items, doing this programmatically doesn't have the same effect.

But, as mentioned before, that's horrendously slow, so even if it did work, I'd really want to find another, more performant option.
tack is offline   Reply With Quote
Old 01-09-2022, 03:05 PM   #3
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 4,880
Default

A huge +1 from me, since this behavior will basically break the next version of Reaticulate!
__________________
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 offline   Reply With Quote
Old 01-09-2022, 04:36 PM   #4
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 14,426
Default

Is the context an extension API call? If so, we could make it so the existing GetSetTrackMIDISupportFile forces all MIDI items on the track to reload the data (MIDI note color maps and bank/program info). More intrusively we could add an action to reload the data. In the meantime I think it would work if you have any way to force the media item to reload its state.
schwa is offline   Reply With Quote
Old 01-09-2022, 05:05 PM   #5
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,537
Default

Quote:
Originally Posted by schwa View Post
Is the context an extension API call?
ReaScript (Lua). Reaticulate modifies the global default reabank by updating REAPER.ini in place (changing the mididefbankprog property, specifically). I'm not aware of any other way to do it, though would definitely prefer to use a proper API if one exists.

Crucially, it doesn't set per-track Reabank files. Reaticulate works specifically when the track doesn't have one, and falls back to the Reaticulate-managed global reabank file defined by mididefbankprog. So even if GetSetTrackMIDISupportFile() was surfaced in Lua, I'm not sure if it would be useful in this scenario.

Quote:
Originally Posted by schwa View Post
More intrusively we could add an action to reload the data.
This would definitely work for me, at least assuming the action respected the mididefbankprog setting. I imagine there's some nontrivial performance benefit with the current caching behavior, and rescanning all items in the project whenever mididefbankprog changes (which, in the new Reaticulate, happens on every project load or tab change) to refresh PC names could be a noticeable hit. So I'd be happy with an action or an API call to induce this, if it's worth avoiding in the normal case.

On the other hand, if it's not expensive to do natively in REAPER, reloading the data and refreshing the items whenever mididefbankprog changes would be a perfect Just Works kind of fix.

Quote:
Originally Posted by schwa View Post
In the meantime I think it would work if you have any way to force the media item to reload its state.
I haven't been able to find a way. Cluebatting would be most welcome.

I tried the obvious solution, to fetch and rewrite the item state chunk:

Code:
local ok, state = reaper.GetItemStateChunk(item, "", false)
if ok then
    reaper.SetItemStateChunk(item, state, false)
end
I also tried setting an empty state first and then writing back the original state. The "PC" names in the arrange view persist.

But even if this worked, it wouldn't be practical. In a large project, rewriting the item state chunks for all items whenever mididefbankprog is changed (which, again, is any time a project is (re)loaded or a tab changed) is really expensive. Really hoping for a cheaper option, even if it's provided by a new action or API.

Thanks much for responding, schwa!
tack is offline   Reply With Quote
Old 01-15-2022, 12:52 PM   #6
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,537
Default

Just closing the loop on this for future Googlers:

As of v6.45+dev0113, schwa kindly added these very useful actions:
  • Main Section: MIDI: Reload track support data (bank/program files, notation, etc) for all MIDI items on selected tracks
  • MIDI Editor: Reload track support data (bank/program files, notation, etc)

Applying the first action on all tracks of the project is oddly slow (slower than loading the project from scratch in some cases), but it definitely gets the job done. I'm now incorporating their use into Reaticulate.

Thanks again schwa!
tack 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 05:34 AM.


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