Old 07-09-2015, 09:08 AM   #1
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 7,036
Default [fixed] Track Color Int on Mac is wrong

EDIT: this is fixed thanks to reaper.ColorToNative and reaper.ColorFromNative Reascript functions from v5.

Hi !

RESUME: Color int returned by reaper.GetMediaTrackInfo_Value(track, "I_CUSTOMCOLOR") is wrong on mac. Only tested in Lua.

We experienced a strange bug with Heda, when passing a GFX script that use track color (int to rgb) as gfx.color variable

I tested a simple script that return different color int value, on windows and on mac.

The script:
Code:
item = reaper.GetMediaItem(0, 0)
take = reaper.GetActiveTake(item, 0)
track = reaper.GetTrack (0, 0)

item_color_int = reaper.GetMediaItemInfo_Value(item, "I_CUSTOMCOLOR")
take_color_int = reaper.GetMediaItemTakeInfo_Value(take, "I_CUSTOMCOLOR")
track_color_int = reaper.GetMediaTrackInfo_Value(track, "I_CUSTOMCOLOR")

take_color_int_displayed = reaper.GetDisplayedMediaItemColor2(item, take)

function Msg(value)
    reaper.ShowConsoleMsg(tostring(value).."\n")
end

Msg("Item INT color: "..item_color_int)
Msg("Take INT color: "..take_color_int)
Msg("Track INT color: "..track_color_int)
Msg("Take INT displayed color: "..take_color_int_displayed)
On windows, it displayed:
Item INT color: 16777429.0
Take INT color: 16777429.0
Track INT color: 30784000.0
Take INT displayed color: 16777429

On mac (same project):
Item INT color: 16777429.0
Take INT color: 16777429.0
Track INT color: 16825045.0
Take INT displayed color: 16777429

As you can see, track Int color is different.
Deeper test reveals that this is an inversion of R and B channel.

Windows:


Mac:


To reproduce:
  1. create a project
  2. insert one track, color it
  3. insert one midi item, color it
  4. run the script
  5. compare results.
You can also use this test project and report your console messages: https://www.dropbox.com/s/0i3f4weckm...itled.RPP?dl=0

I didn't test it with other int color than these one. I only tested with Lua.

I wonder if it could also explained why my color palette are shifted when I used them on mac.


As this involves having a mac AND a pc, I don't know if there would be a lot of tester. But the bug is there, without any doubt.

Last edited by X-Raym; 03-19-2017 at 07:46 AM.
X-Raym is offline   Reply With Quote
Old 07-11-2015, 01:43 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 7,036
Default

Confirmed the thread http://forum.cockos.com/showthread.php?t=156339
from post #65 to #76
X-Raym is offline   Reply With Quote
Old 07-11-2015, 01:46 AM   #3
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 7,036
Default

vote here:
Track Color Int on Mac is wrong - Cockos Confederated Forums - Projects
X-Raym is offline   Reply With Quote
Old 07-11-2015, 03:41 AM   #4
Jeffos
Mortal
 
Jeffos's Avatar
 
Join Date: Dec 2008
Location: France
Posts: 1,969
Default

Digged this a bit. Now, I see the problem you're facing with ReaScript: what I said here is BS, coloring APIs are OS dependent actually (never really realized because SWELL does the job for us in C++ extensions...).
=> we'll add a couple of other functions so you can make crossplatform coloring scripts, and clarify the documentation

Quote:
Originally Posted by X-Raym View Post
RESUME: Color int returned by reaper.GetMediaTrackInfo_Value(track, "I_CUSTOMCOLOR") is wrong on mac. Only tested in Lua.
There isn't any real bug here though: only track colors are crossplatform, i.e. for a same project file, the returned track color *values* are different on win & osx, but the color itself is the same. This works the other way around for item/take colors (which isn't ideal...).

Last edited by Jeffos; 07-11-2015 at 03:48 AM. Reason: ...and clarify the documentation
Jeffos is offline   Reply With Quote
Old 07-11-2015, 04:44 AM   #5
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 6,147
Default

Quote:
Originally Posted by Jeffos View Post
=> we'll add a couple of other functions so you can make crossplatform coloring scripts, and clarify the documentation
Thank you! I don't mind if the original functions are changed, or if new functions are added as long as we can get the color with the same code on both systems. My scripts Notes Reader and Loudnes Graph, also suffer from this issue, but I couldn't test them in Mac. I just expected that they would work the same on both.
heda is offline   Reply With Quote
Old 07-11-2015, 07:08 AM   #6
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 7,036
Default

@Jeffos
Thanks for your support !
Just like heda, I don't mind if you modify existing functions, but new functions are great too !

@heda
I will test it for you :P
X-Raym 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:47 PM.


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