diff options
| -rw-r--r-- | src/plugins/Output/waveout/outputwaveout.cpp | 40 | ||||
| -rw-r--r-- | src/plugins/Output/waveout/outputwaveout.h | 3 |
2 files changed, 22 insertions, 21 deletions
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:
|
