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

Reply
 
Thread Tools Display Modes
Old 05-06-2021, 02:27 PM   #1
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default Hiding track in Mixer doesn't work for selected track

If you set B_SHOWINMIXER to 0 on a selected track, instead of hiding the track in the mixer as it should, REAPER apparently sets it back to 1 without telling you and leaves it visible.
cohler is offline   Reply With Quote
Old 09-20-2021, 10:20 AM   #2
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 2,630
Default

If the visibility detection code is wrong in general, this could perhaps be causing the bug described here

https://forum.cockos.com/showpost.ph...postcount=1070
MonkeyBars is offline   Reply With Quote
Old 09-20-2021, 11:28 AM   #3
rncwalker
Human being with feelings
 
rncwalker's Avatar
 
Join Date: Apr 2016
Location: South Fl.
Posts: 793
Default

Are you using 'Track Manager?' to set hideshow track in TCP and/or MPC?

I have somewhat the same problem that some of the tracks I set to hide or show do not keep the changes, when I load the project later the changes I made are gone.



Robert
rncwalker is offline   Reply With Quote
Old 09-20-2021, 02:01 PM   #4
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by cohler View Post
If you set B_SHOWINMIXER to 0 on a selected track, instead of hiding the track in the mixer as it should, REAPER apparently sets it back to 1 without telling you and leaves it visible.
What OS?

Seems to work fine here on Win10_x64/REAPER v6.36, except that the MCP column in the Track Manager (if open) isn't updated to reflect the change.
Code:
t = reaper.GetSelectedTrack(0,0)
reaper.SetMediaTrackInfo_Value(t, "B_SHOWINMIXER", 0) -- 0:hide,1:show
reaper.TrackList_AdjustWindows(false) -- false: Update TCP and MCP
reaper.ShowConsoleMsg(reaper.GetMediaTrackInfo_Value(t, "B_SHOWINMIXER")..'\n')
Edgemeal is offline   Reply With Quote
Old 10-22-2021, 08:57 AM   #5
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

I'm testing this on Mac.

The bug here is that if one updates the MCP visibility of a track by setting B_SHOWINMIXER, using

Code:
reaper.SetMediaTrackInfo_Value
REAPER does not update the screen (at least on Mac, I haven't tested on Windows). If, however, you refresh the window somehow, it then updates.

But this is complicated by the fact that none of the standard refresh commands work on the mixer window, e.g.:

Code:
reaper.DockWindowRefresh
reaper.DockWindowRefreshForHWND
reaper.JS_Window_Update
I finally found two kludgey ways of accomplishing the refresh as follows:

Code:
reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWSTL_TOGMCP"),0)
reaper.Main_OnCommand(reaper.NamedCommandLookup("_SWSTL_TOGMCP"),0)
or,
Code:
reaper.Main_OnCommand(40078,0)
reaper.Main_OnCommand(40078,0)
But these, of course, cause an undesirable entry into the Undo queue.

So this lack of immediate corresponding screen update upon track parameter update is definitely a bug.
cohler is offline   Reply With Quote
Old 10-22-2021, 09:21 AM   #6
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 2,630
Default

Have you tried reaper.UpdateArrange()?
MonkeyBars is offline   Reply With Quote
Old 10-22-2021, 10:08 AM   #7
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by MonkeyBars View Post
Have you tried reaper.UpdateArrange()?
Yes. reaper.UpdateArrange() only updates the ArrangeView window, which is a child window of the Main REAPER window. It has no impact on the Mixer Window.

And, as I said in any case, one should not have to issue any window update commands after updating the B_SHOWINMIXER track parameter. The screen state and parameter state should always be kept in sync by REAPER.
cohler is offline   Reply With Quote
Old 10-22-2021, 03:34 PM   #8
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Have you tried
Code:
reaper.TrackList_AdjustWindows(false)
(as in Edgemeal's code) to trigger a redraw?
nofish is offline   Reply With Quote
Old 10-22-2021, 05:58 PM   #9
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by nofish View Post
Have you tried
Code:
reaper.TrackList_AdjustWindows(false)
(as in Edgemeal's code) to trigger a redraw?
Just tried it and that also works. Thank you. That solves the issue of extra garbage in the Undo history.

But I still believe that this should be automatic upon setting of the B_SHOWINMIXER parameter.

Last edited by cohler; 10-22-2021 at 06:05 PM.
cohler is offline   Reply With Quote
Old 10-22-2021, 06:22 PM   #10
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by cohler View Post
But I still believe that this should be automatic upon setting of the B_SHOWINMIXER parameter.
I think the way it is is advantageous because you can show/hide multiple tracks at once and after that trigger a cumultative update/redraw when done instead of having it redraw after each change.
I don't consider it a bug, if anything the API doc. should be updated to mention the necessary call to TrackList_AdjustWindows() imo.
nofish is offline   Reply With Quote
Old 10-23-2021, 04:14 AM   #11
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by nofish View Post
I think the way it is is advantageous because you can show/hide multiple tracks at once and after that trigger a cumultative update/redraw when done instead of having it redraw after each change.
I don't consider it a bug, if anything the API doc. should be updated to mention the necessary call to TrackList_AdjustWindows() imo.
I agree that there definitely should be something in the doc about how to refresh the Mixer window, and noting that none of the normal aforementioned refreshes work.

The issue of updating visibility of many tracks followed by one screen update is not really relevant in the case of tracks, because unlike for items, where you may have thousands in one RPP and to move all items to the right or left a bit, for example, you may need to update several hundred or thousand items, with tracks in the Mixer, that is definitely not the case.

The amount of time it takes to update the screen from a track hide or show is way under 1 ms and nobody is hiding and showing hundreds or thousands of tracks at a time. For example, on my 10-year-old iMac running
Code:
reaper.TrackList_AdjustWindows(false)
with a 48-track mixer window takes less than 640 microseconds per execution. Even if you want to show or hide 100 tracks, it will be way under 100ms for all 100 screen refreshes. And how often does anyone do that?

Furthermore, in general it's a bad idea to have your screen display disagree with your data structure. That's just asking for trouble and confusion.

At most there should be a boolean refreshUI parameter passed to
Code:
reaper.SetMediaTrackInfo_Value
to update or not update the screen as there is in
Code:
reaper.SetMediaItemLength
for example. But in the real world, I doubt there is ever a case where even this is necessary.
cohler is offline   Reply With Quote
Old 10-23-2021, 06:33 AM   #12
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 2,630
Default

Quote:
Originally Posted by cohler View Post
nobody is hiding and showing hundreds or thousands of tracks at a time.
This is untrue. My friend eg does sound art and routinely works with a thousand tracks. The entire reason he works in Reaper is because it's so efficient that it can handle that load.

In addition it's not devs' job to stipulate how their software is to be used but rather enable every possible use case to the best of their ability.

Separating the concerns of processing and display is a sign of good engineering and supplies scripters with more power and efficiency. Sometimes ease of dev goes down in that scenario but it's the right tradeoff in software in general.
MonkeyBars is offline   Reply With Quote
Old 10-23-2021, 07:34 AM   #13
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by MonkeyBars View Post
This is untrue. My friend eg does sound art and routinely works with a thousand tracks. The entire reason he works in Reaper is because it's so efficient that it can handle that load.

In addition it's not devs' job to stipulate how their software is to be used but rather enable every possible use case to the best of their ability.

Separating the concerns of processing and display is a sign of good engineering and supplies scripters with more power and efficiency. Sometimes ease of dev goes down in that scenario but it's the right tradeoff in software in general.
Yes, but that's not what I said. I also routinely work with 1000 tracks. But I do NOT, and your friend, most assuredly does NOT, run scripts that continually hide / show 100s or 1000s of tracks in the Mixer.

In any case, it would be better to add the refreshUI parameter than to use a separate ill-defined/undocumented function to magically produce the needed refresh.

Further, it is clear that the vast majority of REAPER users are not running scripts that continually hide / show 100s or 1000s of tracks in the Mixer.

Good engineering design means first and foremost to make the software most efficient and effective for the vast majority of use cases. And if there needs to be inconvenience in some use case, make it for the small minority rather than the vast majority.
cohler is offline   Reply With Quote
Old 10-23-2021, 07:50 AM   #14
MonkeyBars
Human being with feelings
 
MonkeyBars's Avatar
 
Join Date: Feb 2016
Location: Hollyweird
Posts: 2,630
Default

Quote:
Originally Posted by cohler View Post
Yes, but that's not what I said. I also routinely work with 1000 tracks. But I do NOT, and your friend, most assuredly does NOT, run scripts that continually hide / show 100s or 1000s of tracks in the Mixer.
What do you mean by continuously? Because he certainly runs trackviews to hide 100s of tracks at a time, and often.
MonkeyBars is offline   Reply With Quote
Old 10-23-2021, 08:08 AM   #15
cohler
Banned
 
Join Date: Dec 2018
Posts: 642
Default

Quote:
Originally Posted by MonkeyBars View Post
What do you mean by continuously? Because he certainly runs trackviews to hide 100s of tracks at a time, and often.
First, this is a very unusual case that doesn't represent 99.99% of users.

Second, showing and hiding 100 or 200 tracks (and refreshing the window for each track) would take on the order of 50 or 60ms on a ten-year-old slow computer, i.e. much less time than the keystroke to invoke the script he is running.

By continuously, I mean his scripts are not repeatedly (like in a loop) hiding and showing many hundreds of tracks.

When you deal in efficiency and timing, you have to understand the time scales about which you are talking.

In this case, there is no significant benefit to decoupling the refresh from the parameter change. And there is very significant benefit to coupling them for the vast majority of users.
cohler is offline   Reply With Quote
Old 10-23-2021, 09:02 AM   #16
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

In any case it's not a bug because I'm pretty sure it works as the devs intended otherwise there wouldn't be a dedicated API function to refresh TCP/MCP.

Btw. here a quite significant performance difference is noticeable hiding 100 tracks at once, depending if TrackList_AdjustWindows() is called within each loop or once afterwards.
In the former I can literally see the tracks disappear one by one vs. more or less instantly.





(not that good visible in the screen capture because of the low framerate)

Last edited by nofish; 10-23-2021 at 09:10 AM.
nofish is offline   Reply With Quote
Old 10-23-2021, 11:34 AM   #17
rncwalker
Human being with feelings
 
rncwalker's Avatar
 
Join Date: Apr 2016
Location: South Fl.
Posts: 793
Default

I found that my problem was due to a Tag Script I was using. Even the script is Ok, it was really how I was using it (User Error).

If I stop the script, everything works ok!

I have now, figured out how to use the script so that it will not cause any problems.


Robert
rncwalker 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:18 PM.


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