added a powerup object that can be placed in levels and represent various powerups...
[supertux.git] / src / object / ambient_sound.h
index f6fd285..864bf4a 100644 (file)
 //  02111-1307, USA.
 
 /**
- *  Ambient Sound Source, beta version. Features:
+ *  Ambient Sound Source, gamma version. Features:
  *
- *  - "disc" like structure. Full volume up to some distance
- *    (distance_bias) to the source, then fading proportional to
- *    inverse square distance
+ *  - "rounded rectancle" geometry with position, dimension and 
+ *    "rounding radius" (extending in all directions) of a 100% 
+ *    volume area, adjustable maximum volume, inverse square 
+ *    falloff outside area.
  *  
- *  This is experimental and clicks a little. It is not possible to
- *  get the clicks out without sample-granular volume adjustment.
+ *  - degenerates gracefully to a disc for dimension=0
+ *  
+ *  - parameters:
  *
+ *    x, y               position
+ *    width, height      dimension
+ *    distance_factor    high = steep fallofff
+ *    distance_bias      high = big "100% disc"
+ *    silence_distance   defaults reasonably.
+ *    sample             sample to be played back in loop mode
+ * 
  *      basti_ 
  */
 
@@ -43,22 +52,26 @@ class AmbientSound : public GameObject
 {
 public:
   AmbientSound(const lisp::Lisp& lisp);
-
+  ~AmbientSound();
 protected:
   virtual void hit(Player& player);
-  virtual void action(float time);
+  virtual void update(float time);
   virtual void draw(DrawingContext&);
-  virtual void startPlaying();
+  virtual void start_playing();
+  virtual void stop_playing();
 private:
   Vector position;
+  Vector dimension;
 
   std::string sample;
   int playing;
+  int latency;
 
   float distance_factor;  /// distance scaling
   float distance_bias;    /// 100% volume disc radius
   float silence_distance; /// not implemented yet 
 
+  float maximumvolume; /// maximum volume
   float targetvolume;  /// how loud we want to be
   float currentvolume; /// how loud we are