From c41f44356491c77aa9a5e8083e7135e50ee753ea Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 6 Aug 2011 12:08:03 +0000 Subject: fixed windows build git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2294 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Output/waveout/outputwaveout.cpp | 40 +++++++++++++++------------- src/plugins/Output/waveout/outputwaveout.h | 3 +-- 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/plugins/Output/waveout/outputwaveout.cpp b/src/plugins/Output/waveout/outputwaveout.cpp index e4263208f..f95100aac 100644 --- a/src/plugins/Output/waveout/outputwaveout.cpp +++ b/src/plugins/Output/waveout/outputwaveout.cpp @@ -94,8 +94,13 @@ OutputWaveOut::~OutputWaveOut() uninitialize(); } -void OutputWaveOut::configure(quint32 freq, int chan, Qmmp::AudioFormat format) +bool OutputWaveOut::initialize(quint32 freq, int chan, Qmmp::AudioFormat format) { + if (!waveOutGetNumDevs ()) + { + qWarning("OutputWaveOut: no audio device found"); + return false; + } WAVEFORMATEX fmt; UINT deviceID = WAVE_MAPPER; @@ -109,36 +114,33 @@ void OutputWaveOut::configure(quint32 freq, int chan, Qmmp::AudioFormat format) switch (waveOutOpen (&dev, deviceID, &fmt, (DWORD)wave_callback, 0, CALLBACK_FUNCTION)) { case MMSYSERR_ALLOCATED: - return qWarning("OutputWaveOut: Device is already open."); + qWarning("OutputWaveOut: Device is already open."); + return false; case MMSYSERR_BADDEVICEID: - return qWarning("OutputWaveOut: The specified device is out of range."); + qWarning("OutputWaveOut: The specified device is out of range."); + return false; case MMSYSERR_NODRIVER: - return qWarning("OutputWaveOut: There is no audio driver in this system."); + qWarning("OutputWaveOut: There is no audio driver in this system."); + return false; case MMSYSERR_NOMEM: - return qWarning("OutputWaveOut: Unable to allocate sound memory."); + qWarning("OutputWaveOut: Unable to allocate sound memory."); + return false; case WAVERR_BADFORMAT: - return qWarning("OutputWaveOut: This audio format is not supported."); + qWarning("OutputWaveOut: This audio format is not supported."); + return false; case WAVERR_SYNC: - return qWarning("OutputWaveOut: The device is synchronous."); + qWarning("OutputWaveOut: The device is synchronous."); + return false; default: - return qWarning("OutputWaveOut: Unknown media error."); + qWarning("OutputWaveOut: Unknown media error."); + return false; case MMSYSERR_NOERROR: break; } waveOutReset (dev); InitializeCriticalSection ( &cs ); - Output::configure(freq, chan, format); - return; -} - -bool OutputWaveOut::initialize() -{ - if (!waveOutGetNumDevs ()) - { - qWarning("OutputWaveOut: no audio device found"); - return false; - } + configure(freq, chan, format); return true; } diff --git a/src/plugins/Output/waveout/outputwaveout.h b/src/plugins/Output/waveout/outputwaveout.h index a0292335e..2d019ef6e 100644 --- a/src/plugins/Output/waveout/outputwaveout.h +++ b/src/plugins/Output/waveout/outputwaveout.h @@ -36,8 +36,7 @@ public: OutputWaveOut(QObject * parent = 0); ~OutputWaveOut(); - bool initialize(); - void configure(quint32, int, Qmmp::AudioFormat format); + bool initialize(quint32, int, Qmmp::AudioFormat format); qint64 latency(); private: -- cgit v1.2.3-13-gbd6f