decoder/mpcdec: fix replay gain formula with v8
"When playing musepack files with mpd v0.15.8, rg seems to have no effect. Using sample file below, mpd says 'computing ReplayGain album scale with gain 122.879997, peak 0.549150'. One thing though, if I build mpd against old libmpcdec-1.2.6, rg works as expected: 'computing ReplayGain album scale with gain 16.820000, peak 0.099765'"
This commit is contained in:
		 Aleksei Kaveshnikov
					Aleksei Kaveshnikov
				
			
				
					committed by
					
						 Max Kellermann
						Max Kellermann
					
				
			
			
				
	
			
			
			 Max Kellermann
						Max Kellermann
					
				
			
						parent
						
							cbfaa4a266
						
					
				
				
					commit
					73ba4ea3da
				
			
							
								
								
									
										1
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								NEWS
									
									
									
									
									
								
							| @@ -2,6 +2,7 @@ ver 0.15.9 (2009/??/??) | |||||||
| * decoders: | * decoders: | ||||||
|   - mad: fix crash when seeking at end of song |   - mad: fix crash when seeking at end of song | ||||||
|   - mpcdec: fix negative shift on fixed-point samples |   - mpcdec: fix negative shift on fixed-point samples | ||||||
|  |   - mpcdec: fix replay gain formula with v8 | ||||||
| * playlist: fix single+repeat in random mode | * playlist: fix single+repeat in random mode | ||||||
| * player: postpone song tags during cross-fade | * player: postpone song tags during cross-fade | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ | |||||||
| #include <mpcdec/mpcdec.h> | #include <mpcdec/mpcdec.h> | ||||||
| #else | #else | ||||||
| #include <mpc/mpcdec.h> | #include <mpc/mpcdec.h> | ||||||
|  | #include <math.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include <glib.h> | #include <glib.h> | ||||||
| @@ -209,10 +210,17 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	replay_gain_info = replay_gain_info_new(); | 	replay_gain_info = replay_gain_info_new(); | ||||||
|  | #ifdef MPC_IS_OLD_API | ||||||
| 	replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = info.gain_album * 0.01; | 	replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = info.gain_album * 0.01; | ||||||
| 	replay_gain_info->tuples[REPLAY_GAIN_ALBUM].peak = info.peak_album / 32767.0; | 	replay_gain_info->tuples[REPLAY_GAIN_ALBUM].peak = info.peak_album / 32767.0; | ||||||
| 	replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = info.gain_title * 0.01; | 	replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = info.gain_title * 0.01; | ||||||
| 	replay_gain_info->tuples[REPLAY_GAIN_TRACK].peak = info.peak_title / 32767.0; | 	replay_gain_info->tuples[REPLAY_GAIN_TRACK].peak = info.peak_title / 32767.0; | ||||||
|  | #else | ||||||
|  | 	replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = MPC_OLD_GAIN_REF  - (info.gain_album  / 256.); | ||||||
|  | 	replay_gain_info->tuples[REPLAY_GAIN_ALBUM].peak = pow(10, info.peak_album / 256. / 20) / 32767; | ||||||
|  | 	replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = MPC_OLD_GAIN_REF  - (info.gain_title  / 256.); | ||||||
|  | 	replay_gain_info->tuples[REPLAY_GAIN_TRACK].peak = pow(10, info.peak_title / 256. / 20) / 32767; | ||||||
|  | #endif | ||||||
|  |  | ||||||
| 	decoder_initialized(mpd_decoder, &audio_format, | 	decoder_initialized(mpd_decoder, &audio_format, | ||||||
| 			    is->seekable, | 			    is->seekable, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user