annotate src/libsamplerate-0.1.8/doc/api_full.html @ 23:619f715526df sv_v2.1

Update Vamp plugin SDK to 2.5
author Chris Cannam
date Thu, 09 May 2013 10:52:46 +0100
parents c7265573341e
children
rev   line source
Chris@0 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Chris@0 2 <HTML>
Chris@0 3
Chris@0 4 <HEAD>
Chris@0 5 <TITLE>
Chris@0 6 Secret Rabbit Code (aka libsamplerate)
Chris@0 7 </TITLE>
Chris@0 8 <META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
Chris@0 9 <META NAME="Version" CONTENT="libsamplerate-0.1.8">
Chris@0 10 <META NAME="Description" CONTENT="The Secret Rabbit Code Home Page">
Chris@0 11 <META NAME="Keywords" CONTENT="libsamplerate sound resample audio dsp Linux">
Chris@0 12 <LINK REL=StyleSheet HREF="SRC.css" TYPE="text/css" MEDIA="all">
Chris@0 13 </HEAD>
Chris@0 14
Chris@0 15 <BODY TEXT="#FFFFFF" BGCOLOR="#000000" LINK="#FB1465" VLINK="#FB1465" ALINK="#FB1465">
Chris@0 16 <!-- pepper -->
Chris@0 17 <CENTER>
Chris@0 18 <IMG SRC="SRC.png" HEIGHT=100 WIDTH=760 ALT="SRC.png">
Chris@0 19 </CENTER>
Chris@0 20 <!-- pepper -->
Chris@0 21 <BR>
Chris@0 22 <!-- pepper -->
Chris@0 23 <TABLE ALIGN="center" WIDTH="98%">
Chris@0 24 <TR>
Chris@0 25 <TD VALIGN="top">
Chris@0 26 <BR>
Chris@0 27 <DIV CLASS="nav">
Chris@0 28 <BR>
Chris@0 29 <A HREF="index.html">Home</A><BR>
Chris@0 30 <BR>
Chris@0 31 <A HREF="api_simple.html">Simple API</A><BR>
Chris@0 32 <A HREF="api_full.html">Full API</A><BR>
Chris@0 33 <A HREF="api_callback.html">Callback API</A><BR>
Chris@0 34 <A HREF="api_misc.html">Miscellaneous</A><BR>
Chris@0 35 <A HREF="api_misc.html#ErrorReporting">Error Handling</A><BR>
Chris@0 36 <BR>
Chris@0 37 <DIV CLASS="block">
Chris@0 38 Author :<BR>Erik de Castro Lopo
Chris@0 39 <!-- pepper -->
Chris@0 40 <BR><BR>
Chris@0 41 <!-- pepper -->
Chris@0 42
Chris@0 43 </DIV>
Chris@0 44 <IMG SRC=
Chris@0 45 "/cgi-bin/Count.cgi?ft=6|frgb=55;55;55|tr=0|md=6|dd=B|st=1|sh=1|df=src_api.dat"
Chris@0 46 HEIGHT=30 WIDTH=100 ALT="counter.gif">
Chris@0 47 </DIV>
Chris@0 48
Chris@0 49 </TD>
Chris@0 50 <!-- pepper -->
Chris@0 51 <!-- ######################################################################## -->
Chris@0 52 <!-- pepper -->
Chris@0 53 <TD VALIGN="top">
Chris@0 54 <DIV CLASS="block">
Chris@0 55
Chris@0 56 <H1><B>Full API</B></H1>
Chris@0 57 <P>
Chris@0 58 The full API consists of the following functions :
Chris@0 59 </P>
Chris@0 60 <PRE>
Chris@0 61 SRC_STATE* <A HREF="#Init">src_new</A> (int converter_type, int channels, int *error) ;
Chris@0 62 SRC_STATE* <A HREF="#CleanUp">src_delete</A> (SRC_STATE *state) ;
Chris@0 63
Chris@0 64 int <A HREF="#Process">src_process</A> (SRC_STATE *state, SRC_DATA *data) ;
Chris@0 65 int <A HREF="#Reset">src_reset</A> (SRC_STATE *state) ;
Chris@0 66 int <A HREF="#SetRatio">src_set_ratio</A> (SRC_STATE *state, double new_ratio) ;
Chris@0 67 </PRE>
Chris@0 68
Chris@0 69 <A NAME="Init"></A>
Chris@0 70 <H3><BR>Initialisation</H3>
Chris@0 71 <PRE>
Chris@0 72 SRC_STATE* src_new (int converter_type, int channels, int *error) ;
Chris@0 73 </PRE>
Chris@0 74 <P>
Chris@0 75 The <B>src_new</B> function returns an anonymous pointer to a sample rate
Chris@0 76 converter object, src_state.
Chris@0 77 If an error occurs the function returns a NULL pointer and fills in the
Chris@0 78 error value pointed to by the <B>error</B> pointer supplied by the caller.
Chris@0 79 The converter must be one of the supplied converter types documented
Chris@0 80 <A HREF="api_misc.html#Converters">here</A>.
Chris@0 81 </P>
Chris@0 82
Chris@0 83 <A NAME="CleanUp"></A>
Chris@0 84 <H3><BR>Cleanup</H3>
Chris@0 85 <PRE>
Chris@0 86 SRC_STATE* src_delete (SRC_STATE *state) ;
Chris@0 87 </PRE>
Chris@0 88 <P>
Chris@0 89 The <B>src_delete</B> function frees up all memory allocated for the given sample
Chris@0 90 rate converter object and returns a NULL pointer.
Chris@0 91 The caller is responsible for freeing any memory passed to the sample rate converter
Chris@0 92 via the pointer to the <B>SRC_DATA</B> struct.
Chris@0 93 </P>
Chris@0 94
Chris@0 95 <A NAME="Process"></A>
Chris@0 96 <H3><BR>Process</H3>
Chris@0 97 <PRE>
Chris@0 98 int src_process (SRC_STATE *state, SRC_DATA *data) ;
Chris@0 99 </PRE>
Chris@0 100 <P>
Chris@0 101 The <B>src_process</B> function processes the data provided by the caller
Chris@0 102 in an <B>SRC_DATA</B> struct using the sample rate converter object specified
Chris@0 103 by the <B>SRC_STATE</B> pointer.
Chris@0 104 When operating on streaming data, this function can be called over and over again,
Chris@0 105 with each new call providing new input data and returning new output data.
Chris@0 106 </P>
Chris@0 107
Chris@0 108 <P>
Chris@0 109 The <B>SRC_DATA</B> struct passed as the second parameter to the <B>src_process</B>
Chris@0 110 function has the following fields:
Chris@0 111 </P>
Chris@0 112 <PRE>
Chris@0 113 typedef struct
Chris@0 114 { float *data_in, *data_out ;
Chris@0 115
Chris@0 116 long input_frames, output_frames ;
Chris@0 117 long input_frames_used, output_frames_gen ;
Chris@0 118
Chris@0 119 int end_of_input ;
Chris@0 120
Chris@0 121 double src_ratio ;
Chris@0 122 } SRC_DATA ;
Chris@0 123 </PRE>
Chris@0 124 <P>
Chris@0 125 The fields of this struct which must be filled in by the caller are:
Chris@0 126 </P>
Chris@0 127 <PRE>
Chris@0 128 data_in : A pointer to the input data samples.
Chris@0 129 input_frames : The number of frames of data pointed to by data_in.
Chris@0 130 data_out : A pointer to the output data samples.
Chris@0 131 output_frames : Maximum number of frames pointer to by data_out.
Chris@0 132 src_ratio : Equal to output_sample_rate / input_sample_rate.
Chris@0 133 end_of_input : Equal to 0 if more input data is available and 1
Chris@0 134 otherwise.
Chris@0 135 </PRE>
Chris@0 136 <P>
Chris@0 137 Note that the data_in and data_out arrays may not overlap. If they do, the
Chris@0 138 library will return an error code.
Chris@0 139 </P>
Chris@0 140 <P>
Chris@0 141 When the <B>src_process</B> function returns <B>output_frames_gen</B> will be
Chris@0 142 set to the number of output frames generated and <B>input_frames_used</B> will
Chris@0 143 be set to the number of input frames consumed to generate the provided number of
Chris@0 144 output frames.
Chris@0 145 </P>
Chris@0 146
Chris@0 147 <P>
Chris@0 148 The <B>src_process</B> function returns non-zero if an error occurs.
Chris@0 149 The non-zero error return value can be decoded into a text string using the function
Chris@0 150 documented <A HREF="api_misc.html#ErrorReporting">here</A>.
Chris@0 151 </P>
Chris@0 152
Chris@0 153 <A NAME="Reset"></A>
Chris@0 154 <H3><BR>Reset</H3>
Chris@0 155 <PRE>
Chris@0 156 int src_reset (SRC_STATE *state) ;
Chris@0 157 </PRE>
Chris@0 158 <P>
Chris@0 159 The <B>src_reset</B> function resets the internal state of the sample rate
Chris@0 160 converter object to the same state it had immediately after its creation using
Chris@0 161 <B>src_new</B>.
Chris@0 162 This should be called whenever a sample rate converter is to be used on two
Chris@0 163 separate, unrelated pieces of audio.
Chris@0 164 </P>
Chris@0 165
Chris@0 166 <A NAME="SetRatio"></A>
Chris@0 167 <H3><BR>Set Ratio</H3>
Chris@0 168 <PRE>
Chris@0 169 int src_set_ratio (SRC_STATE *state, double new_ratio) ;
Chris@0 170 </PRE>
Chris@0 171
Chris@0 172 <p>
Chris@0 173 When using the <B>src_process</B> or <B>src_callback_process</B> APIs and
Chris@0 174 updating the <B>src_ratio</B> field of the <B>SRC_STATE</B> struct, the library
Chris@0 175 will try to smoothly transition between the conversion ratio of the last call
Chris@0 176 and the conversion ratio of the current call.
Chris@0 177 <p/>
Chris@0 178
Chris@0 179 <P>
Chris@0 180 If the user want to bypass this smooth transition and achieve a step response in
Chris@0 181 the conversion ratio, the <B>src_set_ratio</B> function can be used to set the
Chris@0 182 starting conversion ratio of the next call to <B>src_process</B> or
Chris@0 183 <B>src_callback_process</B>.
Chris@0 184 <p/>
Chris@0 185
Chris@0 186 <P>
Chris@0 187 This function returns non-zero on error and the error return value can be
Chris@0 188 decoded into a text string using the function documented
Chris@0 189 <A HREF="api_misc.html#ErrorReporting">here</A>.</P>
Chris@0 190
Chris@0 191 <!-- <A HREF="mailto:aldel@mega-nerd.com">For the spam bots</A> -->
Chris@0 192
Chris@0 193 </DIV>
Chris@0 194 </TD></TR>
Chris@0 195 </TABLE>
Chris@0 196
Chris@0 197 </BODY>
Chris@0 198 </HTML>
Chris@0 199