1 // ambient_sound.h basti_
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 * Ambient Sound Source, beta version. Features:
23 * - "disc" like structure. Full volume up to some distance
24 * (distance_bias) to the source, then fading proportional to
25 * inverse square distance
27 * - parameters for point source:
29 * distance_factor high = steep fallofff
30 * distance_bias high = big "100% disc"
31 * silence_distance defaults reasonably.
36 #ifndef __AMBIENT_SOUND_H__
37 #define __AMBIENT_SOUND_H__
40 #include "game_object.h"
41 #include "resources.h"
43 #include "SDL_mixer.h"
45 class AmbientSound : public GameObject
48 AmbientSound(const lisp::Lisp& lisp);
51 virtual void hit(Player& player);
52 virtual void update(float time);
53 virtual void draw(DrawingContext&);
54 virtual void start_playing();
55 virtual void stop_playing();
63 float distance_factor; /// distance scaling
64 float distance_bias; /// 100% volume disc radius
65 float silence_distance; /// not implemented yet
67 float maximumvolume; /// maximum volume
68 float targetvolume; /// how loud we want to be
69 float currentvolume; /// how loud we are
71 float * volume_ptr; /// this will be used by the volume adjustment effect.