diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2012-12-08 09:30:33 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2012-12-08 09:30:33 +0000 |
| commit | 7e4685a76a0e09e3e321d0c1180d944801a95eb5 (patch) | |
| tree | 618fcca0ff1fac64b5524f0b3b2271430b423df6 /src | |
| parent | 6fd0672ae5d0a14d53ffdaa3c82883264b54b4ce (diff) | |
| download | qmmp-7e4685a76a0e09e3e321d0c1180d944801a95eb5.tar.gz qmmp-7e4685a76a0e09e3e321d0c1180d944801a95eb5.tar.bz2 qmmp-7e4685a76a0e09e3e321d0c1180d944801a95eb5.zip | |
convert to 16 bit only if output requires this
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3041 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
| -rw-r--r-- | src/qmmp/qmmpaudioengine.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/qmmp/qmmpaudioengine.cpp b/src/qmmp/qmmpaudioengine.cpp index 62612b990..9e41954a9 100644 --- a/src/qmmp/qmmpaudioengine.cpp +++ b/src/qmmp/qmmpaudioengine.cpp @@ -525,15 +525,31 @@ void QmmpAudioEngine::sendMetaData() OutputWriter *QmmpAudioEngine::createOutput() { OutputWriter *output = new OutputWriter(this); - if (!output->initialize(m_ap.sampleRate(), m_ap.channels(), m_ap.format()) || - output->audioParameters() != m_ap) //TODO add soundconverter + if (!output->initialize(m_ap.sampleRate(), m_ap.channels(), m_ap.format())) { qWarning("QmmpAudioEngine: unable to initialize output"); delete output; - output = 0; StateHandler::instance()->dispatch(Qmmp::FatalError); return 0; } + if(output->audioParameters() != m_ap) + { + if(output->audioParameters().format() == Qmmp::PCM_S16LE) //output supports 16 bit only + { + Effect *effect = new AudioConverter(); + effect->configure(m_ap.sampleRate(), m_ap.channels(), m_ap.format()); + m_ap = effect->audioParameters(); + qDebug("QmmpAudioEngine: output plugin requires 16 bit, using 16-bit converter"); + } + else + { + qWarning("QmmpAudioEngine: unsupported audio format"); + delete output; + StateHandler::instance()->dispatch(Qmmp::FatalError); + return 0; + } + } + if(m_output_buf) delete [] m_output_buf; m_bks = QMMP_BLOCK_FRAMES * m_ap.channels() * m_ap.sampleSize(); |
