libGizmod/Alsa.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 __Alsa_h
00030 #define __Alsa_h
00031 
00032 #if HAVE_CONFIG_H
00033 #include "config.h"
00034 #endif
00035 
00036 #include "AlsaEvent.hpp"
00037 #include "AlsaSoundCard.hpp"
00038 #include "AlsaMixer.hpp"
00039 #include <string>
00040 #include <vector>
00041 #include <list>
00042 #include <alsa/asoundlib.h>
00043 #include <boost/shared_ptr.hpp>
00044 
00046 // Namespace
00048 
00055 namespace Gizmod {
00056 
00058 // Typedefs
00060 
00062 // Alsa Class Definition
00064 
00072 class Alsa : public AlsaInterface { friend class AlsaMixer;
00073 public: 
00074         // public functions
00075         void                            init();                 
00076         AlsaMixer const *               getDefaultMixerSwitch();
00077         AlsaMixer const *               getDefaultMixerVolume();
00078         size_t                          getNumSoundCards();     
00079         AlsaSoundCard const *           getSoundCard(int Index);
00080         void                            toggleMuteAllCards();   
00081         virtual void                    onAlsaEventMixerElementAttach(AlsaEvent const & Event, AlsaSoundCard const & SoundCard, AlsaMixer const & Mixer); 
00082         virtual void                    onAlsaEventMixerElementChange(AlsaEvent const & Event, AlsaSoundCard const & SoundCard, AlsaMixer const & Mixer); 
00083         virtual void                    onAlsaEventMixerElementDetach(AlsaEvent const & Event, AlsaSoundCard const & SoundCard, AlsaMixer const & Mixer); 
00084         virtual void                    onAlsaEventSoundCardAttach(AlsaEvent const & Event, AlsaSoundCard const & SoundCard); 
00085         virtual void                    onAlsaEventSoundCardDetach(AlsaEvent const & Event, AlsaSoundCard const & SoundCard); 
00086         void                            registerDefaultMixerPriority(std::string MixerName); 
00087         void                            shutdown();             
00088 
00089         // construction / deconstruction
00090         Alsa();
00091         virtual ~Alsa();
00092         
00093         // public static functions
00094 
00095 private:
00096         // private functions
00097         void                            _onAlsaEventMixerElementChange(AlsaEvent const & Event, AlsaSoundCard const & SoundCard, AlsaMixer & Mixer); 
00098                 
00099         // private member variables
00100         std::list<std::string>          mDefaultMixerPriorities;
00101         int                             mDefaultMixerVolumePriority; 
00102         int                             mDefaultMixerSwitchPriority; 
00103         AlsaMixer *                     mpDefaultMixerSwitch;   
00104         AlsaMixer *                     mpDefaultMixerVolume;   
00105         bool                            mMuted;                 
00106         std::vector< boost::shared_ptr<AlsaSoundCard> > mSoundCards; 
00107 };
00108 
00110 
00111 } // Gizmod namespace
00112 
00113 #endif // __Alsa_h

Generated on Wed Nov 7 10:04:16 2007 for gizmod by  doxygen 1.5.3