./modules/audio_filter/resampler/linear.c: This should allways generate the
right number of samples now. The morale is never base your floating point
calculations on the output of integer divitions.
+ * ./modules/audio_filter/resampler/linear.c: new audio resampler based on
+ linear interpolation
* ./modules/gui/macosx/prefs.m: new configuration interface
* ./src/misc/netutils.c: GetMacAddress Darwin support
* ./src/libvlc.h: default to en0 instead of eth0 under Darwin
* ./modules/gui/macosx/prefs.m: new configuration interface
* ./src/misc/netutils.c: GetMacAddress Darwin support
* ./src/libvlc.h: default to en0 instead of eth0 under Darwin
* ugly.c : linear interpolation resampler
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* ugly.c : linear interpolation resampler
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: linear.c,v 1.1 2002/11/07 21:09:59 sigmunau Exp $
+ * $Id: linear.c,v 1.2 2002/11/10 13:24:35 sigmunau Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
- msg_Dbg( p_this, " trying the linear resampler");
if ( p_filter->input.i_rate == p_filter->output.i_rate
|| p_filter->input.i_format != p_filter->output.i_format
|| p_filter->input.i_channels != p_filter->output.i_channels
if ( p_filter->input.i_rate == p_filter->output.i_rate
|| p_filter->input.i_format != p_filter->output.i_format
|| p_filter->input.i_channels != p_filter->output.i_channels
/ p_filter->input.i_rate;
int i_frame_bytes = i_nb_channels * sizeof(s32);
int i_in, i_chan, i_out = 0;
/ p_filter->input.i_rate;
int i_frame_bytes = i_nb_channels * sizeof(s32);
int i_in, i_chan, i_out = 0;
- double f_step = (float)i_in_nb/i_out_nb;
+ double f_step = (float)p_filter->input.i_rate / p_filter->output.i_rate;
for( i_in = 0 ; i_in < i_in_nb - 1; i_in++ )
{
f_pos--;
for( i_in = 0 ; i_in < i_in_nb - 1; i_in++ )
{
f_pos--;
{
for( i_chan = i_nb_channels ; i_chan ; )
{
{
for( i_chan = i_nb_channels ; i_chan ; )
{
}
p_in += i_nb_channels;
}
}
p_in += i_nb_channels;
}
- if ( f_step < 1 ) {
- for( i_chan = i_nb_channels ; i_chan ; )
- {
- i_chan--;
- p_out[i_chan] = p_in[i_chan];
- i_out++;
- }
- }
- if ( i_out != i_out_nb * i_nb_channels ) {
- msg_Warn( p_aout, "mismatch in sample nubers: %d requested, %d generated", i_out_nb* i_nb_channels, i_out);
+
+ if ( i_out != i_out_nb * i_nb_channels )
+ {
+ msg_Warn( p_aout, "mismatch in sample numbers: %d requested, "
+ "%d generated", i_out_nb* i_nb_channels, i_out);
}
p_out_buf->i_nb_samples = i_out_nb;
}
p_out_buf->i_nb_samples = i_out_nb;