<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>libresample: include/libresample.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">libresample <span id="projectnumber">0.1.3</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#func-members">Functions</a> </div> <div class="headertitle"> <h1>include/libresample.h File Reference</h1> </div> </div> <div class="contents"> <p>libresample API <a href="#_details">More...</a></p> <p><a href="libresample_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="libresample_8h.html#a81a23e872b8d33e260659a9c5d433424">resample_open</a> (int highQuality, double minFactor, double maxFactor)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Create a resampler. <a href="#a81a23e872b8d33e260659a9c5d433424"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="libresample_8h.html#a9a1379b4feee283e6e85cd599e32e5d5">resample_dup</a> (const void *handle)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Duplicate a resampler. <a href="#a9a1379b4feee283e6e85cd599e32e5d5"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libresample_8h.html#a70b6ec0ecff37e5c1a76f8ac4d84ee91">resample_get_filter_width</a> (const void *handle)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get filter width for resampler. <a href="#a70b6ec0ecff37e5c1a76f8ac4d84ee91"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="libresample_8h.html#ad865648128b94cfa46e44cf120605509">resample_process</a> (void *handle, double factor, float *inBuffer, int inBufferLen, int lastFlag, int *inBufferUsed, float *outBuffer, int outBufferLen)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Resample a chunk of audio. <a href="#ad865648128b94cfa46e44cf120605509"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="libresample_8h.html#addd2d8ef2ec997104c5c22401a93a734">resample_close</a> (void *handle)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Close a resampler. <a href="#addd2d8ef2ec997104c5c22401a93a734"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <div class="textblock"><p>libresample API </p> <dl class="author"><dt><b>Author:</b></dt><dd>Dominic Mazzoni </dd></dl> </div><hr/><h2>Function Documentation</h2> <a class="anchor" id="addd2d8ef2ec997104c5c22401a93a734"></a><!-- doxytag: member="libresample.h::resample_close" ref="addd2d8ef2ec997104c5c22401a93a734" args="(void *handle)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void resample_close </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"><em>handle</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Close a resampler. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">handle</td><td>the resampler to close</td></tr> </table> </dd> </dl> <p>Use this function to release a handle to a resampler that was created using either <a class="el" href="libresample_8h.html#a81a23e872b8d33e260659a9c5d433424" title="Create a resampler.">resample_open()</a> or <a class="el" href="libresample_8h.html#a9a1379b4feee283e6e85cd599e32e5d5" title="Duplicate a resampler.">resample_dup()</a>.</p> <dl class="return"><dt><b>Returns:</b></dt><dd>nothing. </dd></dl> </div> </div> <a class="anchor" id="a9a1379b4feee283e6e85cd599e32e5d5"></a><!-- doxytag: member="libresample.h::resample_dup" ref="a9a1379b4feee283e6e85cd599e32e5d5" args="(const void *handle)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void* resample_dup </td> <td>(</td> <td class="paramtype">const void * </td> <td class="paramname"><em>handle</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Duplicate a resampler. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">handle</td><td>the resampler to duplicate</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>A new handle to a resampler, initialized with the same parameters used to create the original resampler. </dd></dl> </div> </div> <a class="anchor" id="a70b6ec0ecff37e5c1a76f8ac4d84ee91"></a><!-- doxytag: member="libresample.h::resample_get_filter_width" ref="a70b6ec0ecff37e5c1a76f8ac4d84ee91" args="(const void *handle)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int resample_get_filter_width </td> <td>(</td> <td class="paramtype">const void * </td> <td class="paramname"><em>handle</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Get filter width for resampler. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">handle</td><td>the resampler</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the filter width. </dd></dl> </div> </div> <a class="anchor" id="a81a23e872b8d33e260659a9c5d433424"></a><!-- doxytag: member="libresample.h::resample_open" ref="a81a23e872b8d33e260659a9c5d433424" args="(int highQuality, double minFactor, double maxFactor)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void* resample_open </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"><em>highQuality</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"><em>minFactor</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"><em>maxFactor</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Create a resampler. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">highQuality</td><td>Set this argument to non-zero to enable higher quality resampling. </td></tr> <tr><td class="paramname">minFactor</td><td>This is the minimum resampling factor that will be used for this resampler. The resampling factor is calculated in the following way: ( from sample rate / to sample rate ). </td></tr> <tr><td class="paramname">maxFactor</td><td>This is the maximum resampling factor that will be used for this resampler.</td></tr> </table> </dd> </dl> <p>Use this function to create a new resampler that will maintain state information about the stream of audio being resampled.</p> <dl class="return"><dt><b>Returns:</b></dt><dd>A handle to a new resampler </dd></dl> </div> </div> <a class="anchor" id="ad865648128b94cfa46e44cf120605509"></a><!-- doxytag: member="libresample.h::resample_process" ref="ad865648128b94cfa46e44cf120605509" args="(void *handle, double factor, float *inBuffer, int inBufferLen, int lastFlag, int *inBufferUsed, float *outBuffer, int outBufferLen)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int resample_process </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"><em>handle</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"><em>factor</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">float * </td> <td class="paramname"><em>inBuffer</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>inBufferLen</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>lastFlag</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int * </td> <td class="paramname"><em>inBufferUsed</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">float * </td> <td class="paramname"><em>outBuffer</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>outBufferLen</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Resample a chunk of audio. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">handle</td><td>the resampler </td></tr> <tr><td class="paramname">factor</td><td>the resampling factor. This factor should be calculated as ( from sample rate / to sample rate ). So, for converting from 8 kHz to 16 kHz, this value would be 2.0. </td></tr> <tr><td class="paramname">inBuffer</td><td>the input buffer for audio to resample. </td></tr> <tr><td class="paramname">inBufferLen</td><td>the number of samples in the input buffer </td></tr> <tr><td class="paramname">lastFlag</td><td>Set this argument to non-zero if the data in the input buffer is known to be the end of a stream. This would be used if you're resampling a file, for example. </td></tr> <tr><td class="paramname">inBufferUsed</td><td>This is an output parameter that indicates how many samples were consumed from the input buffer. Generally, this function is called in a loop until you know that the entire input buffer has been consumed, as it may take multiple calls to complete. </td></tr> <tr><td class="paramname">outBuffer</td><td>This is the output buffer. This function will write the resampled audio into this buffer. </td></tr> <tr><td class="paramname">outBufferLen</td><td>This parameter specifies how many samples there is room for in the output buffer.</td></tr> </table> </dd> </dl> <p>This is the main function used for resampling audio. It should be called in a loop until all of the data from the input buffer is consumed, or the output buffer has been filled.</p> <dl class="return"><dt><b>Returns:</b></dt><dd>the number of samples written to the output buffer. If the return value is equal to the value provided in the outBufferLen parameter, then the output buffer has been filled. </dd></dl> </div> </div> </div> <hr class="footer"/><address class="footer"><small>Generated on Tue Feb 8 2011 for libresample by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address> </body> </html>