Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Blending with functions as fields [moderation: in Columns UI] (Read 2109 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Blending with functions as fields [moderation: in Columns UI]

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?

 

Blending with functions as fields [moderation: in Columns UI]

Reply #1
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)
)•,)

Blending with functions as fields [moderation: in Columns UI]

Reply #2


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