Changeset 218


Ignore:
Timestamp:
02/17/07 15:58:05 (17 years ago)
Author:
r2d
Message:
  • update for replay gain
Location:
xmms-musepack/branches/r2d/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • xmms-musepack/branches/r2d/src/libmpc.cpp

    r202 r218  
    545545            mpcGtkPrintLabel(lengthLabel,    "Length: \%d:\%.2d", minutes, seconds);
    546546            mpcGtkPrintLabel(fileSizeLabel,  "File size: \%d Bytes", info.total_file_length);
    547             mpcGtkPrintLabel(trackPeakLabel, "Track Peak: \%5u", info.peak_title);
    548             mpcGtkPrintLabel(trackGainLabel, "Track Gain: \%-+2.2f dB", 0.01 * info.gain_title);
    549             mpcGtkPrintLabel(albumPeakLabel, "Album Peak: \%5u", info.peak_album);
    550             mpcGtkPrintLabel(albumGainLabel, "Album Gain: \%-+5.2f dB", 0.01 * info.gain_album);
     547                        mpcGtkPrintLabel(trackPeakLabel, "Track Peak: \%2.2f dB", info.peak_title / 256.);
     548                        mpcGtkPrintLabel(trackGainLabel, "Track Gain: \%2.2f dB", info.gain_title / 256.);
     549                        mpcGtkPrintLabel(albumPeakLabel, "Album Peak: \%2.2f dB", info.peak_album / 256.);
     550                        mpcGtkPrintLabel(albumGainLabel, "Album Gain: \%2.2f dB", info.gain_album / 256.);
    551551
    552552            MpcInfo tags = getTags(p_Filename);
     
    782782
    783783//      mpc_decoder_set_seeking(decoder, &info, pluginConfig.fastSeek);
    784 //     setReplaygain(info, *decoder);
     784    setReplaygain(demux);
    785785
    786786    MPC_SAMPLE_FORMAT sampleBuffer[MPC_DECODER_BUFFER_LENGTH];
     
    867867}
    868868
    869 static void setReplaygain(mpc_streaminfo& info, mpc_decoder& decoder)
    870 {
    871     if(!pluginConfig.replaygain && !pluginConfig.clipPrevention)
    872         return;
    873 
    874     int peak    = pluginConfig.albumGain ? info.peak_album : info.peak_title;
    875     double gain = pluginConfig.albumGain ? info.gain_album : info.gain_title;
    876 
    877     if(!peak)
    878         peak = 32767;
    879     if(!gain)
    880         gain = 1.;
    881 
    882     double clip = 32767. / peak;
    883     gain = exp((M_LN10 / 2000.) * gain);
    884 
    885     if(pluginConfig.clipPrevention && !pluginConfig.replaygain)
    886         gain = clip;
    887     else if(pluginConfig.replaygain && pluginConfig.clipPrevention)
    888         if(clip < gain)
    889             gain = clip;
    890 
    891     mpc_decoder_scale_output(&decoder, gain);
     869static void setReplaygain(mpc_demux * d)
     870{
     871        setReplayLevel(d, 64.82, pluginConfig.replaygain, !pluginConfig.albumGain,
     872                                   pluginConfig.clipPrevention);
    892873}
    893874
  • xmms-musepack/branches/r2d/src/libmpc.h

    r202 r218  
    175175static void       setOffset(double);
    176176static bool       isPause();
    177 static void       setReplaygain(mpc_streaminfo&, mpc_decoder&);
     177static void       setReplaygain(mpc_demux *);
    178178
    179179#ifdef MPC_FIXED_POINT
Note: See TracChangeset for help on using the changeset viewer.