libGizmod/AlsaMixer.hpp

Go to the documentation of this file.
00001 
00012 /*
00013   
00014   Copyright (c) 2007, Tim Burrell
00015   Licensed under the Apache License, Version 2.0 (the "License");
00016   you may not use this file except in compliance with the License.
00017   You may obtain a copy of the License at 
00018 
00019         http://www.apache.org/licenses/LICENSE-2.0
00020 
00021   Unless required by applicable law or agreed to in writing, software
00022   distributed under the License is distributed on an "AS IS" BASIS,
00023   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00024   See the License for the specific language governing permissions and 
00025   limitations under the License. 
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 // Namespace
00046 
00047 namespace Gizmod {
00048 
00050 // Typedefs
00052 
00054 // AlsaMixer Class Definition
00056 
00061 class AlsaMixer : public AlsaMixerInterface, public AlsaMixerElements {
00062 public: 
00063         // public member variables
00064         
00065         // public functions
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         // construction / deconstruction
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         // public static functions
00082         static int                      MixerElemCallback(snd_mixer_elem_t * MixerElement, unsigned int EventMask); 
00083 
00084 private:
00085         // private functions
00086         void                            init();                         
00087         int                             mixerElemCallback(snd_mixer_elem_t * MixerElement, unsigned int EventMask); 
00088         void                            populateInfo();                 
00089         void                            shutdown();                     
00090                 
00091         // private member variables
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         // serialization
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 } // Gizmod namespace
00116 
00117 #endif // __AlsaMixer_h

Generated on Wed Jun 27 12:41:53 2007 for gizmod by  doxygen 1.4.7