modplug: change settings before loading a file
alternative settings must be set before the file is loaded, otherwise they won't be respected.
This commit is contained in:
		 Andrzej Rybczak
					Andrzej Rybczak
				
			
				
					committed by
					
						 Max Kellermann
						Max Kellermann
					
				
			
			
				
	
			
			
			 Max Kellermann
						Max Kellermann
					
				
			
						parent
						
							84b63c45fa
						
					
				
				
					commit
					82df4cb2b0
				
			| @@ -91,12 +91,7 @@ mod_decode(struct decoder *decoder, struct input_stream *is) | |||||||
| 		g_warning("could not load stream\n"); | 		g_warning("could not load stream\n"); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	f = ModPlug_Load(bdatas->data, bdatas->len); |  | ||||||
| 	g_byte_array_free(bdatas, TRUE); |  | ||||||
| 	if (!f) { |  | ||||||
| 		g_warning("could not decode stream\n"); |  | ||||||
| 		return; |  | ||||||
|         } |  | ||||||
| 	ModPlug_GetSettings(&settings); | 	ModPlug_GetSettings(&settings); | ||||||
| 	/* alter setting */ | 	/* alter setting */ | ||||||
| 	settings.mResamplingMode = MODPLUG_RESAMPLE_FIR; /* RESAMP */ | 	settings.mResamplingMode = MODPLUG_RESAMPLE_FIR; /* RESAMP */ | ||||||
| @@ -106,6 +101,13 @@ mod_decode(struct decoder *decoder, struct input_stream *is) | |||||||
| 	/* insert more setting changes here */ | 	/* insert more setting changes here */ | ||||||
| 	ModPlug_SetSettings(&settings); | 	ModPlug_SetSettings(&settings); | ||||||
|  |  | ||||||
|  | 	f = ModPlug_Load(bdatas->data, bdatas->len); | ||||||
|  | 	g_byte_array_free(bdatas, TRUE); | ||||||
|  | 	if (!f) { | ||||||
|  | 		g_warning("could not decode stream\n"); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	audio_format.bits = 16; | 	audio_format.bits = 16; | ||||||
| 	audio_format.sample_rate = 44100; | 	audio_format.sample_rate = 44100; | ||||||
| 	audio_format.channels = 2; | 	audio_format.channels = 2; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user