From 946f90efdbeaa5809aeb7db583989a890a0d4edc Mon Sep 17 00:00:00 2001 From: Wieland Hoffmann Date: Sun, 4 Nov 2012 21:54:39 +0100 Subject: [PATCH] song_info: Do not limit the 'channels' diplay to mono/stereo but keep the "mono"/"stereo" display for the simple cases. --- src/song_info.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/song_info.cpp b/src/song_info.cpp index ecda9947..0c93114f 100644 --- a/src/song_info.cpp +++ b/src/song_info.cpp @@ -28,6 +28,7 @@ #ifdef HAVE_TAGLIB_H # include "fileref.h" # include "tag.h" +# include "boost/lexical_cast.hpp" #endif // HAVE_TAGLIB_H using Global::MainHeight; @@ -108,9 +109,22 @@ void SongInfo::PrepareSong(MPD::Song &s) TagLib::FileRef f(path_to_file.c_str()); if (!f.isNull()) { + std::string channels; + switch (f.audioProperties()->channels()) + { + case 1: + channels = "Mono"; + break; + case 2: + channels = "Stereo"; + break; + default: + channels = boost::lexical_cast(f.audioProperties()->channels()); + break; + } w << NC::Format::Bold << "Bitrate: " << NC::Format::NoBold << Config.color2 << f.audioProperties()->bitrate() << " kbps\n" << NC::Color::End; w << NC::Format::Bold << "Sample rate: " << NC::Format::NoBold << Config.color2 << f.audioProperties()->sampleRate() << " Hz\n" << NC::Color::End; - w << NC::Format::Bold << "Channels: " << NC::Format::NoBold << Config.color2 << (f.audioProperties()->channels() == 1 ? "Mono" : "Stereo") << '\n' << NC::Color::Default; + w << NC::Format::Bold << "Channels: " << NC::Format::NoBold << Config.color2 << channels << '\n' << NC::Color::Default; } } # endif // HAVE_TAGLIB_H