Planeshift
|
00001 /* 00002 * soundctrl.h 00003 * 00004 * Copyright (C) 2001-2010 Atomic Blue ([email protected], http://www.planeshift.it) 00005 * 00006 * Credits : Saul Leite <[email protected]> 00007 * Mathias 'AgY' Voeroes <[email protected]> 00008 * and all past and present planeshift coders 00009 * 00010 * This program is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU General Public License 00012 * as published by the Free Software Foundation (version 2 of the License. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00021 * 00022 */ 00023 00024 00025 #ifndef _SOUND_CONTROL_H_ 00026 #define _SOUND_CONTROL_H_ 00027 00028 00029 //==================================================================================== 00030 // Crystal Space Includes 00031 //==================================================================================== 00032 #include <cssysdef.h> 00033 #include <csutil/set.h> 00034 00035 //==================================================================================== 00036 // Project Includes 00037 //==================================================================================== 00038 #include <isoundctrl.h> 00039 00040 //------------------------------------------------------------------------------------ 00041 // Forward Declarations 00042 //------------------------------------------------------------------------------------ 00043 class SoundControl; 00044 00045 00049 struct iSoundControlListener 00050 { 00055 virtual void OnSoundChange(SoundControl* sndCtrl) = 0; 00056 }; 00057 00058 00071 class SoundControl: public iSoundControl 00072 { 00073 public: 00074 00079 SoundControl(int ID); 00080 00084 virtual ~SoundControl(); 00085 00090 void Subscribe(iSoundControlListener* listener); 00091 00096 void Unsubscribe(iSoundControlListener* listener); 00097 00101 virtual int GetID() const; 00102 00108 virtual void VolumeDampening(float damp); 00109 00114 virtual bool IsDampened() const; 00115 00119 virtual float GetVolume() const; 00120 00125 virtual void SetVolume(float vol); 00126 00130 virtual void Unmute(); 00131 00135 virtual void Mute(); 00136 00141 virtual bool GetToggle() const; 00142 00147 virtual void SetToggle(bool value); 00148 00153 virtual void DeactivateToggle(); 00154 00159 virtual void ActivateToggle(); 00160 00161 private: 00162 int id; 00163 bool isEnabled; 00164 bool isMuted; 00165 bool isDampened; 00166 float volume; 00167 float volumeDamp; 00168 00169 csSet<iSoundControlListener*> listeners; 00170 00174 void CallListeners(); 00175 00176 }; 00177 00178 #endif /*_SOUND_CONTROL_H_*/