# HG changeset patch # User Eugene Zagidullin # Date 1201778112 -10800 # Node ID 2d4b4f13d10d7b4a71814bdd9fb93ede610fa983 # Parent b293ce14a01addfc03c6eb5e747b2bdd26005b5f set_replaygain_info added to PAPI diff -r b293ce14a01a -r 2d4b4f13d10d src/audacious/output.c --- a/src/audacious/output.c Thu Jan 31 12:04:13 2008 +0300 +++ b/src/audacious/output.c Thu Jan 31 14:15:12 2008 +0300 @@ -487,6 +487,7 @@ (op_state.rate == rate && op_state.nch == nch && op_state.fmt == fmt)) { /* Yes, and it's the correct sampling rate. Reset the counter and go. */ + AUDDBG("flushing output instead of reopening\n"); op->flush(0); return 1; } @@ -668,6 +669,7 @@ } SAD_dither_process_buffer(sad_state, ptr, sad_out_buf, frames); ptr = sad_out_buf; + length = len; } if (op_state.fmt == FMT_S16_NE || (op_state.fmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || @@ -724,3 +726,10 @@ writeoffs += writable; } } + +/* called by input plugin when RG info available */ +void +output_set_replaygain_info (InputPlayback *pb, ReplayGainInfo *rg_info) +{ + /*stub*/ +} diff -r b293ce14a01a -r 2d4b4f13d10d src/audacious/output.h --- a/src/audacious/output.h Thu Jan 31 12:04:13 2008 +0300 +++ b/src/audacious/output.h Thu Jan 31 14:15:12 2008 +0300 @@ -63,6 +63,7 @@ gint output_buffer_playing(void); void output_pass_audio(InputPlayback *, AFormat, gint, gint, gpointer, int *); +void output_set_replaygain_info(InputPlayback *, ReplayGainInfo *); gint get_written_time(void); gint get_output_time(void); diff -r b293ce14a01a -r 2d4b4f13d10d src/audacious/playback.c --- a/src/audacious/playback.c Thu Jan 31 12:04:13 2008 +0300 +++ b/src/audacious/playback.c Thu Jan 31 14:15:12 2008 +0300 @@ -386,6 +386,7 @@ playback->set_params = playback_set_pb_params; playback->set_title = playback_set_pb_title; playback->pass_audio = output_pass_audio; + playback->set_replaygain_info = output_set_replaygain_info; return playback; } diff -r b293ce14a01a -r 2d4b4f13d10d src/audacious/plugin.h --- a/src/audacious/plugin.h Thu Jan 31 12:04:13 2008 +0300 +++ b/src/audacious/plugin.h Thu Jan 31 14:15:12 2008 +0300 @@ -112,6 +112,13 @@ InputPlugin *ip; } ProbeResult; +typedef struct { + gfloat track_gain; /* in dB !!! --asphyx */ + gfloat track_peak; + gfloat album_gain; + gfloat album_peak; +} ReplayGainInfo; + typedef GHashTable INIFile; #include "audacious/playlist.h" @@ -1071,6 +1078,9 @@ void (*set_title) (InputPlayback *, gchar * text); void (*pass_audio) (InputPlayback *, AFormat, gint, gint, gpointer, gint *); + + /* added in Audacious 1.5 */ + void (*set_replaygain_info) (InputPlayback *, ReplayGainInfo *); /* called by input plugin when RG info available --asphyx */ }; struct _InputPlugin { diff -r b293ce14a01a -r 2d4b4f13d10d src/libSAD/dither.c --- a/src/libSAD/dither.c Thu Jan 31 12:04:13 2008 +0300 +++ b/src/libSAD/dither.c Thu Jan 31 14:15:12 2008 +0300 @@ -17,6 +17,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/*#define CLIPPING_DEBUG*/ +/*#define DITHER_DEBUG*/ #include "common.h" #include "dither_ops.h" @@ -150,7 +152,7 @@ if (precision_loss && (n_bits_to_loose >= 1)) sample += (1L << (n_bits_to_loose - 1)); #ifdef DITHER_DEBUG - int32_t val_wo_dither = sample, >> n_bits_to_loose; + int32_t val_wo_dither = sample >> n_bits_to_loose; val_wo_dither = CLIP(val_wo_dither, maxint); #endif if (dither && precision_loss && (n_bits_to_loose >= 1)) {