- ambient_sound improved (now does silence, volume,
[supertux.git] / src / object / ambient_sound.h
index 7963c40..433e60e 100644 (file)
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //  02111-1307, USA.
 
+/**
+ *  Ambient Sound Source, beta version. Features:
+ *
+ *  - "disc" like structure. Full volume up to some distance
+ *    (distance_bias) to the source, then fading proportional to
+ *    inverse square distance
+ *  
+ *  - parameters for point source:
+ *    x, y               position
+ *    distance_factor    high = steep fallofff
+ *    distance_bias      high = big "100% disc"
+ *    silence_distance   defaults reasonably.
+ * 
+ *      basti_ 
+ */
+
 #ifndef __AMBIENT_SOUND_H__
 #define __AMBIENT_SOUND_H__
 
 #include "game_object.h"
 #include "resources.h"
 #include "player.h"
+#include "SDL_mixer.h"
 
 class AmbientSound : public GameObject
 {
 public:
   AmbientSound(const lisp::Lisp& lisp);
-
+  ~AmbientSound();
 protected:
   virtual void hit(Player& player);
   virtual void action(float time);
   virtual void draw(DrawingContext&);
-  virtual void startPlaying();
+  virtual void start_playing();
+  virtual void stop_playing();
 private:
   Vector position;
-  Sprite *sprite;
 
   std::string sample;
   int playing;
-  float distance_factor;
+  int latency;
+
+  float distance_factor;  /// distance scaling
+  float distance_bias;    /// 100% volume disc radius
+  float silence_distance; /// not implemented yet 
 
-  float distance_bias;
-  float silence_distance;
+  float maximumvolume; /// maximum volume
+  float targetvolume;  /// how loud we want to be
+  float currentvolume; /// how loud we are
 
-  float * volume_ptr; // this will be used by the volume adjustment effect.
+  float * volume_ptr; /// this will be used by the volume adjustment effect.
 };
 
 #endif