<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Crystal Space 1.2.1: csplugincommon/sndsys/convert.h Source File (Crystal Space 1.2.1 Public API Reference)</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="head"> <tr height="59"> <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td> <td class="head"><h2>Public API Reference</h2></td> </tr> <tr height="11"> <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td> </tr> </table> <div class="content"> <!-- Generated by Doxygen 1.5.3 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> <h1>csplugincommon/sndsys/convert.h</h1><a href="convert_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> Copyright (C) 2004 by Andrew Mann</span> <a name="l00003"></a>00003 <span class="comment"></span> <a name="l00004"></a>00004 <span class="comment"> This library is free software; you can redistribute it and/or</span> <a name="l00005"></a>00005 <span class="comment"> modify it under the terms of the GNU Library General Public</span> <a name="l00006"></a>00006 <span class="comment"> License as published by the Free Software Foundation; either</span> <a name="l00007"></a>00007 <span class="comment"> version 2 of the License, or (at your option) any later version.</span> <a name="l00008"></a>00008 <span class="comment"></span> <a name="l00009"></a>00009 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00010"></a>00010 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00011"></a>00011 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00012"></a>00012 <span class="comment"> Library General Public License for more details.</span> <a name="l00013"></a>00013 <span class="comment"></span> <a name="l00014"></a>00014 <span class="comment"> You should have received a copy of the GNU Library General Public</span> <a name="l00015"></a>00015 <span class="comment"> License along with this library; if not, write to the Free</span> <a name="l00016"></a>00016 <span class="comment"> Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span> <a name="l00017"></a>00017 <span class="comment">*/</span> <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="preprocessor">#ifndef __CS_SNDSYS_CONVERT_H__</span> <a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define __CS_SNDSYS_CONVERT_H__</span> <a name="l00021"></a>00021 <span class="preprocessor"></span> <a name="l00032"></a><a class="code" href="convert_8h.html#3753a3357de67633466955d89dc78aca">00032</a> <span class="preprocessor">#define CS_SOUND_ELEMENT_MAX_CHANNELS 8</span> <a name="l00033"></a>00033 <span class="preprocessor"></span> <a name="l00056"></a><a class="code" href="convert_8h.html#1e4762f59d72a6cf34ce725c5adc9c93">00056</a> <span class="preprocessor">#define CS_SOUND_INTERNAL_FREQUENCY_DIVISOR 1024</span> <a name="l00057"></a>00057 <span class="preprocessor"></span> <a name="l00058"></a>00058 <span class="keyword">namespace </span>CS <a name="l00059"></a>00059 { <a name="l00060"></a><a class="code" href="namespaceCS_1_1SndSys.html">00060</a> <span class="keyword">namespace </span>SndSys <a name="l00061"></a>00061 { <a name="l00101"></a><a class="code" href="classCS_1_1SndSys_1_1PCMSampleConverter.html">00101</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classCS_1_1SndSys_1_1PCMSampleConverter.html" title="A PCMSampleConverter object converts PCM data from one format to another.">PCMSampleConverter</a> <a name="l00102"></a>00102 { <a name="l00103"></a>00103 <span class="keyword">public</span>: <a name="l00105"></a>00105 <a class="code" href="classCS_1_1SndSys_1_1PCMSampleConverter.html" title="A PCMSampleConverter object converts PCM data from one format to another.">PCMSampleConverter</a>(<span class="keywordtype">int</span> source_channels, <span class="keywordtype">int</span> source_bitspersample, <a name="l00106"></a>00106 <span class="keywordtype">int</span> source_frequency, <span class="keywordtype">bool</span> swap16=<span class="keyword">false</span>); <a name="l00107"></a>00107 ~<a class="code" href="classCS_1_1SndSys_1_1PCMSampleConverter.html" title="A PCMSampleConverter object converts PCM data from one format to another.">PCMSampleConverter</a>(); <a name="l00108"></a>00108 <a name="l00121"></a>00121 <span class="keywordtype">int</span> GetRequiredOutputBufferMultiple(<span class="keywordtype">int</span> dest_channels, <a name="l00122"></a>00122 <span class="keywordtype">int</span> dest_bitspersample, <span class="keywordtype">int</span> dest_frequency); <a name="l00123"></a>00123 <a name="l00124"></a>00124 <a name="l00135"></a>00135 <span class="keywordtype">int</span> ConvertBuffer(<span class="keyword">const</span> <span class="keywordtype">void</span> *source, <span class="keywordtype">size_t</span> source_len, <span class="keywordtype">void</span> *dest, <a name="l00136"></a>00136 <span class="keywordtype">int</span> dest_channels, <span class="keywordtype">int</span> dest_bitspersample, <span class="keywordtype">int</span> dest_frequency); <a name="l00137"></a>00137 <a name="l00152"></a>00152 <span class="keywordtype">void</span> SetSourceProperties(<span class="keywordtype">int</span> source_channels, <span class="keywordtype">int</span> source_bitspersample, <a name="l00153"></a>00153 <span class="keywordtype">int</span> source_frequency); <a name="l00154"></a>00154 <a name="l00155"></a>00155 <span class="keyword">protected</span>: <a name="l00156"></a>00156 <span class="keywordtype">bool</span> ReadFullSample8(<span class="keyword">const</span> <span class="keywordtype">void</span> **source, <span class="keywordtype">size_t</span> *source_len, <a name="l00157"></a>00157 <span class="keywordtype">int</span> *sample_buffer); <a name="l00158"></a>00158 <span class="keywordtype">bool</span> ReadFullSample16(<span class="keyword">const</span> <span class="keywordtype">void</span> **source, <span class="keywordtype">size_t</span> *source_len, <a name="l00159"></a>00159 <span class="keywordtype">int</span> *sample_buffer); <a name="l00160"></a>00160 <span class="keywordtype">bool</span> ReadFullSample(<span class="keyword">const</span> <span class="keywordtype">void</span> **source, <span class="keywordtype">size_t</span> *source_len, <a name="l00161"></a>00161 <span class="keywordtype">int</span> *sample_buffer); <a name="l00162"></a>00162 <span class="keywordtype">int</span> WriteSample8(<span class="keywordtype">int</span> *sample_buffer, <span class="keywordtype">void</span> **dest, <span class="keywordtype">int</span> dest_channels); <a name="l00163"></a>00163 <span class="keywordtype">int</span> WriteSample16(<span class="keywordtype">int</span> *sample_buffer, <span class="keywordtype">void</span> **dest, <span class="keywordtype">int</span> dest_channels); <a name="l00164"></a>00164 <span class="keywordtype">int</span> WriteSample(<span class="keywordtype">int</span> *sample_buffer, <span class="keywordtype">void</span> **dest, <span class="keywordtype">int</span> dest_channels, <a name="l00165"></a>00165 <span class="keywordtype">int</span> dest_bitspersample); <a name="l00166"></a>00166 <span class="keywordtype">size_t</span> AdvanceSourceSamples(<span class="keyword">const</span> <span class="keywordtype">void</span> **source, <span class="keywordtype">size_t</span> *source_len, <a name="l00167"></a>00167 <span class="keywordtype">size_t</span> samples_to_advance, <span class="keywordtype">int</span> *sample_buffer); <a name="l00168"></a>00168 <a name="l00169"></a>00169 <span class="keyword">protected</span>: <a name="l00170"></a><a class="code" href="classCS_1_1SndSys_1_1PCMSampleConverter.html#70e82d8486b0076de29741816f80145c">00170</a> <span class="keywordtype">int</span> last_sample[<a class="code" href="convert_8h.html#3753a3357de67633466955d89dc78aca" title="This is the maximum number of channels we&#39;ll mix.">CS_SOUND_ELEMENT_MAX_CHANNELS</a>]; <a name="l00171"></a><a class="code" href="classCS_1_1SndSys_1_1PCMSampleConverter.html#c6eef20af5e344f482599e5374ddee4b">00171</a> <span class="keywordtype">int</span> position_offset; <a name="l00172"></a><a class="code" href="classCS_1_1SndSys_1_1PCMSampleConverter.html#4237ae3a26ab9e22f02ecb112d02df87">00172</a> <span class="keywordtype">int</span> src_channels,src_bytes,src_frequency; <a name="l00173"></a><a class="code" href="classCS_1_1SndSys_1_1PCMSampleConverter.html#44285cd8226e6cd619aef599e4ef87ea">00173</a> <span class="keywordtype">bool</span> swap_16; <a name="l00174"></a>00174 }; <a name="l00175"></a>00175 <a name="l00176"></a>00176 } <span class="comment">// namespace SndSys</span> <a name="l00177"></a>00177 } <span class="comment">// namespace CS</span> <a name="l00178"></a>00178 <a name="l00179"></a>00179 <span class="preprocessor">#endif // __CS_SNDSYS_CONVERT_H__</span> </pre></div><hr size="1"><address><small>Generated for Crystal Space 1.2.1 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 </small></address> </div></body> </html>