Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Secret Rabbit Code (aka libsamplerate) Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0:
Chris@0: SRC.png Chris@0:
Chris@0: Chris@0:
Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0:
Chris@0:
Chris@0: Chris@0: Chris@0:
Chris@0:
Chris@0: Chris@0:

Applications Programming Interface

Chris@0:

Chris@0: The publically callable functions of libsamplerate are all listed in the Chris@0: <samplerate.h> header file. Chris@0: In order to use any of the functionality of libsamplerate, you need to add Chris@0:

Chris@0:
Chris@0: 	#include <samplerate.h>
Chris@0: 
Chris@0:

Chris@0: to the top of any function that call any of the following functions. Chris@0: You will also need to link you binary with the libsamplerate library. Chris@0:

Chris@0:

Chris@0: The API allows three methods for accessing the capabilies of the library: Chris@0:

Chris@0:
    Chris@0:
  • A simple interface which can sample rate convert Chris@0: a single block of samples (one or more channels) in one go. Chris@0: The simple API is less capable than the full API. Chris@0:
  • A more fully featured interface which allows time Chris@0: varying sample rate conversion on streaming data (again one or more Chris@0: channels). Chris@0:
  • A callback interface which has the same Chris@0: functionality as the interface above but allows the details of input and Chris@0: output to be separated. Chris@0: The output is generated by call a read function and the library calls a user Chris@0: supplied callback function to obtain its input. Chris@0: This interface is particularly well suited to applications where the output Chris@0: sample rate is varied with time. Chris@0:
Chris@0: Chris@0:

Chris@0: NB : All three access methods are able to process multi channel interleaved Chris@0: data. Chris@0:

Chris@0: Chris@0:

Chris@0: The parts of the API which are common to all three interfaces are: Chris@0:

Chris@0: Chris@0:

Chris@0: All three versions of the API are restricted to operating on buffers of ISO C Chris@0: Standard float data. Chris@0: However, there are two Chris@0: auxillary functions Chris@0: for converting arrays of float data to and from short data. Chris@0:

Chris@0: Chris@0:

Chris@0: Note: The tests/ and examples/ directories of the source code Chris@0: distribution contain numerous example programs showing the use of the library. Chris@0:

Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0:
Chris@0:
Chris@0: Chris@0: Chris@0: