Changeset 212 for libmpc/branches/r2d/libmpcdec/mpc_demux.c
- Timestamp:
- 02/13/07 11:40:24 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/libmpcdec/mpc_demux.c
r206 r212 33 33 */ 34 34 35 #include <math.h> 35 36 #include <string.h> 36 37 #include <mpc/streaminfo.h> … … 353 354 memcpy(i, &d->si, sizeof d->si); 354 355 } 355 356 #include <stdio.h>357 356 358 357 void mpc_demux_decode(mpc_demux * d, mpc_frame_info * i) … … 471 470 } 472 471 472 void setReplayLevel(mpc_demux * d, float level, mpc_bool_t use_gain, 473 mpc_bool_t use_title, mpc_bool_t clip_prevention) 474 { 475 float peak = use_title ? d->si.peak_title : d->si.peak_album; 476 float gain = use_title ? d->si.gain_title : d->si.gain_album; 477 478 if(!use_gain && !clip_prevention) 479 return; 480 481 if(!peak) 482 peak = 1.; 483 else 484 peak = (1 << 15) / __builtin_powf(10, peak / (20 * 256)); 485 486 if(!gain) 487 gain = 1.; 488 else 489 gain = __builtin_powf(10, (level - gain / 256) / 20); 490 491 if(clip_prevention && (peak < gain || !use_gain)) 492 gain = peak; 493 494 mpc_decoder_scale_output(d->d, gain); 495 }
Note: See TracChangeset
for help on using the changeset viewer.