Help - Search - Members - Calendar
Full Version: Compression/Quality ratio bar (for trackinfo panel)
Hydrogenaudio Forums > Hosted Forums > foobar2000 > General - (fb2k)
Russell777
biggrin.gif So here it comes for all of you who going crazy about some extra info:
Compression\quality bar for trackinfo panel
What it does:it visualizes the compression of the music file you're listening to+tells you what quality is it.
IPB Image

It's better to have it in separate trackinfo panel,this way you'll be able to set the font and font size without
messing up your existing trackinfo design,but again it's optional and up to you.
(The font you see at the image is Lucida Sans Unicode 8pt)

CODE


$if(%isplaying%,
//change to the desired symbol
$puts(symbol,$char(9610))
//1-bar+comment,0-bar only
$puts(verbal_mode,1)
Bitrate:$info(bitrate)KB/s$char(10)
$puts(precent,$div($mul(100,$info(bitrate)),1411))
$puts(yellowtr,$muldiv(250,$get(precent),13))
$puts(greentr,$muldiv(250,$get(precent),34))
$puts(redsh,$muldiv(100,$get(precent),13))
$puts(greensh,$muldiv(100,$sub($get(precent),13),24))
$if($greater(14,$get(precent)),
$transition($repeat($get(symbol),$get(precent)),$rgb(250,0,0),$rgb(250,$get(yellowtr),0))
$transition($repeat($get(symbol),$sub(13,$get(precent))),$rgb(100,$get(redsh),0),$rgb(100,100,0))
$transition($repeat($get(symbol),21),$rgb(100,100,0),$rgb(0,100,0))
$rgb(100,100,100)$repeat($get(symbol),3)
)
$if($and($greater($get(precent),13),$greater(35,$get(precent))),
$transition($repeat($get(symbol),13),$rgb(250,0,0),$rgb(250,250,0))
$transition($repeat($get(symbol),$sub($get(precent),13)),$rgb(250,250,0),
$rgb($sub(250,$get(greentr)),$get(greentr),0))
$transition($repeat($get(symbol),$sub(34,$get(precent))),$rgb($sub(100,$get(greensh)),100,0),
$rgb(0,100,0))
$rgb(100,100,100)
$repeat($get(symbol),3)
)
$if($greater($get(precent),34),
$transition($repeat($get(symbol),13),$rgb(250,0,0),$rgb(250,250,0))
$transition($repeat($get(symbol),21),$rgb(250,250,0),$rgb(0,250,0))
$rgb(250,250,250)$repeat($get(symbol),3)
)

$ifequal($get(verbal_mode),1,
$char(10)
$if($greater(161,$info(bitrate)),'Poor quality')
$if($and($greater($info(bitrate),160),$greater(201,$info(bitrate))),'Average quality')
$if($and($greater($info(bitrate),200),$greater(251,$info(bitrate))),'Good quality')
$if($and($greater($info(bitrate),250),$greater(321,$info(bitrate))),'Excellent quality')
$if($and($greater($info(bitrate),320),$greater(501,$info(bitrate))),'Insane quality')
$if($greater($info(bitrate),500),'CD quality'),
))



It works for me,but if you have problems with it plese tell me,enjoy

P.S. if i'll get a nice feedback i'll also write a column version of this code but feel free to do it yourself
fluffy
You need to switch the [/code] and [code] to make a codebox.
Anas
Thanks, nice idea. I will definetly use it! beer.gif
Russell777
Columns version.This way you can tell the quality of all the files in your playlist without even playing them.
Create a new column and copy paste this code into "style" tab,just remember to check the
"use custom style spec" box for this column in the display tab just put any character you like
(i used $char(9608) with Franklin gothic medium font)

IPB Image


CODE


$if($greater(184,$info(bitrate)),
$set_style(text,$blend($rgb(250,0,0),$rgb(250,250,0),$info(bitrate),183),
$blend($rgb(250,0,0),$rgb(250,250,0),$info(bitrate),183)))

$if($and($greater($info(bitrate),183),$greater(501,$info(bitrate))),
$set_style(text,$blend($rgb(250,250,0),$rgb(0,250,0),$sub($info(bitrate),183),317)
,$blend($rgb(250,250,0),$rgb(0,250,0),$sub($info(bitrate),183),317)))

$if($greater($info(bitrate),500),
$set_style(text,$rgb(250,250,250),$rgb(250,250,250)))



Enjoy rolleyes.gif
toology
Hey could you please post your whole track info config? smile.gif
Russell777
QUOTE(toology @ Jun 8 2006, 22:44) *

Hey could you please post your whole track info config? smile.gif


Hmm,i'm really surprised somebody would like to have my config (it's not so fancy like the others)
CODE

$puts(AltColour,$rgb(126,16,16))
$puts(pbarColour1,$rgb(126,16,16))
$puts(pbarColour2,$rgb(170,170,170))

$if(%_isplaying%,
$get(pbarColour2)'Codec:'$rgb()

$if($strcmp(%codec%,'ATSC A/52'),'            Dolby Digital AC3',
$if($info(lame_version),'            Lame MP3',
$if($strcmp(%codec%,'PCM'),'            PCM uncompressed',



$if($stricmp($ext(%_path%),ogg),'           Ogg '%codec% '('$cut($info(tool),9)')',
'           ' %codec%)))) [$info(codec_profile)]
//-----------------------------------------------------------------------------------------------------
$char(10)
$get(pbarColour2)'Encoding:       '$rgb()$caps($info(encoding))

$if($stricmp($codec(),Musepack) ,' [VBR]'  $puts(Avg,$info(bitrate)))

$if($stricmp($codec(),Mp3) ,$if($not(%__extrainfo%),' [CBR]',
' [VBR]'$puts(Avg,$info(bitrate))),)

$if($stricmp($codec(),vorbis),' [ABR]'$puts(Avg,$info(bitrate)))
$if($stricmp($info(encoding),'lossless'),' '$info(bitspersample)' bit/sample',)

//-----------------------------------------------------------------------------------------------------
$char(10)
$get(pbarColour2)'Bitrate:         ' $rgb()[' '%bitrate%' kb/s']
$if($get(Avg),' ('$get(Avg)' avg'[','$info(bitrate_nominal)' nom']')')
$char(10)


$get(pbarColour2)'Samplerate:   '$rgb()[%samplerate%' Hz']$char(10)
$get(pbarColour2)'Mode:           '$rgb()$ifgreater(%channels%,2,' '%channels%' channels',
$if($stricmp(%codec%,mp3),$caps('  '%__mp3_stereo_mode%),'  '$caps(%channels%)))


$char(10)
$get(pbarColour2)'Playing:          '$rgb()%_time_elapsed%[' of '%_time_total%]

//------------------------------------------------------------------------------------------------------

$puts(precent,$sub(100,$div($mul(100,$info(bitrate)),1411)))
$char(10)
$get(pbarColour2)'Com/Q:          '$rgb(250,250,250)
$if($not($or($stricmp(%codec%,'pcm'))$stricmp(%codec%,'CDDA')),

$puts(qwerty,$div($mul(250,$sub(91,$get(precent))),35))
$puts(qwert,$add($get(qwerty),155))
$rgb()$repeat($char(171),4)
$transition($repeat($char(171),$mul($sub($get(precent),67),1)),$rgb(0,250,0),$rgb($sub(250,$get(qwerty)),$get(qwert),0))

$puts(show,$sub(1000,$muldiv(1000,$info(bitrate),1411)))
$puts(rest,$substr($get(show),3,3))
$substr($get(show),1,2)
$if($greater($get(rest),0),'.'$get(rest),)'%',


$rgb()'Uncompressed media')

//---------------------------------------------------------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------------------------------------------
$char(10)

$progress2(%_time_elapsed_seconds%,%_time_total_seconds%,
33,
$get(pbarColour1)$char(9679),$get(pbarColour2)$char(9679)
),$char(10)$char(10)
$char(10)$get(pbarColour2)'                        No data to display')
toology
Nothing fancy with black, white and red elements is exactly what I need. Thanks! biggrin.gif
lav-chan
Not to sound like a dick, but this is pretty pointless. Even if all of your music was encoded in the same exact format with the same exact encoder of the same exact version, it would still be impossible to simply use bit rate as an indicator of 'quality'.

For example, it's perfectly conceivable that one lossless file (let's say encoded in Monkey's Audio) will have a good compression ratio and result in maybe a 700 kbps file, whereas another lossless file (let's say encoded in SHN) will have a worse compression ratio and result in maybe a 1000 kbps file. (I'm making the numbers up, but you get the idea.) Although the SHN would have a significantly higher bit rate, both files are the same quality.

And that doesn't even get into comparisons between lossy codecs -- you can not assume that, e.g., a 320-kbps Xing-encoded MP3 is 'better quality' than a 192-kbps LAME-encoded MP3.
Russell777
QUOTE(lav-chan @ Jun 9 2006, 02:12) *

Not to sound like a dick, but this is pretty pointless. Even if all of your music was encoded in the same exact format with the same exact encoder of the same exact version, it would still be impossible to simply use bit rate as an indicator of 'quality'.

For example, it's perfectly conceivable that one lossless file (let's say encoded in Monkey's Audio) will have a good compression ratio and result in maybe a 700 kbps file, whereas another lossless file (let's say encoded in SHN) will have a worse compression ratio and result in maybe a 1000 kbps file. (I'm making the numbers up, but you get the idea.) Although the SHN would have a significantly higher bit rate, both files are the same quality.

And that doesn't even get into comparisons between lossy codecs -- you can not assume that, e.g., a 320-kbps Xing-encoded MP3 is 'better quality' than a 192-kbps LAME-encoded MP3.


Thats why the color shades changes only in the range of lossy formats,after which it doesn't make any difference,it's lossless and displayed in solid white colour.

P.S. Later on when i'll have some time i gonna do a little studying about formats and their quality
factors and add the correction to the colour sheme.For example the mp3 and mpc file with same bitrate
won't be displayed in the same colour.

P.S.S. BTW it's almost impossible to dermine what file have better quality by technical measurements
that's why blind listening tests are performed (where most of the testers cannot tell if there's any difference)
that's why i assumed that the bitrate is the only possible way to determine quality in more or less optimal way,but if there's others please point me out
xequence
Very creative idea, thanks smile.gif
Neural_Overload
Thats waaay cool, but is there any way to make it not so long?
Crissaegrim
This is pretty cool, man. Cheers.
xequence
QUOTE
Thats waaay cool, but is there any way to make it not so long?


Using the default font makes it alot smaller.
Neural_Overload
QUOTE(xequence @ Jun 9 2006, 19:11) *

QUOTE
Thats waaay cool, but is there any way to make it not so long?


Using the default font makes it alot smaller.


Umm... Default font?
Russell777
QUOTE(Neural_Overload @ Jun 10 2006, 03:31) *

Thats waaay cool, but is there any way to make it not so long?


You have two options:
1-Choose smaller symbol
2-Tell me what length do you want it to be wink.gif
Neural_Overload
QUOTE(Russell777 @ Jun 10 2006, 00:57) *

QUOTE(Neural_Overload @ Jun 10 2006, 03:31) *

Thats waaay cool, but is there any way to make it not so long?


You have two options:
1-Choose smaller symbol
2-Tell me what length do you want it to be wink.gif


Do you know if there are any symbols like the one used in that script in other fonts? Id like kind of a small font. My current trackinfo panel is tahoma 8pt and id like something about that size and looks good.
Anas
I'm using @Arial Unicode MS 8pt and it is nice sized and look quite good.
Russell777

QUOTE

Do you know if there are any symbols like the one used in that script in other fonts? Id like kind of a small font. My current trackinfo panel is tahoma 8pt and id like something about that size and looks good


Well,sorry to tell you but that kind of symbol is commonly found in almost every font except Tahoma.
Tip:use ../WINDOWS/system32/charmap.exe to find a font that looks nice and also contains the symbol
you like
Neural_Overload
QUOTE(Russell777 @ Jun 10 2006, 01:37) *

QUOTE

Do you know if there are any symbols like the one used in that script in other fonts? Id like kind of a small font. My current trackinfo panel is tahoma 8pt and id like something about that size and looks good


Well,sorry to tell you but that kind of symbol is commonly found in almost every font except Tahoma.
Tip:use ../WINDOWS/system32/charmap.exe to find a font that looks nice and also contains the symbol
you like


Alright, ive settled on Arial 8pt. Can you make the bar 22 charaters long with no spaces between them?

Thanks a bunch!
Russell777
QUOTE
Alright, ive settled on Arial 8pt. Can you make the bar 22 charaters long with no spaces between them?

Thanks a bunch!


You mean like this?

IPB Image

CODE


//22-cahracter long version
$if(%isplaying%,
//change to the desired symbol
$puts(symbol,$char(9608))
//1-bar+comment,0-bar only
$puts(verbal_mode,1)
Bitrate:$info(bitrate)KB/s$char(10)
$puts(precent,$div($mul(100,$info(bitrate)),1411))
$puts(precent,$muldiv($get(precent),20,34))
$puts(yellowtr,$muldiv(250,$get(precent),8))
$puts(greentr,$muldiv(250,$get(precent),20))
$puts(redsh,$muldiv(100,$get(precent),8))
$puts(greensh,$muldiv(100,$sub($get(precent),8),12))
$if($greater(9,$get(precent)),
$transition($repeat($get(symbol),$get(precent)),$rgb(250,0,0),$rgb(250,$get(yellowtr),0))
$transition($repeat($get(symbol),$sub(8,$get(precent))),$rgb(100,$get(redsh),0),$rgb(100,100,0))
$transition($repeat($get(symbol),12),$rgb(100,100,0),$rgb(0,100,0))
$rgb(100,100,100)$repeat($get(symbol),2)
)
$if($and($greater($get(precent),8),$greater(20,$get(precent))),
$transition($repeat($get(symbol),8),$rgb(250,0,0),$rgb(250,250,0))
$transition($repeat($get(symbol),$sub($get(precent),8)),$rgb(250,250,0),
$rgb($sub(250,$get(greentr)),$get(greentr),0))
$transition($repeat($get(symbol),$sub(20,$get(precent))),$rgb($sub(100,$get(greensh)),100,0),
$rgb(0,100,0))
$rgb(100,100,100)
$repeat($get(symbol),2)
)
$if($greater($get(precent),20),
$transition($repeat($get(symbol),8),$rgb(250,0,0),$rgb(250,250,0))
$transition($repeat($get(symbol),12),$rgb(250,250,0),$rgb(0,250,0))
$rgb(250,250,250)$repeat($get(symbol),2)
)

$ifequal($get(verbal_mode),1,
$char(10)
$if($greater(161,$info(bitrate)),'Poor quality')
$if($and($greater($info(bitrate),160),$greater(201,$info(bitrate))),'Average quality')
$if($and($greater($info(bitrate),200),$greater(251,$info(bitrate))),'Good quality')
$if($and($greater($info(bitrate),250),$greater(321,$info(bitrate))),'Excellent quality')
$if($and($greater($info(bitrate),320),$greater(501,$info(bitrate))),'Insane quality')
$if($greater($info(bitrate),500),'CD quality'),
))



For Arial 8pt use $char(9608)
Neural_Overload
QUOTE(Russell777 @ Jun 10 2006, 04:56) *

QUOTE
Alright, ive settled on Arial 8pt. Can you make the bar 22 charaters long with no spaces between them?

Thanks a bunch!


You mean like this?

IPB Image

For Arial 8pt use $char(9608)


Oh dude, thats perfect! Thank you so much!
tool++
Thats a pretty radical bar, nice idea - I'll probably adapt this if I ever make infosexual layout like I used to.
Russell777
2 tool++

can you explain please what "infosexual" means? smile.gif Maybe i'm having infosexual layout without even knowing it?
(is it connected to the colours in some twisted way?) smile.gif
lav-chan
I think it means you're destroying the sanctity of foobar.
Russell777
QUOTE(lav-chan @ Jun 10 2006, 23:55) *

I think it means you're destroying the sanctity of foobar.

Well,speaking of sanctity i think that every custom made modification is "destroing" it.
If you wish to stick to sanctity you should not change anything and leave things as they are,but wasn't
Foobar created the way it was just so people could modify it? smile.gif
tool++
QUOTE(Russell777 @ Jun 10 2006, 22:03) *

2 tool++

can you explain please what "infosexual" means? smile.gif Maybe i'm having infosexual layout without even knowing it?
(is it connected to the colours in some twisted way?) smile.gif



A term I made up for layouts that have boxes of stuff everywhere - not necessarily a bad thing but I think a few users do have a lot of unnecessary stuff just to look cool.

Not necessarily cluttered, but by infosexual I just mean layouts that have a lot of information everywhere.

But that aside, this is a really good idea, hats off smile.gif
Russell777
Nice term,gotta remember it and use it to confuse people smile.gif
PS The good news are that my layout is probably not infosexual
ftboomer
Where in the code can I change the font and text color of the Remark (Insane Quality part). I want the text to remain White and 12 points. I changed it in the panel but that only seemed to change the Bitrate.

THX
Russell777
QUOTE(ftboomer @ Jun 11 2006, 05:13) *

Where in the code can I change the font and text color of the Remark (Insane Quality part). I want the text to remain White and 12 points. I changed it in the panel but that only seemed to change the Bitrate.

THX


Correct me if i'm wrong,but i believe "live" font size changing inside trackinfo panel is still impossible in current version,you have to set font definitions for the whole panel in "settings" tab.
ftboomer
QUOTE(Russell777 @ Jun 11 2006, 02:17) *

QUOTE(ftboomer @ Jun 11 2006, 05:13) *

Where in the code can I change the font and text color of the Remark (Insane Quality part). I want the text to remain White and 12 points. I changed it in the panel but that only seemed to change the Bitrate.

THX


Correct me if i'm wrong,but i believe "live" font size changing inside trackinfo panel is still impossible in current version,you have to set font definitions for the whole panel in "settings" tab.



I did that but only the word "Bitrate" changed. The words "Insane Quality" are still grey. I have a darker background and these terms don't show up unless I hit "CD Quaility" then they turn white. So, "live" changing, as you call it, is occuring.

BTW, I'm running beta 5 with all available plugin updates.
Russell777
2 ftboomer:
Suggestion:in my code the bitrate line goes to output first,then next line is the bar and the next one is quality
so i believe you should repeat the font sizing command after the bar is displayed (just before
"$ifequal($get(verbal_mode),1,...")
Question:How do you do it?
ftboomer
Here's what I have. I actually modified it to be centered horizontally:


Bitrate 400Kbps (BAR) CD Quality


Looking at this, what would I change to make "CD Quality" section remain white text, no matter which quality level is displayed?
CODE




//22-cahracter long version
$if(%isplaying%,
//change to the desired symbol
$puts(symbol,$char(9608))
//1-bar+comment,0-bar only
$puts(verbal_mode,1)
Bitrate:$info(bitrate)KB/s
$puts(precent,$div($mul(100,$info(bitrate)),1411))
$puts(precent,$muldiv($get(precent),20,34))
$puts(yellowtr,$muldiv(250,$get(precent),8))
$puts(greentr,$muldiv(250,$get(precent),20))
$puts(redsh,$muldiv(100,$get(precent),8))
$puts(greensh,$muldiv(100,$sub($get(precent),8),12))
$if($greater(9,$get(precent)),
$transition($repeat($get(symbol),$get(precent)),$rgb(250,0,0),$rgb(250,$get(yellowtr),0))
$transition($repeat($get(symbol),$sub(8,$get(precent))),$rgb(100,$get(redsh),0),$rgb(100,100,0))
$transition($repeat($get(symbol),12),$rgb(100,100,0),$rgb(0,100,0))
$rgb(100,100,100)$repeat($get(symbol),2)
)
$if($and($greater($get(precent),8),$greater(20,$get(precent))),
$transition($repeat($get(symbol),8),$rgb(250,0,0),$rgb(250,250,0))
$transition($repeat($get(symbol),$sub($get(precent),8)),$rgb(250,250,0),
$rgb($sub(250,$get(greentr)),$get(greentr),0))
$transition($repeat($get(symbol),$sub(20,$get(precent))),$rgb($sub(100,$get(greensh)),100,0),
$rgb(0,100,0))
$rgb(100,100,100)
$repeat($get(symbol),2)
)
$if($greater($get(precent),20),
$transition($repeat($get(symbol),8),$rgb(250,0,0),$rgb(250,250,0))
$transition($repeat($get(symbol),12),$rgb(250,250,0),$rgb(0,250,0))
$rgb(250,250,250)$repeat($get(symbol),2)
)

$ifequal($get(verbal_mode),1,

$if($greater(161,$info(bitrate)),'Poor quality')
$if($and($greater($info(bitrate),160),$greater(201,$info(bitrate))),' Average quality')
$if($and($greater($info(bitrate),200),$greater(251,$info(bitrate))),' Good quality')
$if($and($greater($info(bitrate),250),$greater(321,$info(bitrate))),' Excellent quality')
$if($and($greater($info(bitrate),320),$greater(501,$info(bitrate))),' Insane quality')
$if($greater($info(bitrate),500),' CD quality'),
))

Russell777
CODE

    

//22-cahracter long version
$if(%isplaying%,
//change to the desired symbol
$puts(symbol,$char(9608))
//1-bar+comment,0-bar only
$puts(verbal_mode,1)
                                                    Bitrate:$info(bitrate)KB/s    
$puts(precent,$div($mul(100,$info(bitrate)),1411))
$puts(precent,$muldiv($get(precent),20,34))
$puts(yellowtr,$muldiv(250,$get(precent),8))
$puts(greentr,$muldiv(250,$get(precent),20))
$puts(redsh,$muldiv(100,$get(precent),8))
$puts(greensh,$muldiv(100,$sub($get(precent),8),12))
$if($greater(9,$get(precent)),
$transition($repeat($get(symbol),$get(precent)),$rgb(250,0,0),$rgb(250,$get(yellowtr),0))
$transition($repeat($get(symbol),$sub(8,$get(precent))),$rgb(100,$get(redsh),0),$rgb(100,100,0))
$transition($repeat($get(symbol),12),$rgb(100,100,0),$rgb(0,100,0))
$rgb(100,100,100)$repeat($get(symbol),2)
)
$if($and($greater($get(precent),8),$greater(20,$get(precent))),
$transition($repeat($get(symbol),8),$rgb(250,0,0),$rgb(250,250,0))
$transition($repeat($get(symbol),$sub($get(precent),8)),$rgb(250,250,0),
$rgb($sub(250,$get(greentr)),$get(greentr),0))
$transition($repeat($get(symbol),$sub(20,$get(precent))),$rgb($sub(100,$get(greensh)),100,0),
$rgb(0,100,0))
$rgb(100,100,100)
$repeat($get(symbol),2)
)
$if($greater($get(precent),20),
$transition($repeat($get(symbol),8),$rgb(250,0,0),$rgb(250,250,0))
$transition($repeat($get(symbol),12),$rgb(250,250,0),$rgb(0,250,0))
$rgb(250,250,250)$repeat($get(symbol),2)
)

$rgb(250,250,250)
$ifequal($get(verbal_mode),1,

$if($greater(161,$info(bitrate)),'Poor quality')
$if($and($greater($info(bitrate),160),$greater(201,$info(bitrate))),'   Average quality')
$if($and($greater($info(bitrate),200),$greater(251,$info(bitrate))),'   Good quality')
$if($and($greater($info(bitrate),250),$greater(321,$info(bitrate))),'   Excellent quality')
$if($and($greater($info(bitrate),320),$greater(501,$info(bitrate))),'   Insane quality')
$if($greater($info(bitrate),500),'   CD quality'),
))


Copy/Paste This code
ftboomer
Thanks Russell777, just so I can learn, where and what did you change.
Russell777
QUOTE(ftboomer @ Jun 11 2006, 19:58) *

Thanks Russell777, just so I can learn, where and what did you change.


See the image:

IPB Image

If you wish to change colour of specific part of your text (for example line) Use $rgb(*,*,*) before it
and $rgb() after to get back to default colour.

As for your question about Playlist tree displaying your top played songs:

IPB Image

Looks ugly cos i made it in a hurry smile.gif

PS sorry i got confused alittle,it wasn't your question
Erich w/ an h
can you guys use the CODEBOX tag instead of CODE so that the codes dont end up cluttering the page? thanks smile.gif

nice code, btw
Scyrdein
btw, animated ratio bar for VBR is very nice.
for compatibility with CBR $info(bitrate) can be replaced with $if2(%bitrate_dynamic%,%bitrate%)
try it...
Frank Bicking
I've created my own version to improve the customisability.

Just like the one by Russell777, whom I thank for the original idea, it draws a quality bar from color1 to color2 to color3, which are configurable and set to red, yellow, and green by default. You can define where the second color is located in the bar (variable "middle", in percent) to make the red..yellow area thinner or wider. The length of the whole bar is changeable, too. The amount of black (or any other background color) being blended into the dimmed parts can be adjusted using the variable "dimming" (in percent).

It's possible to set the bitrate required to get a completely filled bar. You can decide whether the display should change for variable bitrate tracks or not. For losslessly encoded files, a completely filled bar will always be displayed regardless of the bitrate. Furthermore, It's possible to add a "lossless" indicator at the end with an adjustable length (default: 3), which uses the fourth color (set to white by default).

CODE

// configuration

$puts(length,25)
$puts(middle,30%)
$puts(symbol,$char(9610))
$puts(color1,$rgb(255,0,0))
$puts(color2,$rgb(255,255,0))
$puts(color3,$rgb(0,255,0))
$puts(dimming,30%)
$puts(blending_color,$rgb(0,0,0))
$puts(maximum_bitrate,320)
$puts(dynamic_bitrate,0)
$puts(lossless_indicator,3)
$puts(color4,$rgb(255,255,255))

// processing

$puts(color1_dimmed,$blend($get(blending_color),$get(color1),$get(dimming),100))
$puts(color2_dimmed,$blend($get(blending_color),$get(color2),$get(dimming),100))
$puts(color3_dimmed,$blend($get(blending_color),$get(color3),$get(dimming),100))
$puts(color4_dimmed,$blend($get(blending_color),$get(color4),$get(dimming),100))

$if($strcmp($info(encoding),lossless),$puts(lossless,1))
$puts(percent,$min(100,$muldiv($if($strcmp($get(dynamic_bitrate),1),%bitrate%,$info(bitrate)),100,$get(maximum_bitrate))))
$if($get(lossless),$puts(percent,100))
$puts(position,$muldiv($get(percent),$get(length),100))
$puts(middle_position,$muldiv($get(middle),$get(length),100))

$puts(normal_bar,
$transition($repeat($get(symbol),$get(middle_position)),$get(color1),$get(color2))
$transition($repeat($get(symbol),$sub($get(length),$get(middle_position))),$get(color2),$get(color3)))

$puts(dimmed_bar,
$transition($repeat($get(symbol),$get(middle_position)),$get(color1_dimmed),$get(color2_dimmed))
$transition($repeat($get(symbol),$sub($get(length),$get(middle_position))),$get(color2_dimmed),$get(color3_dimmed)))

// adjustments for color codes in variables

$puts(normal_bar,$replace($get(normal_bar),$char(3)$char(3),))
$puts(dimmed_bar,$replace($get(dimmed_bar),$char(3)$char(3),))
$puts(color_code_length,$div($strrchr($get(normal_bar),$get(symbol)),$get(length)))
$puts(position,$mul($get(position),$get(color_code_length)))
$puts(length,$mul($get(length),$get(color_code_length)))

// output

$left($get(normal_bar),$get(position))
$substr($get(dimmed_bar),$add($get(position),1),$get(length))

$if($get(lossless),$get(color4),$get(color4_dimmed))
$repeat($get(symbol),$get(lossless_indicator))

$rgb()

Please don't quote the whole code to avoid old versions floating around in case I make some changes.

Enjoy!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.