cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: Secret Rabbit Code (aka libsamplerate) cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126:
cannam@126: SRC.png cannam@126:
cannam@126: cannam@126:
cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126:
cannam@126:
cannam@126: cannam@126: cannam@126:
cannam@126:
cannam@126: cannam@126:

Applications Programming Interface

cannam@126:

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

cannam@126:
cannam@126: 	#include <samplerate.h>
cannam@126: 
cannam@126:

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

cannam@126:

cannam@126: The API allows three methods for accessing the capabilies of the library: cannam@126:

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

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

cannam@126: cannam@126:

cannam@126: The parts of the API which are common to all three interfaces are: cannam@126:

cannam@126: cannam@126:

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

cannam@126: cannam@126:

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

cannam@126: cannam@126: cannam@126: cannam@126: cannam@126: cannam@126:
cannam@126:
cannam@126: cannam@126: cannam@126: