fix shrinking
[supertux.git] / src / object / ambient_sound.cpp
index 68253b0..3974094 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <math.h>
 #include <stdexcept>
+#include <iostream>
 
 #include "ambient_sound.hpp"
 #include "object_factory.hpp"
@@ -27,6 +28,7 @@
 #include "sector.hpp"
 #include "audio/sound_manager.hpp"
 #include "audio/sound_source.hpp"
+#include "msg.hpp"
 
 AmbientSound::AmbientSound(const lisp::Lisp& lisp)
 {
@@ -42,7 +44,7 @@ AmbientSound::AmbientSound(const lisp::Lisp& lisp)
   sample="";
 
   if (!(lisp.get("x", position.x)&&lisp.get("y", position.y))) {
-    std::cerr << "No Position in ambient_sound"  << std::endl;
+    msg_warning("No Position in ambient_sound");
   }
 
   lisp.get("width" , dimension.x);
@@ -121,10 +123,7 @@ void
 AmbientSound::start_playing()
 {
   try {
-    std::string filename = "sounds/";
-    filename += sample;
-    filename += ".wav";
-    sound_source = sound_manager->create_sound_source(filename);
+    sound_source = sound_manager->create_sound_source(sample);
     if(!sound_source)
       throw std::runtime_error("file not found");
    
@@ -133,7 +132,7 @@ AmbientSound::start_playing()
     currentvolume=targetvolume=1e-20;
     sound_source->play();
   } catch(std::exception& e) {
-    std::cerr << "Couldn't play '" << sample << "': " << e.what() << "\n";
+    msg_warning("Couldn't play '" << sample << "': " << e.what() << "");
     delete sound_source;
     sound_source = 0;
   }