time_scale.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include <fcntl.h>
#include <time.h>
#include <limits.h>
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/time_scale.h"
#include "spandsp/saturated.h"

Functions

int time_scale_rate (time_scale_state_t *s, float playout_rate)
 Change the time scale rate.
time_scale_state_ttime_scale_init (time_scale_state_t *s, int sample_rate, float playout_rate)
 Initialise a time scale context.
int time_scale_free (time_scale_state_t *s)
 Free a time scale context.
int time_scale (time_scale_state_t *s, int16_t out[], int16_t in[], int len)
 Time scale a chunk of audio samples.
int time_scale_max_output_len (time_scale_state_t *s, int input_len)
 Find the maximum possible output samples.

Detailed Description


Function Documentation

int time_scale ( time_scale_state_t s,
int16_t  out[],
int16_t  in[],
int  len 
)

Time scale a chunk of audio samples.

Time scale a chunk of audio samples.

Parameters:
s The time scale context.
out The output audio sample buffer. This must be large enough to accept the longest possible result from processing the input data. See the algorithm documentation for how the longest possible result may be calculated.
in The input audio sample buffer.
len The number of input samples.
Returns:
The number of output samples.

References time_scale_state_t::buf, time_scale_state_t::buf_len, time_scale_state_t::fill, time_scale_state_t::lcp, time_scale_state_t::max_pitch, time_scale_state_t::min_pitch, time_scale_state_t::playout_rate, time_scale_state_t::rate_nudge, and time_scale_state_t::rcomp.

int time_scale_free ( time_scale_state_t s  ) 

Free a time scale context.

Parameters:
s The time scale context.
Returns:
0 for OK, else -1.

time_scale_state_t* time_scale_init ( time_scale_state_t s,
int  sample_rate,
float  playout_rate 
)

Initialise a time scale context.

Initialise a time scale context. This must be called before the first use of the context, to initialise its contents.

Parameters:
s The time scale context.
sample_rate The sample rate of the signal.
playout_rate The ratio between the output speed and the input speed.
Returns:
A pointer to the context, or NULL if there was a problem.

References time_scale_state_t::buf_len, time_scale_state_t::fill, time_scale_state_t::lcp, time_scale_state_t::max_pitch, time_scale_state_t::min_pitch, time_scale_state_t::rate_nudge, time_scale_state_t::sample_rate, and time_scale_rate().

int time_scale_max_output_len ( time_scale_state_t s,
int  input_len 
)

Find the maximum possible output samples.

Find the maximum possible samples which could result from scaling the specified number of input samples, at the current playback rate.

Parameters:
s The time scale context.
input_len The number of input samples.
Returns:
The maximum possible output samples.

References time_scale_state_t::min_pitch, and time_scale_state_t::playout_rate.

int time_scale_rate ( time_scale_state_t s,
float  playout_rate 
)

Change the time scale rate.

Change the time scale rate.

Parameters:
s The time scale context.
playout_rate The ratio between the output speed and the input speed.
Returns:
0 if changed OK, else -1.

Referenced by time_scale_init().


Generated on Tue Oct 7 20:25:52 2008 for spandsp by  doxygen 1.5.6