00001 //////////////////////////////////////////////////////////////////////////////// 00002 // Scorched3D (c) 2000-2009 00003 // 00004 // This file is part of Scorched3D. 00005 // 00006 // Scorched3D is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // Scorched3D is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with Scorched3D; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 //////////////////////////////////////////////////////////////////////////////// 00020 00021 #if !defined(__INCLUDE_VirtualSoundSourceh_INCLUDE__) 00022 #define __INCLUDE_VirtualSoundSourceh_INCLUDE__ 00023 00024 #include <sound/VirtualSoundPriority.h> 00025 #include <sound/SoundBuffer.h> 00026 #include <common/Vector.h> 00027 00028 class PlayingSoundSource; 00029 class VirtualSoundSource 00030 { 00031 public: 00032 VirtualSoundSource( 00033 unsigned int priority, bool looping, bool managed); 00034 virtual ~VirtualSoundSource(); 00035 00036 void play(SoundBuffer *buffer); 00037 void stop(); 00038 00039 bool getPlaying(); 00040 bool getManaged() { return managed_; } 00041 bool getLooping() { return looping_; } 00042 bool getRelative() { return relative_; } 00043 Vector &getPosition() { return position_; } 00044 unsigned int getPriority() { return priority_; } 00045 SoundBuffer *getBuffer() { return buffer_; } 00046 PlayingSoundSource *getPlayingSource() { return playingSource_; } 00047 float getDistance() { return distance_; } 00048 00049 void setRelative(); 00050 void setPosition(Vector &position); 00051 void setVelocity(Vector &velocity); 00052 void setGain(float gain); 00053 void setReferenceDistance(float refDist); 00054 void setRolloff(float rolloff); 00055 00056 // Internal 00057 void actualPlay(); 00058 void setPlayingSource(PlayingSoundSource *s); 00059 void updateDistance(Vector &listener); 00060 00061 protected: 00062 unsigned int priority_; 00063 PlayingSoundSource *playingSource_; 00064 SoundBuffer *buffer_; 00065 Vector position_, velocity_; 00066 float distance_; 00067 float gain_, refDist_, rolloff_; 00068 bool relative_; 00069 bool looping_; 00070 bool managed_; 00071 }; 00072 00073 #endif // __INCLUDE_VirtualSoundSourceh_INCLUDE__
1.5.3