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: Displaying Bits per Sample in Status Bar If Encoding Is Lossless (Read 1758 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Displaying Bits per Sample in Status Bar If Encoding Is Lossless

Hello, I am editing my status bar within Foobar2000. Currently, I have set the following to display:

FLAC | 16/44.1 kHz | 716 kbps | stereo | 3:37 / 4:02

This is displayed - and works as desired when lossless files are played - with the following string.

%codec% | $info(bitspersample)/$div(%samplerate%,1000).$right($div(%samplerate%,100),1) kHz | %bitrate% kbps | %channels% | %playback_time%[ / %length%]

However, when playing a lossy encoded file (mp3 and AAC in my case), bits per sample is not displayed; instead showing the following, for example:

MP3 | /44.1 kHz | 320 kbps | stereo | 3:37 / 4:02

When playing lossy files, I would like the following to instead appear (without the above slash prior to sample rate); with bits per sample returning while playing a file with lossless encoding.

MP3 | 44.1 kHz | 320 kbps | stereo | 3:37 / 4:02
FLAC | 16/44.1 kHz | 716 kbps | stereo | 3:37 / 4:02

What must be edited in the string to ensure bits per sample appears if the file is lossless encoded; but not appear if the file is lossy encoded?

Thank you.


Re: Displaying Bits per Sample in Status Bar If Encoding Is Lossless

Reply #1
Enclose the variable with surrounding punctuation marks in square brackets to display it only if it is present. This is a shorthand for $if().

[$info(bitspersample)/]

To display something based on the encoding accuracy, do this:

$if($strcmp(%__encoding%,lossless),[%__bitspersample%/],)

 

Re: Displaying Bits per Sample in Status Bar If Encoding Is Lossless

Reply #2
$if($strcmp(%__encoding%,lossless),[%__bitspersample%/],)

Thank you - that's exactly the result I was after. Works flawlessly. I appreciate that greatly.