Browse Source

More sensible volume settings for Modpluggable files.

vrld 14 years ago
parent
commit
c3cfff987c
1 changed files with 15 additions and 2 deletions
  1. 15 2
      src/modules/sound/lullaby/ModPlugDecoder.cpp

+ 15 - 2
src/modules/sound/lullaby/ModPlugDecoder.cpp

@@ -38,7 +38,19 @@ namespace lullaby
 		settings.mBits = 16;
 		settings.mBits = 16;
 		settings.mFrequency = sampleRate;
 		settings.mFrequency = sampleRate;
 		settings.mResamplingMode = MODPLUG_RESAMPLE_LINEAR;
 		settings.mResamplingMode = MODPLUG_RESAMPLE_LINEAR;
+
+		// fill with modplug defaults (modplug _memsets_, so we could get
+		// garbage settings when the struct is only partially initialized)
+		settings.mStereoSeparation = 128;
+		settings.mMaxMixChannels = 32;
+		settings.mReverbDepth = 0;
+		settings.mReverbDelay = 0;
+		settings.mBassAmount = 0;
+		settings.mBassRange = 0;
+		settings.mSurroundDepth = 0;
+		settings.mSurroundDelay = 0;
 		settings.mLoopCount = 0;
 		settings.mLoopCount = 0;
+
 		ModPlug_SetSettings(&settings);
 		ModPlug_SetSettings(&settings);
 
 
 		// Load the module.
 		// Load the module.
@@ -47,7 +59,8 @@ namespace lullaby
 		if(plug == 0)
 		if(plug == 0)
 			throw love::Exception("Could not load file with ModPlug.");
 			throw love::Exception("Could not load file with ModPlug.");
 
 
-		ModPlug_SetMasterVolume(plug, 512);
+		// set master volume for delicate ears
+		ModPlug_SetMasterVolume(plug, 128);
 	}
 	}
 
 
 	ModPlugDecoder::~ModPlugDecoder()
 	ModPlugDecoder::~ModPlugDecoder()
@@ -101,7 +114,7 @@ namespace lullaby
 		// Let's reload.
 		// Let's reload.
 		ModPlug_Unload(plug);
 		ModPlug_Unload(plug);
 		plug = ModPlug_Load(data->getData(), data->getSize());
 		plug = ModPlug_Load(data->getData(), data->getSize());
-		ModPlug_SetMasterVolume(plug, 512);
+		ModPlug_SetMasterVolume(plug, 128);
 		eof = false;
 		eof = false;
 		return (plug != 0);
 		return (plug != 0);
 	}
 	}