IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Blending with functions as fields [moderation: in Columns UI], [Development is not for questions about general usage]
e1m1
post Jul 10 2012, 14:24
Post #1





Group: Members
Posts: 2
Joined: 10-July 12
Member No.: 101308



So, I've added the album replay gain value to my groupings in the playlist, which groups by album. I'm trying to add color to this based on the replay gain, basically green for -8db or more (e.g. -4db, 0db, +x db), red for -12db or less (e.g. -13db), and a blended value for values between -8db and -12db. The first lines turns -12 to 0, and -8 to 4, ready to use with blend. The blend works as intended if i hard code numbers between 0 and 4 (or any others for that matter). Yet the two parts don't work together, and I can't figure out why. unsure.gif Puts and get are used just for clarification.

CODE
$puts(rpv,$add(12,%replaygain_album_gain%))
{$blend($rgb(255.0.0),$rgb(0,255,0),$get(rpv),4)%replaygain_album_gain%}


On a side note, how to use external editors for scripts? On another side not, how to not have the values converted to integers?

This post has been edited by e1m1: Jul 10 2012, 14:28
Go to the top of the page
+Quote Post
NEMO7538
post Jul 10 2012, 15:16
Post #2





Group: Developer
Posts: 814
Joined: 28-November 03
Member No.: 10088



Try this at your own risk ... it is an old string I no longer use.
CODE
$puts(Grey,$if(%_isplaying%,$rgb(232,232,232,232,232,232),$rgb(128,128,128,128,128,128)))

//track gain
$if(%__replaygain_track_gain%,
$puts(TG,$add(2100,$replace(%__replaygain_track_gain%,.,, dB,)))
//avg=-4db
$ifgreater(1700,$get(TG),
$blend($get(Grey),0000E0|0000E0,$min(300,$sub(1700,$get(TG))),300)
,
$blend($get(Grey),00FF40|00FF40,$min(300,$sub($get(TG),1700)),300)
),)
//album gain
$if(%__replaygain_album_gain%,
$puts(AG,$add(2100,$replace(%__replaygain_album_gain%,.,, dB,)))
//avg=-5db
$ifgreater(1700,$get(AG),
$blend($get(Grey),0000E0|0000E0,$min(300,$sub(1700,$get(AG))),300)
,
$blend($get(Grey),00FF40|00FF40,$min(300,$sub($get(AG),1700)),300)
),)
Go to the top of the page
+Quote Post
e1m1
post Jul 10 2012, 16:09
Post #3





Group: Members
Posts: 2
Joined: 10-July 12
Member No.: 101308



QUOTE (NEMO7538 @ Jul 10 2012, 16:16) *


I suppose the main differance is the replace line. I thought foobar automatically parsed the first number from strings when a number was required, think I've read it somewhere... Oh well, thanks wink.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd July 2014 - 02:08