Changeset 222:3975f41364fa in roaraudio


Ignore:
Timestamp:
07/22/08 20:34:11 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added ReplayGain? support to codecfilter_vorbis

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/codecfilter_vorbis.c

    r207 r222  
    9494 int type; 
    9595 int j, h = 0; 
     96 float rpg_track = 0, rpg_album = 0; 
    9697 
    9798 s->info.channels = vi->channels; 
     
    116117 
    117118   ROAR_DBG("cf_vorbis_update_stream(*): Meta %-16s: %s", key, value); 
     119 
     120   if ( strcmp(key, "REPLAYGAIN_TRACK_PEAK") == 0 ) { 
     121    rpg_track = 1/atof(value); 
     122/* 
     123   } else if ( strcmp(key, "REPLAYGAIN_TRACK_GAIN") == 0 ) { 
     124    rpg_track = powf(10, atof(value)/20); 
     125*/ 
     126   } else if ( strcmp(key, "REPLAYGAIN_ALBUM_PEAK") == 0 ) { 
     127    rpg_album = 1/atof(value); 
     128/*  
     129   } else if ( strcmp(key, "REPLAYGAIN_ALBUM_GAIN") == 0 ) { 
     130    rpg_album = powf(10, atof(value)/20); 
     131*/ 
     132   } 
     133 
    118134   ++ptr; 
    119135 } 
    120136 
     137 if ( rpg_album ) { 
     138  self->stream->mixer.rpg_div = 2718;  // = int(exp(1)*1000) 
     139  self->stream->mixer.rpg_mul = (float)rpg_album*2718; 
     140 } else if ( rpg_track ) { 
     141  self->stream->mixer.rpg_div = 2718; 
     142  self->stream->mixer.rpg_mul = (float)rpg_track*2718; 
     143 } 
     144 
     145 printf("RPG: mul=%i, div=%i\n", self->stream->mixer.rpg_mul, self->stream->mixer.rpg_div); 
    121146 return 0; 
    122147} 
  • roard/include/codecfilter_vorbis.h

    r207 r222  
    77#include <vorbis/codec.h> 
    88#include <vorbis/vorbisfile.h> 
     9#include <math.h> 
    910 
    1011struct codecfilter_vorbis_inst { 
Note: See TracChangeset for help on using the changeset viewer.