Help - Search - Members - Calendar
Full Version: Format string for status bar
Hydrogenaudio Forums > Hosted Forums > foobar2000 > General - (fb2k)
Sebastian Mares
Hello!

I would like to change the color of the bitrate to red when the value was greater than 224 or lower than 96 and the codec is Vorbis. When starting a new song, the bitrate color should be normal again.

The string used now is:

CODE

$codec()  |  $if2(%__bitrate_dynamic% kbps,%__bitrate% kbps)  |  %__samplerate% Hz  |  $ifgreater(%__channels%,2,%__channels% Channels,$ifgreater(%__channels%,1,Stereo,Mono))$char(9)$if(%_time_total%,[%_time_elapsed%] / [%_time_total%],[%_time_elapsed%])


This displays something like:

CODE

Vorbis  |  163 kbps  |  44100 Hz  |  Stereo       ...       1:47 / 4:58


unsure.gif

Regards,
Sebastian
Synthetic Soul
$puts(kbps,$if2(%__bitrate_dynamic%,%__bitrate%))
$codec() | $if($and($stricmp($codec(),Vorbis),$or($greater($get(kbps),224),$greater(96,$get(kbps)))),#0000FF#)$get(kbps) kbps## | %__samplerate% Hz | $ifgreater(%__channels%,2,%__channels% Channels,$ifgreater(%__channels%,1,Stereo,Mono))$char(9)$if(%_time_total%,[%_time_elapsed%] / [%_time_total%],[%_time_elapsed%])


...should do it.

Replace # with the color character (square block) - I can't seem to get them to dislpay.

Edit: was testing with MP3 and left it in, replaced with Vorbis now.

Edit 2: Explanation:

$puts(kbps,$if2(%__bitrate_dynamic%,%__bitrate%))
Store the displayed bitrate in the variable kbps. As we use this value a few times it's best to store it rather than calculate it each time.

$if($and($stricmp($codec(),Vorbis),$or($greater($get(kbps),224),$greater(96,$get(kbps)))),#0000FF#)
The main bit. Basically: IF (codec = Vorbis) AND (kbps > 224 OR kbps < 96) set colour to red

$get(kbps) kbps
Display the bitrate

##
Set the colour back to default (whether red or not - saves more calculating)
Sebastian Mares
QUOTE(Synthetic Soul @ Apr 2 2005, 02:01 PM)
$puts(kbps,$if2(%__bitrate_dynamic%,%__bitrate%))
$codec()  |  $if($and($stricmp($codec(),Vorbis),$or($greater($get(kbps),224),$greater(96,$get(kbps)))),#0000FF#)$get(kbps) kbps##  |  %__samplerate% Hz  |  $ifgreater(%__channels%,2,%__channels% Channels,$ifgreater(%__channels%,1,Stereo,Mono))$char(9)$if(%_time_total%,[%_time_elapsed%] / [%_time_total%],[%_time_elapsed%])


...should do it.

Replace # with the color character (square block) - I can't seem to get them to dislpay.

Edit: was testing with MP3 and left it in, replaced with Vorbis now.

Edit 2:  Explanation:

$puts(kbps,$if2(%__bitrate_dynamic%,%__bitrate%))
Store the displayed bitrate in the variable kbps.  As we use this value a few times it's best to store it rather than calculate it each time.

$if($and($stricmp($codec(),Vorbis),$or($greater($get(kbps),224),$greater(96,$get(kbps)))),#0000FF#)
The main bit.  Basically:  IF (codec = Vorbis) AND (kbps > 224 OR kbps < 96) set colour to red

$get(kbps) kbps
Display the bitrate

##
Set the colour back to default (whether red or not - saves more calculating)
*



Thanks for that! smile.gif

The problem is that I wanted the color to remain red for the specific song when the bitrate was under 96 or over 224. So, if it once gets 84 for example, the color should remain red until another song begins.

Edit:
I guess I have to create a variable "bad". If the bitrate is lower than 96 or greater than 224 and "bad" is "0", set "bad" to "1". Then in the string... if "bad" is "1", change the color to red, otherwise use the default one. The problem is how to check if a new song started.
miscellanea
QUOTE(Sebastian Mares @ Apr 2 2005, 09:24 PM)
The problem is that I wanted the color to remain red for the specific song when the bitrate was under 96 or over 224. So, if it once gets 84 for example, the color should remain red until another song begins.
*


try unchecking :
Preferences -> Playback -> Input -> Standard inputs
VBR bitrate display > "Real-time bitrate display..." box.


another option. this can be applied not only Vorbis.

CODE
$codec()  |  
$if($or($greater(%__bitrate%,224),$greater(96,%__bitrate%)),$char(3)0000ff$char(3))
$if2(%__bitrate_dynamic% kbps,%__bitrate% kbps)$char(3)$char(3)  |  
%__samplerate% Hz  |  
$ifgreater(%__channels%,2,%__channels% Channels,$ifgreater(%__channels%,1,Stereo,Mono))
$char(9)
$if(%_time_total%,[%_time_elapsed%] / [%_time_total%],[%_time_elapsed%])

if you choose this you don't have to uncheck it.
gfngfgf
I don't think what you're looking for is possible with the current version of foobar. The problem is that foobar's titleformatting doesn't have any "memory". Any variables you create aren't saved. They only exist for as long as foobar is trying to interpret that particular titleformatting string.
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.