<!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>audio.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.10 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>audio.h</h1><a href="audio_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// Copyright (C) 1999-2001 Open Source Telecom Corporation.</font> 00002 <font class="comment">// </font> 00003 <font class="comment">// This program is free software; you can redistribute it and/or modify</font> 00004 <font class="comment">// it under the terms of the GNU General Public License as published by</font> 00005 <font class="comment">// the Free Software Foundation; either version 2 of the License, or</font> 00006 <font class="comment">// (at your option) any later version.</font> 00007 <font class="comment">// </font> 00008 <font class="comment">// This program is distributed in the hope that it will be useful,</font> 00009 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00010 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00011 <font class="comment">// GNU General Public License for more details.</font> 00012 <font class="comment">// </font> 00013 <font class="comment">// You should have received a copy of the GNU General Public License</font> 00014 <font class="comment">// along with this program; if not, write to the Free Software </font> 00015 <font class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</font> 00016 <font class="comment">// </font> 00017 <font class="comment">// As a special exception to the GNU General Public License, permission is </font> 00018 <font class="comment">// granted for additional uses of the text contained in its release </font> 00019 <font class="comment">// of ccaudio.</font> 00020 <font class="comment">// </font> 00021 <font class="comment">// The exception is that, if you link the ccaudio library with other</font> 00022 <font class="comment">// files to produce an executable, this does not by itself cause the</font> 00023 <font class="comment">// resulting executable to be covered by the GNU General Public License.</font> 00024 <font class="comment">// Your use of that executable is in no way restricted on account of</font> 00025 <font class="comment">// linking the ccaudio library code into it.</font> 00026 <font class="comment">// </font> 00027 <font class="comment">// This exception does not however invalidate any other reasons why</font> 00028 <font class="comment">// the executable file might be covered by the GNU General Public License.</font> 00029 <font class="comment">// </font> 00030 <font class="comment">// This exception applies only to the code released under the </font> 00031 <font class="comment">// name ccaudio. If you copy code from other releases into a copy of</font> 00032 <font class="comment">// ccaudio, as the General Public License permits, the exception does</font> 00033 <font class="comment">// not apply to the code that you add in this way. To avoid misleading</font> 00034 <font class="comment">// anyone as to the status of such modified files, you must delete</font> 00035 <font class="comment">// this exception notice from them.</font> 00036 <font class="comment">// </font> 00037 <font class="comment">// If you write modifications of your own for ccaudio, it is your choice</font> 00038 <font class="comment">// whether to permit this exception to apply to your modifications.</font> 00039 <font class="comment">// If you do not wish that, delete this exception notice. </font> 00040 00041 <font class="preprocessor">#ifndef __CCXX_AUDIO_H__</font> 00042 <font class="preprocessor"></font><font class="preprocessor">#define __CCXX_AUDIO_H__</font> 00043 <font class="preprocessor"></font> 00044 <font class="preprocessor">#ifndef __EXPORT</font> 00045 <font class="preprocessor"></font><font class="preprocessor">#define __EXPORT</font> 00046 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00047 <font class="preprocessor"></font> 00048 <font class="preprocessor">#ifndef __CCXX_CONFIG_H__</font> 00049 <font class="preprocessor"></font><font class="preprocessor">#include <cc++/config.h></font> 00050 <font class="preprocessor">#endif</font> 00051 <font class="preprocessor"></font> 00052 <font class="preprocessor">#ifdef CCXX_NAMESPACES</font> 00053 <font class="preprocessor"></font><font class="keyword">namespace </font>ost { 00054 <font class="preprocessor">#endif</font> 00055 <font class="preprocessor"></font> <a name="l00056"></a><a class="code" href="audio_8h.html#a52">00056</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00057 { 00058 SAMPLE_RATE_UNKNOWN, 00059 SAMPLE_RATE_6KHZ = 6000, 00060 SAMPLE_RATE_8KHZ = 8000, 00061 SAMPLE_RATE_44KHZ = 44100 00062 } samplerate_t; 00063 <a name="l00064"></a><a class="code" href="audio_8h.html#a53">00064</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00065 { 00066 UNKNOWN_AUDIO_ENCODING = 0, 00067 G721_ADPCM_ENCODING, 00068 G722_AUDIO_ENCODING, 00069 G722_7BIT_ENCODING, 00070 G722_6BIT_ENCODING, 00071 G723_3BIT_ENCODING, 00072 G723_5BIT_ENCODING, 00073 GSM_VOICE_ENCODING, 00074 MULAW_AUDIO_ENCODING, 00075 ALAW_AUDIO_ENCODING, 00076 OKI_ADPCM_ENCODING, 00077 DIALOGIC_ADPCM_ENCODING, 00078 CDA_STEREO_ENCODING, 00079 CDA_MONO_ENCODING, 00080 PCM8_STEREO_ENCODING, 00081 PCM8_AUDIO_ENCODING, 00082 PCM16_STEREO_ENCODING, 00083 PCM16_AUDIO_ENCODING, 00084 PCM32_STEREO_ENCODING, 00085 PCM32_AUDIO_ENCODING 00086 } audioencoding_t; 00087 <a name="l00088"></a><a class="code" href="audio_8h.html#a54">00088</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00089 { 00090 AUDIO_FORMAT_RAW, 00091 AUDIO_FORMAT_SUN, 00092 AUDIO_FORMAT_RIFF, 00093 AUDIO_FORMAT_WAVE 00094 } audioformat_t; 00095 <a name="l00096"></a><a class="code" href="audio_8h.html#a55">00096</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00097 { 00098 AUDIO_SUCCESS = 0, 00099 AUDIO_READ_LASTFRAME, 00100 AUDIO_NOT_OPENED, 00101 AUDIO_END_OF_FILE, 00102 AUDIO_START_OF_FILE, 00103 AUDIO_RATE_UNSUPPORTED, 00104 AUDIO_ENCODING_UNSUPPORTED, 00105 AUDIO_READ_INTERRUPTED, 00106 AUDIO_WRITE_INTERRUPTED, 00107 AUDIO_READ_FAILURE, 00108 AUDIO_WRITE_FAILURE, 00109 AUDIO_READ_INCOMPLETE, 00110 AUDIO_WRITE_INCOMPLETE, 00111 AUDIO_REQUEST_INVALID, 00112 AUDIO_TOC_FAILED, 00113 AUDIO_STAT_FAILED, 00114 AUDIO_INVALID_TRACK, 00115 AUDIO_PLAYBACK_FAILED, 00116 AUDIO_NOT_PLAYING 00117 } audioerror_t; 00118 <a name="l00119"></a><a class="code" href="structaudioinfo__t.html">00119</a> <font class="keyword">typedef</font> <font class="keyword">struct</font> 00120 <font class="keyword"></font>{ <a name="l00121"></a><a class="code" href="structaudioinfo__t.html#m0">00121</a> audioformat_t format; <a name="l00122"></a><a class="code" href="structaudioinfo__t.html#m1">00122</a> audioencoding_t encoding; <a name="l00123"></a><a class="code" href="structaudioinfo__t.html#m2">00123</a> <font class="keywordtype">unsigned</font> rate; <a name="l00124"></a><a class="code" href="structaudioinfo__t.html#m3">00124</a> <font class="keywordtype">unsigned</font> order; <a name="l00125"></a><a class="code" href="structaudioinfo__t.html#m4">00125</a> <font class="keywordtype">char</font> *annotation; 00126 } <a class="code" href="structaudioinfo__t.html">audioinfo_t</a>; 00127 00128 <a class="code" href="audio_8h.html#a51">CCXX_EXPORT</a>(<font class="keywordtype">bool</font>) ismono(audioencoding_t encoding); 00129 <a class="code" href="audio_8h.html#a51">CCXX_EXPORT</a>(<font class="keywordtype">bool</font>) issterio(audioencoding_t encoding); 00130 <a class="code" href="audio_8h.html#a51">CCXX_EXPORT</a>(samplerate_t) samplerate(audioencoding_t encoding); 00131 <a class="code" href="audio_8h.html#a51">CCXX_EXPORT</a>(<font class="keywordtype">int</font>) sampleframe(audioencoding_t encoding, <font class="keywordtype">int</font> samples = 0); 00132 <a class="code" href="audio_8h.html#a51">CCXX_EXPORT</a>(<font class="keywordtype">int</font>) samplecount(audioencoding_t); 00133 <a class="code" href="audio_8h.html#a51">CCXX_EXPORT</a>(<font class="keywordtype">unsigned</font>) <font class="keywordtype">long</font> tosamples(audioencoding_t encoding, size_t bytes); 00134 <a class="code" href="audio_8h.html#a51">CCXX_EXPORT</a>(<font class="keywordtype">unsigned</font>) <font class="keywordtype">long</font> tobytes(audioencoding_t encoding, <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> samples); 00135 <a class="code" href="audio_8h.html#a51">CCXX_EXPORT</a>(<font class="keywordtype">void</font>) samplefill(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *addr, <font class="keywordtype">int</font> samples, audioencoding_t encoding); 00136 <a name="l00145"></a><a class="code" href="class_audio_file.html">00145</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT <a class="code" href="class_audio_file.html">AudioFile</a> 00146 { 00147 <font class="keyword">private</font>: 00148 <font class="keywordtype">char</font> *pathname; 00149 audioerror_t error; 00150 <a class="code" href="structaudioinfo__t.html">audioinfo_t</a> info; 00151 <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> header; <font class="comment">// offset to start of audio</font> 00152 <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> minimum; <font class="comment">// minimum sample size required</font> 00153 00154 <font class="keywordtype">void</font> Initialize(<font class="keywordtype">void</font>); 00155 <font class="keywordtype">void</font> getWaveFormat(<font class="keywordtype">int</font> size); 00156 00157 <font class="keyword">protected</font>: 00158 <font class="keyword">union</font> 00159 <font class="keyword"> </font>{ <a name="l00160"></a><a class="code" href="class_audio_file.html#n0">00160</a> <font class="keywordtype">int</font> fd; <a name="l00161"></a><a class="code" href="class_audio_file.html#n1">00161</a> <font class="keywordtype">void</font> *handle; 00162 } file; 00163 00164 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> afCreate(<font class="keyword">const</font> <font class="keywordtype">char</font> *path); 00165 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> afOpen(<font class="keyword">const</font> <font class="keywordtype">char</font> *path); 00166 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> afPeek(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *data, <font class="keywordtype">unsigned</font> size); 00167 <font class="keyword">virtual</font> <font class="keywordtype">int</font> afRead(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *data, <font class="keywordtype">unsigned</font> size); 00168 <font class="keyword">virtual</font> <font class="keywordtype">int</font> afWrite(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *data, <font class="keywordtype">unsigned</font> size); 00169 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> afSeek(<font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> pos); 00170 <font class="keyword">virtual</font> <font class="keywordtype">void</font> afClose(<font class="keywordtype">void</font>); 00171 <a name="l00172"></a><a class="code" href="class_audio_file.html#b7">00172</a> <font class="keyword">virtual</font> <font class="keywordtype">char</font> *getContinuation(<font class="keywordtype">void</font>)<font class="keyword"></font> 00173 <font class="keyword"> </font>{<font class="keywordflow">return</font> NULL;}; 00174 00175 audioerror_t setError(audioerror_t err); 00176 00177 <font class="keywordtype">unsigned</font> <font class="keywordtype">short</font> getaushort(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *data); 00178 <font class="keywordtype">void</font> setaushort(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *data, <font class="keywordtype">unsigned</font> <font class="keywordtype">short</font> value); 00179 <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> getaulong(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *data); 00180 <font class="keywordtype">void</font> setaulong(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *data, <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> value); 00181 00182 <font class="keyword">public</font>: 00183 AudioFile(<font class="keyword">const</font> <font class="keywordtype">char</font> *fname, <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> samples = 0); 00184 AudioFile(<font class="keyword">const</font> <font class="keywordtype">char</font> *fname, <a class="code" href="structaudioinfo__t.html">audioinfo_t</a> *info, <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> min = 0); 00185 <a name="l00186"></a><a class="code" href="class_audio_file.html#a2">00186</a> AudioFile()<font class="keyword"></font> 00187 <font class="keyword"> </font>{Initialize();}; 00188 <a name="l00189"></a><a class="code" href="class_audio_file.html#a3">00189</a> ~AudioFile()<font class="keyword"></font> 00190 <font class="keyword"> </font>{Close();}; 00191 00192 <font class="keywordtype">void</font> Open(<font class="keyword">const</font> <font class="keywordtype">char</font> *fname); 00193 <font class="keywordtype">void</font> Create(<font class="keyword">const</font> <font class="keywordtype">char</font> *fname, <a class="code" href="structaudioinfo__t.html">audioinfo_t</a> *info); 00194 <font class="keywordtype">void</font> Close(<font class="keywordtype">void</font>); 00195 <font class="keywordtype">int</font> getBuffer(<font class="keywordtype">void</font> *addr, <font class="keywordtype">unsigned</font> len); 00196 <font class="keywordtype">int</font> putBuffer(<font class="keywordtype">void</font> *attr, <font class="keywordtype">unsigned</font> len); 00197 audioerror_t getSamples(<font class="keywordtype">void</font> *addr, <font class="keywordtype">unsigned</font> samples); 00198 audioerror_t putSamples(<font class="keywordtype">void</font> *addr, <font class="keywordtype">unsigned</font> samples); 00199 audioerror_t Skip(<font class="keywordtype">long</font> samples); 00200 audioerror_t setPosition(<font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> samples = ~0l); 00201 audioerror_t getInfo(<a class="code" href="structaudioinfo__t.html">audioinfo_t</a> *info); 00202 audioerror_t setMinimum(<font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> samples); 00203 <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> getPosition(<font class="keywordtype">void</font>); 00204 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> isOpen(<font class="keywordtype">void</font>); <a name="l00205"></a><a class="code" href="class_audio_file.html#a17">00205</a> <font class="keyword">virtual</font> <font class="keywordtype">bool</font> hasPositioning(<font class="keywordtype">void</font>)<font class="keyword"></font> 00206 <font class="keyword"> </font>{<font class="keywordflow">return</font> <font class="keyword">true</font>;}; 00207 <a name="l00208"></a><a class="code" href="class_audio_file.html#a18">00208</a> <font class="keyword">inline</font> audioencoding_t getEncoding(<font class="keywordtype">void</font>)<font class="keyword"></font> 00209 <font class="keyword"> </font>{<font class="keywordflow">return</font> info.encoding;}; 00210 <a name="l00211"></a><a class="code" href="class_audio_file.html#a19">00211</a> <font class="keyword">inline</font> audioformat_t getFormat(<font class="keywordtype">void</font>)<font class="keyword"></font> 00212 <font class="keyword"> </font>{<font class="keywordflow">return</font> info.format;}; 00213 <a name="l00214"></a><a class="code" href="class_audio_file.html#a20">00214</a> <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> getSampleRate(<font class="keywordtype">void</font>)<font class="keyword"></font> 00215 <font class="keyword"> </font>{<font class="keywordflow">return</font> info.rate;}; <a name="l00216"></a><a class="code" href="class_audio_file.html#a21">00216</a> <font class="keyword">inline</font> <font class="keywordtype">char</font> *getAnnotation(<font class="keywordtype">void</font>)<font class="keyword"></font> 00217 <font class="keyword"> </font>{<font class="keywordflow">return</font> info.annotation;}; 00218 <a name="l00219"></a><a class="code" href="class_audio_file.html#a22">00219</a> <font class="keyword">inline</font> audioerror_t getError(<font class="keywordtype">void</font>)<font class="keyword"></font> 00220 <font class="keyword"> </font>{<font class="keywordflow">return</font> error;}; 00221 <a name="l00222"></a><a class="code" href="class_audio_file.html#a23">00222</a> <font class="keyword">inline</font> <font class="keywordtype">bool</font> operator!(<font class="keywordtype">void</font>)<font class="keyword"></font> 00223 <font class="keyword"> </font>{<font class="keywordflow">return</font> !isOpen();}; 00224 }; 00225 <a name="l00234"></a><a class="code" href="class_c_d_audio.html">00234</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT <a class="code" href="class_c_d_audio.html">CDAudio</a> 00235 { 00236 <font class="keyword">private</font>: 00237 <font class="keyword">union</font> 00238 <font class="keyword"> </font>{ 00239 <font class="keywordtype">int</font> fd; 00240 } file; 00241 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> v0, v1; 00242 <font class="preprocessor">#ifdef __WIN32__</font> 00243 <font class="preprocessor"></font> CRITICAL_SECTION crit; 00244 <font class="keywordtype">bool</font> paused; 00245 <font class="keywordtype">bool</font> opened; 00246 <font class="keywordtype">char</font> position[20]; 00247 <font class="keywordtype">char</font> endmark[24]; 00248 <font class="keywordtype">char</font> ret[256]; 00249 DWORD command(<font class="keywordtype">char</font> *fmt, ...); 00250 <font class="preprocessor">#endif</font> 00251 <font class="preprocessor"></font> audioerror_t err; 00252 00253 <font class="keyword">public</font>: 00254 CDAudio(<font class="keywordtype">int</font> devnbr = 0); 00255 ~CDAudio(); 00256 00257 audioerror_t Play(<font class="keywordtype">int</font> start, <font class="keywordtype">int</font> end = 0); 00258 audioerror_t Stop(<font class="keywordtype">void</font>); 00259 audioerror_t Pause(<font class="keywordtype">void</font>); 00260 audioerror_t Resume(<font class="keywordtype">void</font>); 00261 audioerror_t Eject(<font class="keywordtype">void</font>); 00262 audioerror_t Reload(<font class="keywordtype">void</font>); 00263 <font class="keywordtype">int</font> getFirst(<font class="keywordtype">void</font>); 00264 <font class="keywordtype">int</font> getLast(<font class="keywordtype">void</font>); 00265 <font class="keywordtype">bool</font> isPaused(<font class="keywordtype">void</font>); 00266 <font class="keywordtype">bool</font> isAudio(<font class="keywordtype">int</font> track); 00267 <font class="keywordtype">bool</font> isOpen(<font class="keywordtype">void</font>); 00268 00269 <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> getVolume(<font class="keywordtype">int</font> speaker); 00270 <font class="keywordtype">void</font> setVolume(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> left, <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> right); 00271 <a name="l00272"></a><a class="code" href="class_c_d_audio.html#a15">00272</a> <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> getVolumeLeft(<font class="keywordtype">void</font>)<font class="keyword"></font> 00273 <font class="keyword"> </font>{<font class="keywordflow">return</font> getVolume(0);}; 00274 <a name="l00275"></a><a class="code" href="class_c_d_audio.html#a16">00275</a> <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> getVolumeRight(<font class="keywordtype">void</font>)<font class="keyword"></font> 00276 <font class="keyword"> </font>{<font class="keywordflow">return</font> getVolume(1);}; 00277 <a name="l00278"></a><a class="code" href="class_c_d_audio.html#a17">00278</a> <font class="keyword">inline</font> audioerror_t getError(<font class="keywordtype">void</font>)<font class="keyword"></font> 00279 <font class="keyword"> </font>{<font class="keywordflow">return</font> err;}; 00280 <a name="l00281"></a><a class="code" href="class_c_d_audio.html#a18">00281</a> <font class="keyword">inline</font> <font class="keywordtype">bool</font> operator!(<font class="keywordtype">void</font>)<font class="keyword"></font> 00282 <font class="keyword"> </font>{<font class="keywordflow">return</font> !isOpen();}; 00283 }; 00284 <a name="l00291"></a><a class="code" href="class_audio_sample.html">00291</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT <a class="code" href="class_audio_sample.html">AudioSample</a> 00292 { 00293 <font class="keyword">protected</font>: <a name="l00294"></a><a class="code" href="class_audio_sample.html#l0">00294</a> <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="class_audio_copy.html">AudioCopy</a>; 00295 <a name="l00296"></a><a class="code" href="class_audio_sample.html#n0">00296</a> audioencoding_t encoding; <a name="l00297"></a><a class="code" href="class_audio_sample.html#n1">00297</a> <font class="keywordtype">unsigned</font> rate; <a name="l00298"></a><a class="code" href="class_audio_sample.html#n2">00298</a> <font class="keywordtype">unsigned</font> count; <a name="l00299"></a><a class="code" href="class_audio_sample.html#n3">00299</a> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *samples; 00300 00301 <font class="keyword">public</font>: 00302 AudioSample(<font class="keywordtype">unsigned</font> frame, audioencoding_t coding = PCM16_AUDIO_ENCODING, <font class="keywordtype">unsigned</font> rate = 8000); 00303 ~AudioSample(); 00304 <a name="l00305"></a><a class="code" href="class_audio_sample.html#a2">00305</a> <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> getCount(<font class="keywordtype">void</font>)<font class="keyword"></font> 00306 <font class="keyword"> </font>{<font class="keywordflow">return</font> count;}; 00307 <a name="l00308"></a><a class="code" href="class_audio_sample.html#a3">00308</a> <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> getRate(<font class="keywordtype">void</font>)<font class="keyword"></font> 00309 <font class="keyword"> </font>{<font class="keywordflow">return</font> rate;}; 00310 <a name="l00311"></a><a class="code" href="class_audio_sample.html#a4">00311</a> <font class="keyword">inline</font> audioencoding_t getEncoding(<font class="keywordtype">void</font>)<font class="keyword"></font> 00312 <font class="keyword"> </font>{<font class="keywordflow">return</font> encoding;}; 00313 <a name="l00314"></a><a class="code" href="class_audio_sample.html#a5">00314</a> <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *getSamples(<font class="keywordtype">void</font>)<font class="keyword"></font> 00315 <font class="keyword"> </font>{<font class="keywordflow">return</font> samples;}; 00316 }; 00317 <a name="l00330"></a><a class="code" href="class_audio_codec.html">00330</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT <a class="code" href="class_audio_codec.html">AudioCodec</a> : <font class="keyword">public</font> <a class="code" href="class_audio_sample.html">AudioSample</a> 00331 { 00332 <font class="keyword">protected</font>: 00333 AudioCodec(<font class="keywordtype">unsigned</font> frames, audioencoding_t encoding, <font class="keywordtype">unsigned</font> rate); <a name="l00334"></a><a class="code" href="class_audio_codec.html#n0">00334</a> <font class="keywordtype">unsigned</font> length; 00335 00336 <font class="keyword">public</font>: 00344 <font class="keyword">virtual</font> <font class="keywordtype">void</font> Encode(<font class="keywordtype">unsigned</font> <font class="keywordtype">short</font> *buffer, <font class="keywordtype">unsigned</font> samples = 0, <font class="keywordtype">int</font> channel = 0) = 0; 00345 00353 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> Encode(<a class="code" href="class_audio_sample.html">AudioSample</a> *sample) = 0; 00354 00362 <font class="keyword">virtual</font> <font class="keywordtype">unsigned</font> Decode(<font class="keywordtype">unsigned</font> <font class="keywordtype">short</font> *buffer, <font class="keywordtype">int</font> channel = 0) = 0; 00363 00370 <font class="keyword">virtual</font> <font class="keywordtype">bool</font> Decode(<a class="code" href="class_audio_sample.html">AudioSample</a> *sample) = 0; 00371 00381 <font class="keyword">virtual</font> <font class="keywordtype">unsigned</font> Load(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *data, <font class="keywordtype">unsigned</font> length); 00382 00392 <font class="keyword">virtual</font> <font class="keywordtype">unsigned</font> Save(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *data, <font class="keywordtype">unsigned</font> length); 00393 00394 <a name="l00400"></a><a class="code" href="class_audio_codec.html#a6">00400</a> <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> getLength(<font class="keywordtype">void</font>)<font class="keyword"></font> 00401 <font class="keyword"> </font>{<font class="keywordflow">return</font> length;}; 00402 00406 <font class="keywordtype">unsigned</font> getFrameSize(<font class="keywordtype">void</font>); 00407 00411 <font class="keyword">virtual</font> <font class="keywordtype">unsigned</font> getChannels(<font class="keywordtype">void</font>); 00412 }; 00413 <a name="l00423"></a><a class="code" href="class_audio_register_codec.html">00423</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT <a class="code" href="class_audio_register_codec.html">AudioRegisterCodec</a> 00424 { 00425 <font class="keyword">private</font>: 00426 <font class="keyword">static</font> <a class="code" href="class_audio_register_codec.html">AudioRegisterCodec</a> *first; 00427 <a class="code" href="class_audio_register_codec.html">AudioRegisterCodec</a> *next; 00428 00429 <font class="keyword">protected</font>: <a name="l00430"></a><a class="code" href="class_audio_register_codec.html#n0">00430</a> <font class="keywordtype">unsigned</font> minframe, framecnt; 00431 AudioRegisterCodec(<font class="keywordtype">unsigned</font> min, <font class="keywordtype">unsigned</font> def = 1); 00432 00433 <font class="keyword">public</font>: 00439 <font class="keyword">virtual</font> audioencoding_t getEncoding(<font class="keywordtype">void</font>) = 0; 00440 <a name="l00446"></a><a class="code" href="class_audio_register_codec.html#a1">00446</a> <font class="keyword">virtual</font> <font class="keywordtype">unsigned</font> getRate(<font class="keywordtype">void</font>)<font class="keyword"></font> 00447 <font class="keyword"> </font>{samplerate(getEncoding());}; 00448 00454 <font class="keyword">virtual</font> <font class="keywordtype">char</font> *getName(<font class="keywordtype">void</font>) = 0; 00455 00463 <font class="keyword">virtual</font> <a class="code" href="class_audio_codec.html">AudioCodec</a> *getCodec(<font class="keywordtype">unsigned</font> frames) = 0; 00464 00476 <font class="keyword">virtual</font> <a class="code" href="class_audio_sample.html">AudioSample</a> *getTone(<font class="keywordtype">unsigned</font> f1, <font class="keywordtype">unsigned</font> f2, <font class="keywordtype">unsigned</font> maxsize, <font class="keywordtype">unsigned</font> maxtone = 0) = 0; 00477 <a name="l00483"></a><a class="code" href="class_audio_register_codec.html#a5">00483</a> <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> getFrameSize(<font class="keywordtype">void</font>)<font class="keyword"></font> 00484 <font class="keyword"> </font>{<font class="keywordflow">return</font> minframe;}; 00485 <a name="l00492"></a><a class="code" href="class_audio_register_codec.html#a6">00492</a> <font class="keyword">inline</font> <font class="keywordtype">unsigned</font> getFrameCount(<font class="keywordtype">void</font>)<font class="keyword"></font> 00493 <font class="keyword"> </font>{<font class="keywordflow">return</font> framecnt;}; 00494 00501 <font class="keyword">friend</font> <a class="code" href="class_audio_register_codec.html">AudioRegisterCodec</a> *findCodec(audioencoding_t encoding, <font class="keywordtype">unsigned</font> rate = 0); 00502 00508 <font class="keyword">friend</font> <a class="code" href="class_audio_register_codec.html">AudioRegisterCodec</a> *findCodec(<font class="keyword">const</font> <font class="keywordtype">char</font> *name); 00509 00518 <font class="keyword">friend</font> <a class="code" href="class_audio_codec.html">AudioCodec</a> *getCodec(audioencoding_t encoding, <font class="keywordtype">unsigned</font> rate = 0, <font class="keywordtype">unsigned</font> frames = 0); 00519 00527 <font class="keyword">friend</font> <a class="code" href="class_audio_codec.html">AudioCodec</a> *getCodec(<font class="keyword">const</font> <font class="keywordtype">char</font> *name, <font class="keywordtype">unsigned</font> frame = 0); 00528 }; 00529 <a name="l00538"></a><a class="code" href="class_audio_tone.html">00538</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT <a class="code" href="class_audio_tone.html">AudioTone</a> : <font class="keyword">public</font> <a class="code" href="class_audio_sample.html">AudioSample</a> 00539 { 00540 <font class="keyword">protected</font>: <a name="l00541"></a><a class="code" href="class_audio_tone.html#n3">00541</a> <font class="keywordtype">double</font> p1, p2, v1, v2, fa1, fa2; 00542 00543 <font class="keyword">public</font>: 00544 AudioTone(<font class="keywordtype">unsigned</font> size, <font class="keywordtype">unsigned</font> f1 = 0, <font class="keywordtype">unsigned</font> f2 = 0, <font class="keywordtype">unsigned</font> rate = 8000); 00545 00549 <font class="keywordtype">void</font> Fill(<font class="keywordtype">unsigned</font> max = 0); 00550 00551 <font class="comment">/*</font> 00552 <font class="comment"> * Set frequency.</font> 00553 <font class="comment"> *</font> 00554 <font class="comment"> * @param f1 first frequency.</font> 00555 <font class="comment"> * @param f2 second frequency.</font> 00556 <font class="comment"> */</font> 00557 <font class="keywordtype">void</font> setFreq(<font class="keywordtype">unsigned</font> f1, <font class="keywordtype">unsigned</font> f2 = 0); 00558 }; 00559 <a name="l00570"></a><a class="code" href="class_audio_copy.html">00570</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT <a class="code" href="class_audio_copy.html">AudioCopy</a> : <font class="keyword">public</font> <a class="code" href="class_audio_sample.html">AudioSample</a> 00571 { 00572 <font class="keyword">protected</font>: <a name="l00573"></a><a class="code" href="class_audio_copy.html#n0">00573</a> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *next; <a name="l00574"></a><a class="code" href="class_audio_copy.html#n1">00574</a> <font class="keywordtype">unsigned</font> left; 00575 00576 <font class="keyword">virtual</font> <a class="code" href="class_audio_sample.html">AudioSample</a> *Fill(<font class="keywordtype">void</font>) = 0; 00577 00578 <font class="keyword">public</font>: 00579 AudioCopy(<font class="keywordtype">unsigned</font> frame, audioencoding_t encoding = PCM16_AUDIO_ENCODING, <font class="keywordtype">unsigned</font> rate = 8000); 00580 <font class="keywordtype">bool</font> Copy(<font class="keywordtype">void</font>); 00581 <a name="l00582"></a><a class="code" href="class_audio_copy.html#a2">00582</a> <font class="keyword">inline</font> <font class="keywordtype">bool</font> isEmpty(<font class="keywordtype">void</font>)<font class="keyword"></font> 00583 <font class="keyword"> </font>{<font class="keywordflow">return</font> next == NULL;}; 00584 }; 00585 00586 <font class="preprocessor">#ifdef CCXX_NAMESPACES</font> 00587 <font class="preprocessor"></font>}; 00588 <font class="preprocessor">#endif</font> 00589 <font class="preprocessor"></font> 00590 <font class="preprocessor">#endif</font> 00591 <font class="preprocessor"></font> </pre></div><hr><address><small>Generated at Wed Dec 5 07:19:57 2001 for ccAudio by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>