Index: branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
===================================================================
--- branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc	(revision 8180)
+++ branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc	(revision 8181)
@@ -167,31 +167,40 @@
 void RainEffect::tick (float dt)
 {
-	if (this->rainMove) {
-		this->rainCoord = State::getCameraNode()->getAbsCoor();
-		this->emitter->setRelCoor(this->rainCoord.x , this->rainCoord.y+800, this->rainCoord.z);
-	}
-
-	if (this->rainStartDuration != 0 && this->localTimer < this->rainStartDuration) {
-		this->localTimer += dt;
-		float progress = this->localTimer / this->rainStartDuration;
-
-		// use alpha in color to fade in
-		RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1
-		RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2
-		RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2 * progress); // light grey
-
-		// increase radius for more "heavy" rain
-		RainEffect::rainParticles->setRadius(0, 0.03 * progress);
-		RainEffect::rainParticles->setRadius(0.2, 0.02 * progress);
-		RainEffect::rainParticles->setRadius(1, 0.01 * progress);
-
-		// increase sound volume
-		this->soundSource.loop(this->rainBuffer, this->soundRainVolume * progress);
-
+	if (RainEffect::rainParticles != NULL) {
+		if (this->rainMove) {
+			this->rainCoord = State::getCameraNode()->getAbsCoor();
+			this->emitter->setRelCoor(this->rainCoord.x , this->rainCoord.y+800, this->rainCoord.z);
+		}
+	
+		if (this->rainStartDuration != 0 && this->localTimer < this->rainStartDuration) {
+			this->localTimer += dt;
+			float progress = this->localTimer / this->rainStartDuration;
+	
+			// PRINTF(0)("Progress %f: \n", progress);
+	
+			// use alpha in color to fade in
+			RainEffect::rainParticles->setColor(0,   0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1
+			RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2
+			RainEffect::rainParticles->setColor(1,   0.7, 0.7, 0.7, 0.2 * progress); // light grey
+	
+			// increase radius for more "heavy" rain
+			RainEffect::rainParticles->setRadius(0, 0.03 * progress);
+			RainEffect::rainParticles->setRadius(0.2, 0.02 * progress);
+			RainEffect::rainParticles->setRadius(1, 0.01 * progress);
+	
+			// increase sound volume
+			// this->soundSource.fadein(this->rainBuffer, 10);
+		}
 	}
 }
 
 void RainEffect::startRaining() {
+
+	if (RainEffect::rainParticles != NULL)
+		this->deactivate();
+
 	this->rainStartDuration = 10;
-	// this->activate;
-}
+	this->localTimer = 0;
+	this->activate();
+
+}
Index: branches/atmospheric_engine/src/lib/sound/sound_source.cc
===================================================================
--- branches/atmospheric_engine/src/lib/sound/sound_source.cc	(revision 8180)
+++ branches/atmospheric_engine/src/lib/sound/sound_source.cc	(revision 8181)
@@ -211,73 +211,73 @@
 	}
 
-/**
-* @brief Plays and loops buffer on this Source
-* @param buffer the buffer to play back on this Source
-*/
-void SoundSource::loop(const SoundBuffer* buffer)
-{
-	if (this->buffer && this->retrieveSource())
-	{
-		if (this->bPlay)
-			alSourceStop(this->sourceID);
-
-		alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
-		alSourcei (this->sourceID, AL_LOOPING,  AL_TRUE);
-		alSourcef (this->sourceID, AL_GAIN, 1);
-
-		alSourcePlay(this->sourceID);
-
-		if (DEBUG_LEVEL >= 3)
-			SoundEngine::checkError("Play LoopSource", __LINE__);
-		this->bPlay = true;
-	}
-}
-
-
-/**
-* @brief Plays and loops buffer on this Source with gain control
-* @param buffer the buffer to play back on this Source
-*/
-void SoundSource::loop(const SoundBuffer* buffer, float gain)
-{
-	if (this->buffer && this->retrieveSource())
-	{
-		if (this->bPlay)
-			alSourceStop(this->sourceID);
-
-		alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
-		alSourcei (this->sourceID, AL_LOOPING,  AL_TRUE);
-		alSourcef (this->sourceID, AL_GAIN, gain);
-
-		alSourcePlay(this->sourceID);
-
-		if (DEBUG_LEVEL >= 3)
-			SoundEngine::checkError("Play LoopSource", __LINE__);
-		this->bPlay = true;
-	}
-}
-
-
-/**
-* @brief Stops playback of a SoundSource
-*/
-void SoundSource::stop()
-{
-	this->bPlay = false;
-	if (this->sourceID != 0)
+	/**
+	* @brief Plays and loops buffer on this Source
+	* @param buffer the buffer to play back on this Source
+	*/
+	void SoundSource::loop(const SoundBuffer* buffer)
+	{
+		if (this->buffer && this->retrieveSource())
+		{
+			if (this->bPlay)
+				alSourceStop(this->sourceID);
+	
+			alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
+			alSourcei (this->sourceID, AL_LOOPING,  AL_TRUE);
+			alSourcef (this->sourceID, AL_GAIN, 1);
+	
+			alSourcePlay(this->sourceID);
+	
+			if (DEBUG_LEVEL >= 3)
+				SoundEngine::checkError("Loop Source", __LINE__);
+			this->bPlay = true;
+		}
+	}
+	
+	
+	/**
+	* @brief Plays and loops buffer on this Source with gain control
+	* @param buffer the buffer to play back on this Source
+	*/
+	void SoundSource::loop(const SoundBuffer* buffer, float gain)
+	{
+		if (this->buffer && this->retrieveSource())
+		{
+			if (this->bPlay)
+				alSourceStop(this->sourceID);
+	
+			alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
+			alSourcei (this->sourceID, AL_LOOPING,  AL_TRUE);
+			alSourcef (this->sourceID, AL_GAIN, gain);
+	
+			alSourcePlay(this->sourceID);
+	
+			if (DEBUG_LEVEL >= 3)
+				SoundEngine::checkError("Loop Source", __LINE__);
+			this->bPlay = true;
+		}
+	}
+	
+	
+	/**
+	* @brief Stops playback of a SoundSource
+	*/
+	void SoundSource::stop()
 	{
 		this->bPlay = false;
 		if (this->sourceID != 0)
 		{
-			alSourceStop(this->sourceID);
-			if (DEBUG_LEVEL >= 3)
-				SoundEngine::checkError("StopSource", __LINE__);
-			alSourcei(this->sourceID, AL_BUFFER, 0);
-			if (!this->resident)
-				SoundEngine::getInstance()->pushALSource(this->sourceID);
-			this->sourceID = 0;
-		}
-	}
-}
+			this->bPlay = false;
+			if (this->sourceID != 0)
+			{
+				alSourceStop(this->sourceID);
+				if (DEBUG_LEVEL >= 3)
+					SoundEngine::checkError("StopSource", __LINE__);
+				alSourcei(this->sourceID, AL_BUFFER, 0);
+				if (!this->resident)
+					SoundEngine::getInstance()->pushALSource(this->sourceID);
+				this->sourceID = 0;
+			}
+		}
+	}
 
 	/**
@@ -362,3 +362,30 @@
 		alSourcef (sourceID, AL_GAIN,            SoundEngine::getInstance()->getEffectsVolume());
 	}
+
+
+	/**
+	* @brief Fades in a Source over a time period
+	* @param duration time perios to fade in
+	*/
+	void SoundSource::fadein(const SoundBuffer* buffer, ALfloat duration)
+	{
+		//if (this->buffer && this->retrieveSource())
+		//{
+
+		for (ALfloat n = 0.0; n < 1.0; n+=.01)
+		{
+			alSourcef(this->sourceID, AL_GAIN, n);
+			// sleep(1);
+		}
+
+		//	alSourcePlay(this->sourceID);
+	
+		//	if (DEBUG_LEVEL >= 3)
+		//		SoundEngine::checkError("Loop Source", __LINE__);
+		//	this->bPlay = true;
+		//}
+
+	}
+
+
 }
Index: branches/atmospheric_engine/src/lib/sound/sound_source.h
===================================================================
--- branches/atmospheric_engine/src/lib/sound/sound_source.h	(revision 8180)
+++ branches/atmospheric_engine/src/lib/sound/sound_source.h	(revision 8181)
@@ -1,5 +1,5 @@
 /*!
- * @file sound_source.h
- * @brief Definition of the SoundSource.
+* @file sound_source.h
+* @brief Definition of the SoundSource.
 */
 
@@ -14,56 +14,58 @@
 namespace OrxSound
 {
-  class SoundBuffer;
-  //! A class that represents a SoundSource
-  class SoundSource : public BaseObject
-  {
-  public:
-    SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL);
-    SoundSource(const SoundSource& source);
-    SoundSource& operator=(const SoundSource& source);
-    bool operator==(const SoundSource& source);
-
-    virtual ~SoundSource();
-
-    // user interaction
-    void play();
-    void play(const SoundBuffer* buffer);
-    void play(const SoundBuffer* buffer, float gain);
-    void loop();
-    void loop(const SoundBuffer* buffer);
-    void loop(const SoundBuffer* buffer, float gain);
-    void stop();
-    void pause();
-    void rewind();
-
-    // development functions
-    /** @returns The ID of this Source */
-    inline ALuint getID() const { return this->sourceID; };
-    /** @returns true, if the Source is Playing */
-    inline bool   isPlaying() const { return this->bPlay; };
-    void setSourceNode(const PNode* sourceNode);
-    /** @returns the SoundBuffer of this Source */
-    inline const SoundBuffer* getBuffer() const { return this->buffer; };
-    /** @returns the SourceNode of this Source */
-    inline const PNode* getNode() const { return this->sourceNode; };
-    /** @param resident if the Source is Resident */
-    inline void setResident(bool resident) { this->resident = resident; };
-    /** @returns true if the alSource is Resident */
-    inline bool isResident() const { return this->resident; };
-
-    void setRolloffFactor(ALfloat rolloffFactor);
-
-    static void resetSource(ALuint sourceID);
-
-  private:
-    bool retrieveSource();
-
-  private:
-    bool                   bPlay;                 //!< If the Source is Playing.
-    bool                   resident;              //!< If the alSource should be resident (if true, the alSource will be returned on deletion).
-    ALuint                 sourceID;              //!< The ID of the Source
-    const SoundBuffer*     buffer;                //!< The buffer to play in this source.
-    const PNode*           sourceNode;            //!< The SourceNode representing the position/velocity... of this source.
-  };
+	class SoundBuffer;
+	//! A class that represents a SoundSource
+	class SoundSource : public BaseObject
+	{
+		public:
+			SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL);
+			SoundSource(const SoundSource& source);
+			SoundSource& operator=(const SoundSource& source);
+			bool operator==(const SoundSource& source);
+			
+			virtual ~SoundSource();
+			
+			// user interaction
+			void play();
+			void play(const SoundBuffer* buffer);
+			void play(const SoundBuffer* buffer, float gain);
+			void loop();
+			void loop(const SoundBuffer* buffer);
+			void loop(const SoundBuffer* buffer, float gain);
+			void stop();
+			void pause();
+			void rewind();
+			void fadein(const SoundBuffer* buffer, ALfloat duration);
+			
+			
+			// development functions
+			/** @returns The ID of this Source */
+			inline ALuint getID() const { return this->sourceID; };
+			/** @returns true, if the Source is Playing */
+			inline bool   isPlaying() const { return this->bPlay; };
+			void setSourceNode(const PNode* sourceNode);
+			/** @returns the SoundBuffer of this Source */
+			inline const SoundBuffer* getBuffer() const { return this->buffer; };
+			/** @returns the SourceNode of this Source */
+			inline const PNode* getNode() const { return this->sourceNode; };
+			/** @param resident if the Source is Resident */
+			inline void setResident(bool resident) { this->resident = resident; };
+			/** @returns true if the alSource is Resident */
+			inline bool isResident() const { return this->resident; };
+			
+			void setRolloffFactor(ALfloat rolloffFactor);
+			
+			static void resetSource(ALuint sourceID);
+		
+		private:
+			bool retrieveSource();
+			
+		private:
+			bool                   bPlay;		//!< If the Source is Playing.
+			bool                   resident;	//!< If the alSource should be resident (if true, the alSource will be returned on deletion).
+			ALuint                 sourceID;	//!< The ID of the Source
+			const SoundBuffer*     buffer;		//!< The buffer to play in this source.
+			const PNode*           sourceNode;	//!< The SourceNode representing the position/velocity... of this source.
+	};
 }
 #endif /* _SOUND_SOURCE_H */
