HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: e1m1 on 2012-07-10 14:24:02

Title: Blending with functions as fields [moderation: in Columns UI]
Post by: e1m1 on 2012-07-10 14:24:02
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.  Puts and get are used just for clarification.

Code: [Select]
$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?
Title: Blending with functions as fields [moderation: in Columns UI]
Post by: NEMO7538 on 2012-07-10 15:16:29
Try this at your own risk ... it is an old string I no longer use.
Code: [Select]
$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)
)•,)
Title: Blending with functions as fields [moderation: in Columns UI]
Post by: e1m1 on 2012-07-10 16:09:47


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