#pragma once #include #include #include #include class AlsaDevice : public TQObject { TQ_OBJECT public: enum Category { Output, Input, Neutral }; enum Type { Slider, Switch, Enum }; AlsaDevice( Category cat, int cardIndex, snd_mixer_elem_t *elem, const TQString &cardName, TQObject *parent = 0 ); TQString name() const { return m_name; } TQString cardName() const { return m_cardName; } int cardIndex() const { return m_cardIndex; } Category category() const { return m_category; } Type type() const { return m_type; } // Slider int volume() const { return m_volume; } bool muted() const { return m_muted; } int pan() const { return m_pan; } bool stereo() const { return m_stereo; } bool hasMute() const { return m_hasMute; } void setVolume( int v ); void setMuted( bool m ); void setPan( int p ); // Enum TQStringList enumValues() const { return m_enumValues; } int enumId() const { return m_enumId; } void setEnumId( int id ); void syncFromAlsa(); static int elemCallback( snd_mixer_elem_t *elem, unsigned int mask ); signals: void volumeChanged( int v ); void muteChanged( bool m ); void panChanged( int p ); void enumChanged( int id ); private: long toAlsaVol( int pct ) const; void pushVolume(); Category m_category; Type m_type; int m_cardIndex; snd_mixer_elem_t *m_elem; TQString m_name; TQString m_cardName; bool m_stereo; bool m_hasMute; long m_volMin; long m_volMax; int m_volume; bool m_muted; int m_pan; TQStringList m_enumValues; int m_enumId; };