annotate src/libsamplerate-0.1.8/doc/api_simple.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>Simple API</B></H1>
Chris@0 57
Chris@0 58 <P>
Chris@0 59 <B>Important Note:</B>
Chris@0 60 The simple API is not designed to work on small chunks of a larger piece of
Chris@0 61 audio.
Chris@0 62 If you attempt to use it this way you are doing it wrong and will not get the
Chris@0 63 results you want.
Chris@0 64 For processing audio data in chunks you <b>must</b> use the
Chris@0 65 <a href="api_full.html">full api</a>
Chris@0 66 or the
Chris@0 67 <a href="api_callback.html">callback based api</a>.
Chris@0 68 </P>
Chris@0 69
Chris@0 70 <br/><br/>
Chris@0 71
Chris@0 72 <P>
Chris@0 73 The simple API consists of a single function :
Chris@0 74 </P>
Chris@0 75 <PRE>
Chris@0 76 int src_simple (SRC_DATA *data, int converter_type, int channels) ;
Chris@0 77 </PRE>
Chris@0 78 <P>
Chris@0 79 The use of this function rather than the more fully featured API requires the caller
Chris@0 80 to know the total length of the input data before hand and that all input and output
Chris@0 81 data can be held in the system's memory at once.
Chris@0 82 It also assumes that there is a single constant ratio between input and output sample
Chris@0 83 rates.
Chris@0 84 <!--
Chris@0 85 If these conditions cannot be met, the full featured API should be used instead.
Chris@0 86 In addition, this documentation is complemented by this
Chris@0 87 <A HREF="ex_simple.html">example code</A>. -->
Chris@0 88 </P>
Chris@0 89
Chris@0 90 <P>
Chris@0 91 Dealing with the easy stuff first, the <B>converter_type</B> parameter should be
Chris@0 92 one of the values defined in <B>samplerate.h</B> and documented
Chris@0 93 <A HREF="api_misc.html#Converters">here</A> while the <b>channels</b> parameter
Chris@0 94 specifies the number of interleaved channels that the sample rate converter
Chris@0 95 is being asked to process (number of input channels and output channels is always
Chris@0 96 equal).
Chris@0 97 There is no hard upper limit on the number of channels; it is limited purely
Chris@0 98 by the amount of memory available.
Chris@0 99 </P>
Chris@0 100
Chris@0 101
Chris@0 102 <P>
Chris@0 103 The first parameter to <B>src_simple</B> is a pointer to an <B>SRC_DATA</B> struct
Chris@0 104 (more info <A HREF="api_misc.html#SRC_DATA">here</A>) defined as follows:
Chris@0 105 </P>
Chris@0 106 <PRE>
Chris@0 107 typedef struct
Chris@0 108 { float *data_in, *data_out ;
Chris@0 109
Chris@0 110 long input_frames, output_frames ;
Chris@0 111 long input_frames_used, output_frames_gen ;
Chris@0 112
Chris@0 113 int end_of_input ;
Chris@0 114
Chris@0 115 double src_ratio ;
Chris@0 116 } SRC_DATA ;
Chris@0 117 </PRE>
Chris@0 118 <P>
Chris@0 119 The fields of this struct which must be filled in by the caller are:
Chris@0 120 </P>
Chris@0 121 <PRE>
Chris@0 122 data_in : A pointer to the input data samples.
Chris@0 123 input_frames : The number of frames of data pointed to by data_in.
Chris@0 124 data_out : A pointer to the output data samples.
Chris@0 125 output_frames : Maximum number of frames pointer to by data_out.
Chris@0 126 src_ratio : Equal to output_sample_rate / input_sample_rate.
Chris@0 127 </PRE>
Chris@0 128 <P>
Chris@0 129 When the <B>src_simple</B> function returns <B>output_frames_gen</B> will be
Chris@0 130 set to the number of output frames generated and <B>input_frames_used</B> will
Chris@0 131 be set to the number of input frames used to generate the provided number of
Chris@0 132 output frames.
Chris@0 133 </P>
Chris@0 134 <P>
Chris@0 135 The <B>src_simple</B> function returns a non-zero value when an error occurs.
Chris@0 136 See <A HREF="api_misc.html#ErrorReporting">here</A> for how to convert the error value into
Chris@0 137 a text string.
Chris@0 138 </P>
Chris@0 139
Chris@0 140 </DIV>
Chris@0 141 </TD></TR>
Chris@0 142 </TABLE>
Chris@0 143
Chris@0 144 </BODY>
Chris@0 145 </HTML>
Chris@0 146