Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

switch_resample.h File Reference


Detailed Description

Audio Resample Code.

This module implements a generic interface for doing audio resampling it currently uses libresample but can be ported to any resample library with a little effort. I decided against making this interface pluggable because there are not many options in terms of resample libraries so it seemed like a waste but I did opt to frontend the interface in case a better way comes along some day. =D


Data Structures

struct  switch_audio_resampler_t
 An audio resampling handle. More...

Defines

#define switch_normalize_volume(x)   if(x > 4) x = 4; if (x < -4) x = -4;

Functions

switch_status_t switch_resample_create (switch_audio_resampler_t **new_resampler, int from_rate, switch_size_t from_size, int to_rate, uint32_t to_size, switch_memory_pool_t *pool)
 Prepare a new resampler handle.
void switch_resample_destroy (switch_audio_resampler_t **resampler)
 Destroy an existing resampler handle.
uint32_t switch_resample_process (switch_audio_resampler_t *resampler, float *src, int srclen, float *dst, uint32_t dstlen, int last)
 Resample one float buffer into another using specifications of a given handle.
switch_size_t switch_float_to_short (float *f, short *s, switch_size_t len)
 Convert an array of floats to an array of shorts.
int switch_char_to_float (char *c, float *f, int len)
 Convert an array of chars to an array of floats.
int switch_float_to_char (float *f, char *c, int len)
 Convert an array of floats to an array of chars.
int switch_short_to_float (short *s, float *f, int len)
 Convert an array of shorts to an array of floats.
void switch_swap_linear (int16_t *buf, int len)
 Perform a byteswap on a buffer of 16 bit samples.
void switch_generate_sln_silence (int16_t *data, uint32_t samples, uint32_t divisor)
 Generate static noise.
void switch_change_sln_volume (int16_t *data, uint32_t samples, int32_t vol)
 Change the volume of a signed linear audio frame.
uint32_t switch_merge_sln (int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples)


Define Documentation

#define switch_normalize_volume  )     if(x > 4) x = 4; if (x < -4) x = -4;
 


Function Documentation

uint32_t switch_merge_sln int16_t *  data,
uint32_t  samples,
int16_t *  other_data,
uint32_t  other_samples
 

00224 {
00225         int i;
00226         int32_t x, z;
00227 
00228         if (samples > other_samples) {
00229                 x = other_samples;
00230         } else {
00231                 x = samples;
00232         }
00233 
00234         for(i = 0; i < x; i++) {
00235                 z = data[i] + other_data[i];
00236                 switch_normalize_to_16bit(z);
00237                 data[i] = (int16_t) z;
00238         }
00239 
00240         return x;
00241 }


Generated on Mon May 26 22:06:52 2008 for FreeSWITCH by  doxygen 1.3.9.1