diff options
Diffstat (limited to 'src/audio/devices.hpp')
-rw-r--r-- | src/audio/devices.hpp | 27 |
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; |