diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-09-23 18:56:11 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-09-23 18:56:11 +0000 |
| commit | 8fe3a3aaa93ddbd61f949c8fa9d9385f8404b3a8 (patch) | |
| tree | 191ed3ddb1787c7301a01767dc7b9b7c380883e9 /src/plugins/General/rgscan | |
| parent | aef9794768db746832f62b75c70c59dd5b087d1d (diff) | |
| download | qmmp-8fe3a3aaa93ddbd61f949c8fa9d9385f8404b3a8.tar.gz qmmp-8fe3a3aaa93ddbd61f949c8fa9d9385f8404b3a8.tar.bz2 qmmp-8fe3a3aaa93ddbd61f949c8fa9d9385f8404b3a8.zip | |
added replaygain test code
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3719 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/rgscan')
| -rw-r--r-- | src/plugins/General/rgscan/rgscaner.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/plugins/General/rgscan/rgscaner.cpp b/src/plugins/General/rgscan/rgscaner.cpp index f2749c403..f2e5ba8b1 100644 --- a/src/plugins/General/rgscan/rgscaner.cpp +++ b/src/plugins/General/rgscan/rgscaner.cpp @@ -30,6 +30,7 @@ #include <taglib/fileref.h> #include <taglib/tag.h> #include <taglib/mpegfile.h> +#include "gain_analysis.h" #include "rgscaner.h" #define QStringToTString_qt4(s) TagLib::String(s.toUtf8().constData(), TagLib::String::UTF8) @@ -138,6 +139,14 @@ void RGScaner::run() qint64 total = 0; quint64 len = 0; qint64 totalSize = m_decoder->totalTime() * ap.sampleRate() * ap.channels() * ap.sampleSize() / 1000; + double out_left[8192/4]; + double out_right[8192/4]; + + + GainHandle_t *handle = 0; + + InitGainAnalysis(&handle, 44100); + forever { @@ -148,11 +157,23 @@ void RGScaner::run() output_at += len; total += len; emit progress(100 * total / totalSize); + + + for(int i = 0; i < len/4; ++i) + { + out_left[i] = ((short *) output_buf)[i*2]; + out_right[i] = ((short *) output_buf)[i*2+1]; + } + AnalyzeSamples(handle, out_left, out_right, len/4, 2); + output_at = 0; } else if (len <= 0) break; } + + qDebug("gain=%f",GetTitleGain(handle)); + qDebug("RGScaner: thread %ld finished", QThread::currentThreadId()); emit progress(100); emit finished(); |
