diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | e2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch) | |
tree | 9047cf9e6b5c43878d5bf82660adae77ceee097a /kmix/volume.h | |
download | tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmix/volume.h')
-rw-r--r-- | kmix/volume.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/kmix/volume.h b/kmix/volume.h new file mode 100644 index 00000000..9051ed0c --- /dev/null +++ b/kmix/volume.h @@ -0,0 +1,80 @@ +// -*-C++-*- +#ifndef VOLUME_H +#define VOLUME_H + +#include <fstream> + +#include <kdebug.h> + +class Volume +{ + public: + enum ChannelMask { MNONE = 0, + MLEFT = 1, MRIGHT = 2, MCENTER = 4, + MMAIN = 3, MFRONT = 7, + MREARLEFT = 8, MREARRIGHT = 16, MWOOFER = 32, + MREAR = 56, + MLEFTREC = 64, MRIGHTREC = 128, + MREC =192, + MCUSTOM1 =256, MCUSTOM2 = 512, + MALL=65535 }; + + + enum ChannelID { CHIDMIN = 0, + LEFT = 0, RIGHT = 1, CENTER = 2, + REARLEFT = 3, REARRIGHT = 4, WOOFER = 5, + LEFTREC = 6, RIGHTREC = 7, + CUSTOM1 = 8, CUSTOM2 = 9, CHIDMAX = 9 }; + + + Volume( ChannelMask chmask = MALL, long maxVolume = 100, long minVolume=0, bool isCapture=false ); + Volume( const Volume &v ); + Volume( int channels, long maxVolume ); + + + + // Set all volumes as given by vol + void setAllVolumes(long vol); + // Set all volumes to the ones given in vol + void setVolume(const Volume &vol ); + // Set volumes as specified by the channel mask + void setVolume( const Volume &vol, ChannelMask chmask); + void setVolume( ChannelID chid, long volume); + + long getVolume(ChannelID chid); + long getAvgVolume(ChannelMask chmask); + long getTopStereoVolume(ChannelMask chmask); + long operator[](int); + long maxVolume(); + long minVolume(); + int count(); + + void setMuted( bool val ) { _muted = val; }; + bool isMuted() { return _muted; }; + bool isCapture() { return _isCapture; }; + + friend std::ostream& operator<<(std::ostream& os, const Volume& vol); + friend kdbgstream& operator<<(kdbgstream& os, const Volume& vol); + + // _channelMaskEnum[] and the following elements moved to public seection. operator<<() could not + // access it, when private. Strange, as operator<<() is declared friend. + static int _channelMaskEnum[10]; + bool _muted; + bool _isCapture; // true, when the Volume represents capture/record levels + long _chmask; + long _volumes[CHIDMAX+1]; + long _maxVolume; + long _minVolume; + +private: + void init( ChannelMask chmask, long, long, bool ); + + long volrange( int vol ); + long volrangeRec( int vol ); +}; + +std::ostream& operator<<(std::ostream& os, const Volume& vol); +kdbgstream& operator<<(kdbgstream &os, const Volume& vol); + +#endif // VOLUME + |