00001
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __AlsaMixer_h
00030 #define __AlsaMixer_h
00031
00032 #if HAVE_CONFIG_H
00033 #include "config.h"
00034 #endif
00035
00036 #include "AlsaMixerInterface.hpp"
00037 #include "AlsaMixerElements.hpp"
00038 #include "AlsaSoundCardInterface.hpp"
00039 #include <string>
00040 #include <vector>
00041 #include <alsa/asoundlib.h>
00042
00044
00046
00047 namespace Gizmod {
00048
00050
00052
00054
00056
00061 class AlsaMixer : public AlsaMixerInterface, public AlsaMixerElements {
00062 public:
00063
00064
00065
00066 std::string getName() const;
00067 std::string getNameShort() const;
00068 bool setSwitchCapture(bool Enable);
00069 bool setSwitchPlayback(bool Enable);
00070 bool setVolumeCapture(long Volume);
00071 bool setVolumeCapturePercent(float Percent);
00072 bool setVolumePlayback(long Volume);
00073 bool setVolumePlaybackPercent(float Percent);
00074 int signalMixerEvent();
00075
00076
00077 AlsaMixer();
00078 AlsaMixer(AlsaSoundCardInterface * piSoundCard, snd_mixer_elem_t * MixerElement, std::string MixerName, std::string MixerNameUnique, unsigned int MixerID);
00079 virtual ~AlsaMixer();
00080
00081
00082 static int MixerElemCallback(snd_mixer_elem_t * MixerElement, unsigned int EventMask);
00083
00084 private:
00085
00086 void init();
00087 int mixerElemCallback(snd_mixer_elem_t * MixerElement, unsigned int EventMask);
00088 void populateInfo();
00089 void shutdown();
00090
00091
00092 AlsaInterface * mpiAlsa;
00093 snd_mixer_elem_t * mMixerElement;
00094 std::string mMixerName;
00095 std::string mMixerNameUnique;
00096 unsigned int mMixerID;
00097 AlsaMixerElements mOldState;
00098 AlsaSoundCardInterface * mpiSoundCard;
00099
00100 private:
00101
00102 friend class boost::serialization::access;
00103 template<class Archive>
00104 void serialize(Archive & ar, const unsigned int version) {
00105 ar & boost::serialization::base_object<AlsaMixerElements>(*this);
00106 ar & mMixerName;
00107 ar & mMixerNameUnique;
00108 ar & mMixerID;
00109 ar & mOldState;
00110 }
00111 };
00112
00114
00115 }
00116
00117 #endif // __AlsaMixer_h