From dd7a52de6b056021b9e293a2566a53df12c02a0d Mon Sep 17 00:00:00 2001
From: Marek Blok <Marek.Blok@pg.edu.pl>
Date: Fri, 14 Apr 2023 10:56:54 +0200
Subject: [PATCH] Added new methods to TAudioMixer

---
 CHANGELOG                    |  2 ++
 src/cpp/DSP_AudioMixer.cpp   | 14 ++++++++++++++
 src/include/DSP_AudioMixer.h |  4 ++++
 src/include/DSP_lib.h        |  2 +-
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 1e0d608..16dfb6f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,8 @@ TODO::
 LAST DONE:
 
 CHANGES:
+- ver. 0.20.023 - <b>2022.04.14</b> Added: 
+  - added static methods TAudioMixer::GetNoOfWaveInDevices and TAudioMixer::GetNoOfWaveOutDevices
 - ver. 0.20.022 - <b>2022.04.04</b> Added: 
   - DSP::u::SymbolMapper - experimental support for QAM for even bits_per_symbol (Gray ordering) 
 - ver. 0.20.020 - <b>2022.04.04</b> Fixed: 
diff --git a/src/cpp/DSP_AudioMixer.cpp b/src/cpp/DSP_AudioMixer.cpp
index 67acef7..11354ce 100644
--- a/src/cpp/DSP_AudioMixer.cpp
+++ b/src/cpp/DSP_AudioMixer.cpp
@@ -24,6 +24,13 @@ const string TAudioMixer::PCMwaveFileName= "PCM wave file";
   std::vector<WAVEOUTCAPS> TAudioMixer::WaveOutCaps;
 #endif // WIN32
 
+long TAudioMixer::GetNoOfWaveInDevices(void) {
+#ifdef WIN32
+  return long(waveInGetNumDevs());
+#endif
+  return -1;
+}
+
 string TAudioMixer::GetWaveInDevName(UINT DevNo)
 {
 #ifdef WIN32
@@ -57,6 +64,13 @@ string TAudioMixer::GetWaveInDevName(UINT DevNo)
   return "";
 }
 
+long TAudioMixer::GetNoOfWaveOutDevices(void) {
+#ifdef WIN32
+  return long(waveOutGetNumDevs());
+#endif
+  return -1;
+}
+
 string TAudioMixer::GetWaveOutDevName(UINT DevNo)
 {
 #ifdef WIN32
diff --git a/src/include/DSP_AudioMixer.h b/src/include/DSP_AudioMixer.h
index 0d30969..5807843 100644
--- a/src/include/DSP_AudioMixer.h
+++ b/src/include/DSP_AudioMixer.h
@@ -57,7 +57,11 @@ class TAudioMixer
 #endif // WIN32
 
   public:
+    //! returns number of currently available WaveIn devices or -1 if not supported in current configuration
+    static long GetNoOfWaveInDevices(void);
     static string GetWaveInDevName(UINT DevNo=WAVE_MAPPER );
+    //! returns number of currently available WaveOut devices or -1 if not supported in current configuration
+    static long GetNoOfWaveOutDevices(void);
     static string GetWaveOutDevName(UINT DevNo=WAVE_MAPPER );
 
     bool MixerSupported;
diff --git a/src/include/DSP_lib.h b/src/include/DSP_lib.h
index 9d1bcf8..cab06de 100644
--- a/src/include/DSP_lib.h
+++ b/src/include/DSP_lib.h
@@ -11,7 +11,7 @@
 
 #define DSP_VER_MAJOR 0
 #define DSP_VER_MINOR 20
-#define DSP_VER_BUILD 22 // !!! without zeroes before, else this will be treated as octal number
+#define DSP_VER_BUILD 23 // !!! without zeroes before, else this will be treated as octal number
 #define DSP_VER_YEAR  2023
 #define DSP_VER       DSP_VER_MAJOR.DSP_VER_MINOR.DSP_VER_BUILD
 
-- 
GitLab