OSDN Git Service

Welcome to year 2013 ;-)
[lamexp/LameXP.git] / src / Tool_WaveProperties.cpp
index 292c084..a090b8e 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 // LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -61,6 +61,7 @@ bool WaveProperties::detect(const QString &sourceFile, AudioFileModel *info, vol
        QRegExp regExp_samplerate("Sample Rate\\s*:\\s*(\\d+)", Qt::CaseInsensitive);
        QRegExp regExp_duration("Duration\\s*:\\s*(\\d\\d):(\\d\\d):(\\d\\d)\\.(\\d\\d)", Qt::CaseInsensitive);
        QRegExp regExp_channels("Channels\\s*:\\s*(\\d+)", Qt::CaseInsensitive);
+       QRegExp regExp_encoding("Sample Encoding\\s*:\\s*(\\d+)-bit\\s*Float", Qt::CaseInsensitive); //SoX returns a precision of 24-Bit for 32-Bit Float data, so we detect it this way!
 
        while(process.state() != QProcess::NotRunning)
        {
@@ -91,6 +92,13 @@ bool WaveProperties::detect(const QString &sourceFile, AudioFileModel *info, vol
                                if(ok) info->setFormatAudioBitdepth(tmp);
                                emit statusUpdated(qMin(progress += 25, 100));
                        }
+                       if(regExp_encoding.lastIndexIn(text) >= 0)
+                       {
+                               bool ok = false;
+                               unsigned int tmp = regExp_encoding.cap(1).toUInt(&ok);
+                               if(ok) info->setFormatAudioBitdepth((tmp == 32) ? AudioFileModel::BITDEPTH_IEEE_FLOAT32 : tmp);
+                               emit statusUpdated(qMin(progress += 25, 100));
+                       }
                        if(regExp_samplerate.lastIndexIn(text) >= 0)
                        {
                                bool ok = false;