![]() |
#1 |
Human being with feelings
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,638
|
![]()
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. |
![]() |
![]() |
![]() |
#2 |
Human being with feelings
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,638
|
![]()
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. |
![]() |
![]() |
![]() |
#3 |
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,229
|
![]()
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 |
![]() |
![]() |
![]() |
#4 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 17,115
|
![]()
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.
|
![]() |
![]() |
![]() |
#5 | |
Human being with feelings
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,638
|
![]()
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. 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:
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 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! |
|
![]() |
![]() |
![]() |
#6 |
Human being with feelings
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,638
|
![]()
Just closing the loop on this for future Googlers:
As of v6.45+dev0113, schwa kindly added these very useful actions:
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! |
![]() |
![]() |
![]() |
Thread Tools | |
|
|