Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmsaudioctrl.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider,             *
00003  *                           Matthias Hardt, Guido Madaus                  *
00004  *                                                                         *
00005  *   Copyright (C) 2007-2008 BerLinux Solutions GbR                        *
00006  *                           Stefan Schwarzer & Guido Madaus               *
00007  *                                                                         *
00008  *   Copyright (C) 2009-2013 BerLinux Solutions GmbH                       *
00009  *                                                                         *
00010  *   Authors:                                                              *
00011  *      Stefan Schwarzer   <stefan.schwarzer@diskohq.org>,                 *
00012  *      Matthias Hardt     <matthias.hardt@diskohq.org>,                   *
00013  *      Jens Schneider     <jens.schneider@diskohq.org>,                   *
00014  *      Guido Madaus       <guido.madaus@diskohq.org>,                     *
00015  *      Patrick Helterhoff <patrick.helterhoff@diskohq.org>,               *
00016  *      René Bählkow       <rene.baehlkow@diskohq.org>                     *
00017  *                                                                         *
00018  *   This library is free software; you can redistribute it and/or         *
00019  *   modify it under the terms of the GNU Lesser General Public            *
00020  *   License version 2.1 as published by the Free Software Foundation.     *
00021  *                                                                         *
00022  *   This library is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00025  *   Lesser General Public License for more details.                       *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU Lesser General Public      *
00028  *   License along with this library; if not, write to the                 *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
00031  **************************************************************************/
00032 
00033 #ifdef __HAVE_MIXER__
00034 #ifndef MMSAUDIOCTRL_H_
00035 #define MMSAUDIOCTRL_H_
00036 
00037 #include <alsa/asoundlib.h>
00038 
00039 #include "mmstools/mmstools.h"
00040 
00041 MMS_CREATEERROR(MMSAudioCtrlError);
00042 
00043 /**
00044  * @brief   Controls the audio device.
00045  *
00046  * @ingroup     mmsmedia
00047  *
00048  * @author      Stefan Schwarzer (stefan.schwarzer@diskohq.org)
00049  * @author      Matthias Hardt (matthias.hardt@diskohq.org)
00050  * @author      Jens Schneider (pupeider@gmx.de)
00051  * @author      Guido Madaus (guido.madaus@diskohq.org)
00052  * @author      Patrick Helterhoff (patrick.helterhoff@diskohq.org)
00053  * @author      René Bählkow (rene.baehlkow@diskohq.org)
00054  */
00055 class MMSAudioCtrl {
00056     private:
00057         static snd_mixer_t      *handle;    /**< alsa handle to mixer           */
00058         static snd_mixer_elem_t *elem;      /**< alsa mixer element handle      */
00059         static string           card;       /**< card id                        */
00060         static int              volume;     /**< volume (in percent)            */
00061         static long             xval;       /**< re-calculated volume for card  */
00062         static bool             muteFlag;   /**< if true sound is muted         */
00063         static long             pmin, pmax; /**< range (not in percent)         */
00064         static string           channel;    /**< current audio channel          */
00065         static bool             isSwitchable;  /**< has a switch (to mute)?        */
00066 
00067     public:
00068         /* constructor */
00069         MMSAudioCtrl(string channel="");
00070 
00071         /* destructor */
00072         ~MMSAudioCtrl();
00073 
00074         /* set volume (count in percent (0-100)) */
00075         void setVolume(int count);
00076 
00077         /* get volume */
00078         int getVolume(bool dfCard = false);
00079 
00080         /* change volume (count in percent (0-100)) */
00081         void volumeUp(int count = 10);
00082 
00083         /* change volume (count in percent (0-100)) */
00084         void volumeDown(int count = 10);
00085 
00086         /* check if is already mute */
00087         bool isMute();
00088 
00089         /* toggle mute on/off */
00090         void mute();
00091 };
00092 
00093 #endif /*MMSAUDIOCTRL_H_*/
00094 #endif /* __HAVE_MIXER__ */

Generated by doxygen