summaryrefslogtreecommitdiff
path: root/src/audio/devices.hpp
diff options
context:
space:
mode:
authorzeldakatze <coffee@zeldakatze.de>2025-08-06 23:28:30 +0200
committerzeldakatze <coffee@zeldakatze.de>2025-08-06 23:28:30 +0200
commit0fce665f5da7119809b2d5ce13eb763a6c2eb4c6 (patch)
tree7374bbfd647520aabe259b7a18e222f4fe462058 /src/audio/devices.hpp
parent041cc20d66ac91a0f5f6917f1ffb6247bdc5923a (diff)
downloadabaddon-portaudio-0fce665f5da7119809b2d5ce13eb763a6c2eb4c6.tar.gz
abaddon-portaudio-0fce665f5da7119809b2d5ce13eb763a6c2eb4c6.zip
add portaudio
Diffstat (limited to 'src/audio/devices.hpp')
-rw-r--r--src/audio/devices.hpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/audio/devices.hpp b/src/audio/devices.hpp
index c83bdb4..54d1713 100644
--- a/src/audio/devices.hpp
+++ b/src/audio/devices.hpp
@@ -4,7 +4,13 @@
// clang-format off
#include <gtkmm/liststore.h>
+
+#ifndef USE_PORTAUDIO
#include <miniaudio.h>
+#else
+#include <portaudio.h>
+#endif
+
#include <optional>
// clang-format on
@@ -16,13 +22,26 @@ public:
Glib::RefPtr<Gtk::ListStore> GetPlaybackDeviceModel();
Glib::RefPtr<Gtk::ListStore> GetCaptureDeviceModel();
+ #ifndef USE_PORTAUDIO
void SetDevices(ma_device_info *pPlayback, ma_uint32 playback_count, ma_device_info *pCapture, ma_uint32 capture_count);
+ #else
+ /* call Pa directly */
+ void SetDevices();
+ #endif
+#ifdef USE_PORTAUDIO
+ [[nodiscard]] std::optional<PaDeviceIndex> GetPlaybackDeviceIDFromModel(const Gtk::TreeModel::iterator &iter) const;
+ [[nodiscard]] std::optional<PaDeviceIndex> GetCaptureDeviceIDFromModel(const Gtk::TreeModel::iterator &iter) const;
+
+ [[nodiscard]] std::optional<PaDeviceIndex> GetDefaultPlayback() const;
+ [[nodiscard]] std::optional<PaDeviceIndex> GetDefaultCapture() const;
+#else
[[nodiscard]] std::optional<ma_device_id> GetPlaybackDeviceIDFromModel(const Gtk::TreeModel::iterator &iter) const;
[[nodiscard]] std::optional<ma_device_id> GetCaptureDeviceIDFromModel(const Gtk::TreeModel::iterator &iter) const;
[[nodiscard]] std::optional<ma_device_id> GetDefaultPlayback() const;
[[nodiscard]] std::optional<ma_device_id> GetDefaultCapture() const;
+#endif
void SetActivePlaybackDevice(const Gtk::TreeModel::iterator &iter);
void SetActiveCaptureDevice(const Gtk::TreeModel::iterator &iter);
@@ -36,7 +55,11 @@ private:
PlaybackColumns();
Gtk::TreeModelColumn<Glib::ustring> Name;
+#ifdef USE_PORTAUDIO
+ Gtk::TreeModelColumn<PaDeviceIndex> DeviceID;
+#else
Gtk::TreeModelColumn<ma_device_id> DeviceID;
+#endif
};
PlaybackColumns m_playback_columns;
Glib::RefPtr<Gtk::ListStore> m_playback;
@@ -48,7 +71,11 @@ private:
CaptureColumns();
Gtk::TreeModelColumn<Glib::ustring> Name;
+#ifndef USE_PORTAUDIO
Gtk::TreeModelColumn<ma_device_id> DeviceID;
+#else /* USE_PORTAUDIO */
+ Gtk::TreeModelColumn<PaDeviceIndex> DeviceID;
+#endif /* USE_PORTAUDIO */
};
CaptureColumns m_capture_columns;
Glib::RefPtr<Gtk::ListStore> m_capture;