diff options
| author | Calvin Morrison <calvin@pobox.com> | 2026-05-22 10:16:15 -0400 |
|---|---|---|
| committer | Calvin Morrison <calvin@pobox.com> | 2026-05-22 10:16:15 -0400 |
| commit | cdf72828e599a63fca4a0f1ceeb3145fba581aa3 (patch) | |
| tree | 16ee02f0ce1e317a09fd4c2a3f9fbdc04aadfe60 /src/model/alsamodel.h | |
| parent | b30b234afa3ec18156e432b9f2a7ad2ca80cc672 (diff) | |
| parent | d9876849f0208291cc7010522e85593703ff52bd (diff) | |
Merge branch 'and-the-oss-you-rode-in-on'
Diffstat (limited to 'src/model/alsamodel.h')
| -rw-r--r-- | src/model/alsamodel.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/model/alsamodel.h b/src/model/alsamodel.h new file mode 100644 index 0000000..fc8a0f0 --- /dev/null +++ b/src/model/alsamodel.h @@ -0,0 +1,54 @@ +#pragma once + +#include <tqobject.h> +#include <tqptrlist.h> +#include <tqvaluelist.h> +#include <tqmap.h> +#include <tqstring.h> +#include <alsa/asoundlib.h> + +#include "alsadevice.h" + +class TQSocketNotifier; + +struct AlsaCard { + int index; + TQString name; +}; + +class AlsaModel : public TQObject +{ + TQ_OBJECT +public: + explicit AlsaModel( TQObject *parent = 0 ); + ~AlsaModel(); + + bool open(); + void close(); + + TQValueList<AlsaCard> cards() const { return m_cards; } + TQPtrList<AlsaDevice> devices() const { return m_devices; } + TQPtrList<AlsaDevice> devicesForCard( int cardIndex ) const; + AlsaDevice *defaultOutput() const; + AlsaDevice *preferredOutput() const; + void setPreferredOutput( int cardIndex, const TQString &name ); + +signals: + void deviceAdded( AlsaDevice *dev ); + void preferredOutputChanged( AlsaDevice *dev ); + void ready(); + +private slots: + void onMixerFd( int fd ); + +private: + void openCard( int card ); + void addElement( int card, const TQString &cardName, + snd_mixer_elem_t *elem, AlsaDevice::Category cat ); + + TQValueList<AlsaCard> m_cards; + TQPtrList<AlsaDevice> m_devices; + TQPtrList<TQSocketNotifier> m_notifiers; + TQValueList<snd_mixer_t*> m_mixers; + TQMap<int, snd_mixer_t*> m_fdToMixer; +}; |
