changeset 4235:2d4b4f13d10d

set_replaygain_info added to PAPI
author Eugene Zagidullin <e.asphyx@gmail.com>
date Thu, 31 Jan 2008 14:15:12 +0300
parents b293ce14a01a
children 1ab015fe2ade
files src/audacious/output.c src/audacious/output.h src/audacious/playback.c src/audacious/plugin.h src/libSAD/dither.c
diffstat 5 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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*/
+}
--- 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);
--- 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;
 }
--- 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 {
--- 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)) {