Fixed detection of 32-Bit Float data via SoX. For whatever reason SoX returns a "precision" of "24-Bit" for 32-Bit Float Wave files, so we have to detect the actual precision from the "sample encoding".

This commit is contained in:
LoRd_MuldeR 2012-03-08 23:04:00 +01:00
parent f47b033953
commit a2dc3bb295
2 changed files with 9 additions and 1 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 5
#define VER_LAMEXP_BUILD 902
#define VER_LAMEXP_BUILD 903
///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!)

View File

@ -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);
emit statusUpdated(qMin(progress += 25, 100));
}
if(regExp_samplerate.lastIndexIn(text) >= 0)
{
bool ok = false;