|
|
|
11-07-2016, 10:52 AM
|
#1
|
Human being with feelings
Join Date: Jul 2014
Location: London
Posts: 739
|
Can scripts change preferences? Tint Color
Can any of these preferences be changed via a script? Specifically "Tint media item *** to : 'Take Color'"
|
|
|
11-07-2016, 05:42 PM
|
#2
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,902
|
You should be able to do that yes,
You just have to know how this parameter is called from the REAPER.ini file in REAPER resources folder.
Make a copy of the REAPER.ini,
save new settings,
and use a software compare two files. The line modified will show you how the key parameter is named.
Then you will be able to use reaper.SNM_SetIntConfigVar(string varname, integer newvalue)
or
reaper.SNM_GetDoubleConfigVar(string varname, number errvalue)
according to context.
Need some testing, but it should work.
|
|
|
11-08-2016, 03:41 AM
|
#3
|
Human being with feelings
Join Date: Jul 2014
Location: London
Posts: 739
|
Interesting. I'll give this a go. Not exactly a scripter, but I'll give it a shot
|
|
|
11-08-2016, 03:54 AM
|
#4
|
Human being with feelings
Join Date: Jul 2014
Location: London
Posts: 739
|
"tinttcp=" is the line in reper.ini that pertains to Item and Waveform tinting.
Variations on Take Color
tinttcp=1726
tinttcp=1982
tinttcp=1854
tinttcp=1598
|
|
|
11-08-2016, 04:16 AM
|
#5
|
Human being with feelings
Join Date: Jul 2014
Location: London
Posts: 739
|
Ignore the previous post. Here's how tint preferences affect the Reaper.ini configuration number...
Settings are now going from 0, not 2. Don't know why but everything else remains true
LOWEST NUMBER IS NOT 2. A value of 2 is set by 'Tint track panel backgrounds'
Last edited by Stroudy; 11-08-2016 at 02:45 PM.
Reason: Wrong image
|
|
|
11-08-2016, 04:54 AM
|
#6
|
Human being with feelings
Join Date: Jul 2014
Location: London
Posts: 739
|
Learning as I go here. "Item Background Take color" would set the 9th digit in a 12bit binary number to 1 or 0. As it adds 256.
i.e. 1024 - 512 - 256 - 128 - 64 - 32 - 16 - 8 - 4 - 2 - 1
256 is 9th from the right.
My maths aren't good enough to do this in Hex, but binary seems straight forward. I would convert the "tinttcp" value to Binary, check the 9th digit and change to eith a 1 or 0. Then convert it back to decimal and apply the value to Reaper.ini
|
|
|
11-08-2016, 05:16 AM
|
#8
|
Human being with feelings
Join Date: Jul 2014
Location: London
Posts: 739
|
What format is that in? .ods I can't do anything with that. Mac based
|
|
|
11-08-2016, 06:12 AM
|
#9
|
Human being with feelings
Join Date: Jul 2014
Location: London
Posts: 739
|
I can't get reaper.SNM_SetDoubleConfigVar( varname, newvalue ) to write any value
Code:
reaper.SNM_SetIntConfigVar("tinttcp", "1940")
What am I doing wrong?
|
|
|
11-08-2016, 06:35 AM
|
#10
|
Human being with feelings
Join Date: Jun 2007
Location: Terra incognita
Posts: 7,670
|
Quote:
Originally Posted by Stroudy
What format is that in? .ods I can't do anything with that. Mac based
|
OpenDocument Spreadsheet (ODS). Open Office or Libre Office, I prefer the latter myself.
https://www.libreoffice.org
|
|
|
11-08-2016, 08:57 AM
|
#11
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,902
|
@ Stroudy
Seems more complicated than expected ^^
Have you tried quit and restart REAPER after the set function ? it is possible than the file get modified only at REAPER closing.
Other possibility: the value you set is wrong (you can check what the set function return to see that).
|
|
|
11-08-2016, 09:43 AM
|
#12
|
Human being with feelings
Join Date: Jul 2014
Location: London
Posts: 739
|
Thanks X-Raym
Code:
CurSetting = reaper.SNM_GetIntConfigVar( "tinttcp", -666 )
num=CurSetting
bits=12
function toBits(num, bits)
-- returns a table of bits
local t={} -- will contain the bits
for b=bits,1,-1 do
rest=math.fmod(num,2)
t[b]=rest
num=(num-rest)/2
end
if num==0 then return t else return {'Not enough bits to represent this number'}end
end
bits=toBits(num, bits)
NinthBit = tonumber(table.concat(bits):sub(9,10))
reaper.ShowConsoleMsg(table.concat(bits).."\n"..NinthBit.."\n")
if NinthBit == 1 then
reaper.ShowConsoleMsg("Yes it's on")
elseif NinthBit == 0 then
reaper.ShowConsoleMsg("it's off")
NewSetting = CurSetting+256
reaper.ShowConsoleMsg(NewSetting)
reaper.SNM_SetDoubleConfigVar( "tinttcp", 1940 ) -- 1940 would normally be the variable "NewSetting"
end
Does it need the equivolent of the "apply" button?
Quiting/Reaper Reaper doesn't help. Values are still not written.
Using the pref window, values when setting manually only change in the .ini when apply is pressed.
|
|
|
11-08-2016, 02:43 PM
|
#13
|
Human being with feelings
Join Date: Jul 2014
Location: London
Posts: 739
|
Checked adds 2 to tinttcp in Reaper.ini
|
|
|
08-28-2023, 11:41 PM
|
#14
|
Human being with feelings
Join Date: Nov 2015
Location: Alaska
Posts: 260
|
Very old thread, I know, but curious if you ever got this working and if so, would be willing to share the script?
|
|
|
08-31-2023, 04:01 AM
|
#15
|
Human being with feelings
Join Date: Jul 2014
Location: London
Posts: 739
|
Quote:
Originally Posted by GrizzlyAK
Very old thread, I know, but curious if you ever got this working and if so, would be willing to share the script?
|
Yes! I do use this a fair amount. I hope you find it useful. It could be modified to change other, similar visual aspects, I'm sue.
Code:
CurSetting = reaper.SNM_GetIntConfigVar( "tinttcp", -666 )
retval, stringOut = reaper.BR_Win32_GetPrivateProfileString("REAPER", "tinttcp", "sdfsdf", reaper.get_ini_file())
--reaper.ShowConsoleMsg(stringOut)
num=CurSetting
bits=12 --The number of bit we need to make this setingwork
-- When the "tinttcp" number from the reaper.ini is converted to binary, the
-- 256 value digit will correspond to "Tint media item background to Take Color".
-- First, let's convert to bits...
function toBits(num, bits)
-- returns a table of bits
local t={} -- will contain the bits
for b=bits,1,-1 do
rest=math.fmod(num,2)
t[b]=rest
num=(num-rest)/2
end
if num==0 then return t else return {'Not enough bits to represent this number'}end
end
bits=toBits(num, bits)
NinthBit = tonumber(table.concat(bits):sub(9,10)) --This is the bit will value of 256
--reaper.ShowConsoleMsg(table.concat(bits).."\n"..NinthBit.."\n")
if NinthBit == 1 then
--reaper.ShowConsoleMsg("Tack Color BG is ON")
NewSetting = CurSetting-256
reaper.SNM_SetIntConfigVar( "tinttcp", NewSetting )--1940 is a placeholder value to be replaced with NewSetting
elseif NinthBit == 0 then
--reaper.ShowConsoleMsg("Tack Color BG is OFF")
NewSetting = CurSetting+256 --Get ready to turn it on. +256 will mean 9th bit will be "ON"
--reaper.ShowConsoleMsg(NewSetting)
reaper.SNM_SetIntConfigVar("tinttcp", NewSetting )--1940 is a placeholder value to be replaced with NewSetting
end
reaper.TrackList_AdjustWindows(true)
reaper.UpdateArrange()
|
|
|
09-01-2023, 04:38 PM
|
#16
|
Human being with feelings
Join Date: Nov 2015
Location: Alaska
Posts: 260
|
This is AWESOME! Thanks! Love the Reaper community.
Cheers
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 11:43 AM.
|