diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-02-21 12:22:00 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2013-02-21 12:22:00 +0000 |
| commit | 08f658b636c39705f2b919a185bb55ed7c053f59 (patch) | |
| tree | cc094ce1de1aa4fa40a4da43f87e348710997dc8 /src/plugins/Output | |
| parent | be420a9ec95d103429e383ea1e9020832ca3b000 (diff) | |
| download | qmmp-08f658b636c39705f2b919a185bb55ed7c053f59.tar.gz qmmp-08f658b636c39705f2b919a185bb55ed7c053f59.tar.bz2 qmmp-08f658b636c39705f2b919a185bb55ed7c053f59.zip | |
waveout plugin: using software volume as fallback
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3275 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Output')
| -rw-r--r-- | src/plugins/Output/waveout/outputwaveout.cpp | 8 | ||||
| -rw-r--r-- | src/plugins/Output/waveout/outputwaveout.h | 2 | ||||
| -rw-r--r-- | src/plugins/Output/waveout/outputwaveoutfactory.cpp | 11 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/Output/waveout/outputwaveout.cpp b/src/plugins/Output/waveout/outputwaveout.cpp index 25791ff64..dc058ee6e 100644 --- a/src/plugins/Output/waveout/outputwaveout.cpp +++ b/src/plugins/Output/waveout/outputwaveout.cpp @@ -260,3 +260,11 @@ VolumeSettings VolumeWaveOut::volume() const vol.right = (long)HIWORD(data) * 100 / 0xFFFF + 1;
return vol;
}
+
+bool VolumeWaveOut::isSupported() const
+{
+ WAVEOUTCAPS waveCaps;
+ if(waveOutGetDevCaps(0,(LPWAVEOUTCAPS)&waveCaps, sizeof(WAVEOUTCAPS)) != MMSYSERR_NOERROR)
+ return false;
+ return (waveCaps.dwSupport & WAVECAPS_VOLUME) != 0;
+}
diff --git a/src/plugins/Output/waveout/outputwaveout.h b/src/plugins/Output/waveout/outputwaveout.h index 22e437a81..b6f924787 100644 --- a/src/plugins/Output/waveout/outputwaveout.h +++ b/src/plugins/Output/waveout/outputwaveout.h @@ -59,6 +59,8 @@ public: void setVolume(const VolumeSettings &vol);
VolumeSettings volume() const;
+
+ bool isSupported() const;
};
diff --git a/src/plugins/Output/waveout/outputwaveoutfactory.cpp b/src/plugins/Output/waveout/outputwaveoutfactory.cpp index 62d8a8f32..ee282147e 100644 --- a/src/plugins/Output/waveout/outputwaveoutfactory.cpp +++ b/src/plugins/Output/waveout/outputwaveoutfactory.cpp @@ -1,5 +1,5 @@ /***************************************************************************
- * Copyright (C) 2009-2012 by Ilya Kotov *
+ * Copyright (C) 2009-2013 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -40,7 +40,14 @@ Output* OutputWaveOutFactory::create() Volume *OutputWaveOutFactory::createVolume()
{
- return new VolumeWaveOut();
+ VolumeWaveOut *vol = new VolumeWaveOut();
+ if(!vol->isSupported())
+ {
+ qDebug("OutputWaveOutFactory: device doesn't support volume control");
+ delete vol;
+ return 0;
+ }
+ return vol;
}
void OutputWaveOutFactory::showSettings(QWidget* parent)
|
