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

Applications Programming Interface

Chris@41:

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

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

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

Chris@41:

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

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

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

Chris@41: Chris@41:

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

Chris@41: Chris@41:

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

Chris@41: Chris@41:

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

Chris@41: Chris@41: Chris@41: Chris@41: Chris@41: Chris@41:
Chris@41:
Chris@41: Chris@41: Chris@41: