aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Output/out_ds/DevEnum.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Output/out_ds/DevEnum.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Plugins/Output/out_ds/DevEnum.h')
-rw-r--r--Src/Plugins/Output/out_ds/DevEnum.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/Src/Plugins/Output/out_ds/DevEnum.h b/Src/Plugins/Output/out_ds/DevEnum.h
new file mode 100644
index 00000000..13bcf583
--- /dev/null
+++ b/Src/Plugins/Output/out_ds/DevEnum.h
@@ -0,0 +1,67 @@
+#ifndef NULLSOFT_OUT_DS_DEVENUM_H
+#define NULLSOFT_OUT_DS_DEVENUM_H
+
+#include <windows.h>
+#include <mmsystem.h>
+#include <dsound.h>
+#include "res_wa2/resource.h"
+#include "api.h"
+#include "../Winamp/out.h"
+
+class DsDevEnum
+{
+private:
+ struct DS_DEV
+ {
+ DS_DEV *next;
+ TCHAR *name;
+ GUID guid;
+ } ;
+
+ DS_DEV *pDev;
+
+ DS_DEV *ds_devs;
+ static BOOL WINAPI DSEnumCallback(LPGUID guid, LPCTSTR desc, LPCTSTR, DS_DEV *** var);
+public:
+
+ const GUID GetGuid();
+ inline const TCHAR *GetName(const TCHAR *def = TEXT("device not found")) {
+ static wchar_t defStr[64];
+ return pDev ? pDev->name : WASABI_API_LNGSTRINGW_BUF(IDS_DEVICE_NOT_FOUND,defStr,64);
+ }
+ inline bool operator++(int) {if (pDev) pDev = pDev->next; return pDev ? true : false;}
+ inline operator bool() {return pDev ? true : false;}
+ bool FindGuid(const GUID & g);
+ bool FindDefault();
+ bool FindName(LPCTSTR n);
+
+ DsDevEnum();
+ ~DsDevEnum();
+ inline void Reset() {pDev = ds_devs;}
+
+ static bool GetCapsFromGuid(const GUID *dev, LPDSCAPS pCaps, DWORD * speakercfg = 0);
+
+ inline bool GetCaps(LPDSCAPS pCaps, DWORD * speakercfg = 0) { return GetCapsFromGuid(&pDev->guid, pCaps, speakercfg);}
+};
+
+//helpers
+class DsDevEnumGuid : public DsDevEnum
+{
+public:
+ DsDevEnumGuid(const GUID & g) {FindGuid(g);}
+};
+
+class DsDevEnumName : public DsDevEnum
+{
+public:
+ DsDevEnumName(LPCTSTR n) {FindName(n);}
+};
+
+class DsDevEnumDefault : public DsDevEnum
+{
+public:
+ DsDevEnumDefault() {FindDefault();}
+};
+
+
+#endif \ No newline at end of file