\doxysection{ad.\+h}
\label{ad_8h_source}\index{include/sphinxbase/ad.h@{include/sphinxbase/ad.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*\ -\/*-\/\ c-\/basic-\/offset:\ 4;\ indent-\/tabs-\/mode:\ nil\ -\/*-\/\ */}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*\ ====================================================================}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ Copyright\ (c)\ 1999-\/2004\ Carnegie\ Mellon\ University.\ \ All\ rights}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ reserved.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ Redistribution\ and\ use\ in\ source\ and\ binary\ forms,\ with\ or\ without}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ modification,\ are\ permitted\ provided\ that\ the\ following\ conditions}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ are\ met:}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ 1.\ Redistributions\ of\ source\ code\ must\ retain\ the\ above\ copyright}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer.\ }}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ 2.\ Redistributions\ in\ binary\ form\ must\ reproduce\ the\ above\ copyright}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer\ in}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ \ \ \ the\ documentation\ and/or\ other\ materials\ provided\ with\ the}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ \ \ \ distribution.}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ This\ work\ was\ supported\ in\ part\ by\ funding\ from\ the\ Defense\ Advanced\ }}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ Research\ Projects\ Agency\ and\ the\ National\ Science\ Foundation\ of\ the\ }}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ United\ States\ of\ America,\ and\ the\ CMU\ Sphinx\ Speech\ Consortium.}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *\ THIS\ SOFTWARE\ IS\ PROVIDED\ BY\ CARNEGIE\ MELLON\ UNIVERSITY\ \`{}\`{}AS\ IS''\ AND\ }}
\DoxyCodeLine{00023\ \textcolor{comment}{\ *\ ANY\ EXPRESSED\ OR\ IMPLIED\ WARRANTIES,\ INCLUDING,\ BUT\ NOT\ LIMITED\ TO,\ }}
\DoxyCodeLine{00024\ \textcolor{comment}{\ *\ THE\ IMPLIED\ WARRANTIES\ OF\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ A\ PARTICULAR}}
\DoxyCodeLine{00025\ \textcolor{comment}{\ *\ PURPOSE\ ARE\ DISCLAIMED.\ \ IN\ NO\ EVENT\ SHALL\ CARNEGIE\ MELLON\ UNIVERSITY}}
\DoxyCodeLine{00026\ \textcolor{comment}{\ *\ NOR\ ITS\ EMPLOYEES\ BE\ LIABLE\ FOR\ ANY\ DIRECT,\ INDIRECT,\ INCIDENTAL,}}
\DoxyCodeLine{00027\ \textcolor{comment}{\ *\ SPECIAL,\ EXEMPLARY,\ OR\ CONSEQUENTIAL\ DAMAGES\ (INCLUDING,\ BUT\ NOT\ }}
\DoxyCodeLine{00028\ \textcolor{comment}{\ *\ LIMITED\ TO,\ PROCUREMENT\ OF\ SUBSTITUTE\ GOODS\ OR\ SERVICES;\ LOSS\ OF\ USE,\ }}
\DoxyCodeLine{00029\ \textcolor{comment}{\ *\ DATA,\ OR\ PROFITS;\ OR\ BUSINESS\ INTERRUPTION)\ HOWEVER\ CAUSED\ AND\ ON\ ANY\ }}
\DoxyCodeLine{00030\ \textcolor{comment}{\ *\ THEORY\ OF\ LIABILITY,\ WHETHER\ IN\ CONTRACT,\ STRICT\ LIABILITY,\ OR\ TORT\ }}
\DoxyCodeLine{00031\ \textcolor{comment}{\ *\ (INCLUDING\ NEGLIGENCE\ OR\ OTHERWISE)\ ARISING\ IN\ ANY\ WAY\ OUT\ OF\ THE\ USE\ }}
\DoxyCodeLine{00032\ \textcolor{comment}{\ *\ OF\ THIS\ SOFTWARE,\ EVEN\ IF\ ADVISED\ OF\ THE\ POSSIBILITY\ OF\ SUCH\ DAMAGE.}}
\DoxyCodeLine{00033\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00034\ \textcolor{comment}{\ *\ ====================================================================}}
\DoxyCodeLine{00035\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00036\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00037\ \textcolor{comment}{/*}}
\DoxyCodeLine{00038\ \textcolor{comment}{\ *\ ad.h\ -\/-\/\ generic\ live\ audio\ interface\ for\ recording\ and\ playback}}
\DoxyCodeLine{00039\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00040\ \textcolor{comment}{\ *\ **********************************************}}
\DoxyCodeLine{00041\ \textcolor{comment}{\ *\ CMU\ ARPA\ Speech\ Project}}
\DoxyCodeLine{00042\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00043\ \textcolor{comment}{\ *\ Copyright\ (c)\ 1996\ Carnegie\ Mellon\ University.}}
\DoxyCodeLine{00044\ \textcolor{comment}{\ *\ ALL\ RIGHTS\ RESERVED.}}
\DoxyCodeLine{00045\ \textcolor{comment}{\ *\ **********************************************}}
\DoxyCodeLine{00046\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00047\ \textcolor{comment}{\ *\ HISTORY}}
\DoxyCodeLine{00048\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00049\ \textcolor{comment}{\ *\ \$Log:\ ad.h,v\ \$}}
\DoxyCodeLine{00050\ \textcolor{comment}{\ *\ Revision\ 1.8\ \ 2005/06/22\ 08:00:06\ \ arthchan2003}}
\DoxyCodeLine{00051\ \textcolor{comment}{\ *\ Completed\ all\ doxygen\ documentation\ on\ file\ description\ for\ libs3decoder/libutil/libs3audio\ and\ programs.}}
\DoxyCodeLine{00052\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00053\ \textcolor{comment}{\ *\ Revision\ 1.7\ \ 2004/12/14\ 00:39:49\ \ arthchan2003}}
\DoxyCodeLine{00054\ \textcolor{comment}{\ *\ add\ <s3types.h>\ to\ the\ code,\ change\ some\ comments\ to\ doxygen\ style}}
\DoxyCodeLine{00055\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00056\ \textcolor{comment}{\ *\ Revision\ 1.6\ \ 2004/12/06\ 11:17:55\ \ arthchan2003}}
\DoxyCodeLine{00057\ \textcolor{comment}{\ *\ Update\ the\ copyright\ information\ of\ ad.h,\ *sigh*\ start\ to\ feel\ tired\ of\ updating\ documentation\ system.\ \ Anyone\ who\ has\ time,\ please\ take\ up\ libs3audio.\ That\ is\ the\ last\ place\ which\ is\ undocumented}}
\DoxyCodeLine{00058\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00059\ \textcolor{comment}{\ *\ Revision\ 1.5\ \ 2004/07/23\ 23:44:46\ \ egouvea}}
\DoxyCodeLine{00060\ \textcolor{comment}{\ *\ Changed\ the\ cygwin\ code\ to\ use\ the\ same\ audio\ files\ as\ the\ MS\ Visual\ code,\ removed\ unused\ variables\ from\ fe\_interface.c}}
\DoxyCodeLine{00061\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00062\ \textcolor{comment}{\ *\ Revision\ 1.4\ \ 2004/02/29\ 23:48:31\ \ egouvea}}
\DoxyCodeLine{00063\ \textcolor{comment}{\ *\ Updated\ configure.in\ to\ the\ recent\ automake/autoconf,\ fixed\ win32}}
\DoxyCodeLine{00064\ \textcolor{comment}{\ *\ references\ in\ audio\ files.}}
\DoxyCodeLine{00065\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00066\ \textcolor{comment}{\ *\ Revision\ 1.3\ \ 2002/11/10\ 19:27:38\ \ egouvea}}
\DoxyCodeLine{00067\ \textcolor{comment}{\ *\ Fixed\ references\ to\ sun's\ implementation\ of\ audio\ interface,}}
\DoxyCodeLine{00068\ \textcolor{comment}{\ *\ referring\ to\ the\ correct\ .h\ file,\ and\ replacing\ sun4\ with\ sunos.}}
\DoxyCodeLine{00069\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00070\ \textcolor{comment}{\ *\ Revision\ 1.2\ \ 2001/12/11\ 04:40:55\ \ lenzo}}
\DoxyCodeLine{00071\ \textcolor{comment}{\ *\ License\ cleanup.}}
\DoxyCodeLine{00072\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00073\ \textcolor{comment}{\ *\ Revision\ 1.1.1.1\ \ 2001/12/03\ 16:01:45\ \ egouvea}}
\DoxyCodeLine{00074\ \textcolor{comment}{\ *\ Initial\ import\ of\ sphinx3}}
\DoxyCodeLine{00075\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00076\ \textcolor{comment}{\ *\ Revision\ 1.1.1.1\ \ 2001/01/17\ 05:17:14\ \ ricky}}
\DoxyCodeLine{00077\ \textcolor{comment}{\ *\ Initial\ Import\ of\ the\ s3.3\ decoder,\ has\ working\ decodeaudiofile,\ s3.3\_live}}
\DoxyCodeLine{00078\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00079\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00080\ \textcolor{comment}{\ *\ 19-\/Jan-\/1999\ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00081\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ AD\_\ return\ codes.\ \ Added\ ad\_open\_sps\_bufsize(),\ and}}
\DoxyCodeLine{00082\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ ad\_rec\_t.n\_buf.}}
\DoxyCodeLine{00083\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00084\ \textcolor{comment}{\ *\ 17-\/Apr-\/98\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00085\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ ad\_open\_play\_sps().}}
\DoxyCodeLine{00086\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00087\ \textcolor{comment}{\ *\ 07-\/Mar-\/98\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00088\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ ad\_open\_sps().}}
\DoxyCodeLine{00089\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00090\ \textcolor{comment}{\ *\ 10-\/Jun-\/96\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00091\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ ad\_wbuf\_t,\ ad\_rec\_t,\ and\ ad\_play\_t\ types,\ and\ augmented\ all}}
\DoxyCodeLine{00092\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ recording\ functions\ with\ ad\_rec\_t,\ and\ playback\ functions\ with}}
\DoxyCodeLine{00093\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ ad\_play\_t.}}
\DoxyCodeLine{00094\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00095\ \textcolor{comment}{\ *\ 06-\/Jun-\/96\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00096\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Created.}}
\DoxyCodeLine{00097\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00098\ }
\DoxyCodeLine{00103\ \textcolor{preprocessor}{\#ifndef\ \_AD\_H\_}}
\DoxyCodeLine{00104\ \textcolor{preprocessor}{\#define\ \_AD\_H\_}}
\DoxyCodeLine{00105\ }
\DoxyCodeLine{00106\ \textcolor{preprocessor}{\#include\ <sphinx\_config.h>}}
\DoxyCodeLine{00107\ }
\DoxyCodeLine{00108\ \textcolor{preprocessor}{\#if\ defined\ (\_\_CYGWIN\_\_)}}
\DoxyCodeLine{00109\ \textcolor{preprocessor}{\#include\ <w32api/windows.h>}}
\DoxyCodeLine{00110\ \textcolor{preprocessor}{\#include\ <w32api/mmsystem.h>}}
\DoxyCodeLine{00111\ \textcolor{preprocessor}{\#elif\ (defined(WIN32)\ \&\&\ !defined(GNUWINCE))\ ||\ defined(\_WIN32\_WCE)}}
\DoxyCodeLine{00112\ \textcolor{preprocessor}{\#include\ <windows.h>}}
\DoxyCodeLine{00113\ \textcolor{preprocessor}{\#include\ <mmsystem.h>}}
\DoxyCodeLine{00114\ \textcolor{preprocessor}{\#elif\ defined(AD\_BACKEND\_JACK)}}
\DoxyCodeLine{00115\ \textcolor{preprocessor}{\#include\ <jack/jack.h>}}
\DoxyCodeLine{00116\ \textcolor{preprocessor}{\#include\ <jack/ringbuffer.h>}}
\DoxyCodeLine{00117\ \textcolor{preprocessor}{\#ifdef\ HAVE\_SAMPLERATE\_H}}
\DoxyCodeLine{00118\ \textcolor{preprocessor}{\#include\ <samplerate.h>}}
\DoxyCodeLine{00119\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00120\ \textcolor{preprocessor}{\#elif\ defined(AD\_BACKEND\_PULSEAUDIO)}}
\DoxyCodeLine{00121\ \textcolor{preprocessor}{\#include\ <pulse/pulseaudio.h>}}
\DoxyCodeLine{00122\ \textcolor{preprocessor}{\#include\ <pulse/simple.h>}}
\DoxyCodeLine{00123\ \textcolor{preprocessor}{\#elif\ defined(AD\_BACKEND\_ALSA)}}
\DoxyCodeLine{00124\ \textcolor{preprocessor}{\#include\ <alsa/asoundlib.h>}}
\DoxyCodeLine{00125\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00126\ }
\DoxyCodeLine{00127\ \textcolor{comment}{/*\ Win32/WinCE\ DLL\ gunk\ */}}
\DoxyCodeLine{00128\ \textcolor{preprocessor}{\#include\ <sphinxbase/sphinxbase\_export.h>}}
\DoxyCodeLine{00129\ }
\DoxyCodeLine{00130\ \textcolor{preprocessor}{\#include\ <sphinxbase/prim\_type.h>}}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ \textcolor{preprocessor}{\#ifdef\ \_\_cplusplus}}
\DoxyCodeLine{00133\ \textcolor{keyword}{extern}\ \textcolor{stringliteral}{"{}C"{}}\ \{}
\DoxyCodeLine{00134\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00135\ \textcolor{preprocessor}{\#if\ 0}}
\DoxyCodeLine{00136\ \textcolor{comment}{/*\ Fool\ Emacs.\ */}}
\DoxyCodeLine{00137\ \}}
\DoxyCodeLine{00138\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00140\ \textcolor{preprocessor}{\#define\ AD\_SAMPLE\_SIZE\ \ \ \ \ \ \ \ \ \ (sizeof(int16))}}
\DoxyCodeLine{00141\ \textcolor{preprocessor}{\#define\ DEFAULT\_SAMPLES\_PER\_SEC\ 16000}}
\DoxyCodeLine{00142\ }
\DoxyCodeLine{00143\ \textcolor{comment}{/*\ Return\ codes\ */}}
\DoxyCodeLine{00144\ \textcolor{preprocessor}{\#define\ AD\_OK\ \ \ \ \ \ \ \ \ \ \ 0}}
\DoxyCodeLine{00145\ \textcolor{preprocessor}{\#define\ AD\_EOF\ \ \ \ \ \ \ \ \ \ -\/1}}
\DoxyCodeLine{00146\ \textcolor{preprocessor}{\#define\ AD\_ERR\_GEN\ \ \ \ \ \ -\/1}}
\DoxyCodeLine{00147\ \textcolor{preprocessor}{\#define\ AD\_ERR\_NOT\_OPEN\ -\/2}}
\DoxyCodeLine{00148\ \textcolor{preprocessor}{\#define\ AD\_ERR\_WAVE\ \ \ \ \ -\/3}}
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00150\ }
\DoxyCodeLine{00151\ \textcolor{preprocessor}{\#if\ \ (defined(WIN32)\ ||\ defined(AD\_BACKEND\_WIN32))\ \&\&\ !defined(GNUWINCE)}}
\DoxyCodeLine{00152\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00153\ \ \ \ \ HGLOBAL\ h\_whdr;}
\DoxyCodeLine{00154\ \ \ \ \ LPWAVEHDR\ p\_whdr;}
\DoxyCodeLine{00155\ \ \ \ \ HGLOBAL\ h\_buf;}
\DoxyCodeLine{00156\ \ \ \ \ LPSTR\ p\_buf;}
\DoxyCodeLine{00157\ \}\ ad\_wbuf\_t;}
\DoxyCodeLine{00158\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00159\ }
\DoxyCodeLine{00160\ }
\DoxyCodeLine{00161\ \textcolor{comment}{/*\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ RECORDING\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ */}}
\DoxyCodeLine{00162\ }
\DoxyCodeLine{00163\ \textcolor{comment}{/*}}
\DoxyCodeLine{00164\ \textcolor{comment}{\ *\ NOTE:\ ad\_rec\_t\ and\ ad\_play\_t\ are\ READ-\/ONLY\ structures\ for\ the\ user.}}
\DoxyCodeLine{00165\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00166\ }
\DoxyCodeLine{00167\ \textcolor{preprocessor}{\#if\ (defined(WIN32)\ ||\ defined(AD\_BACKEND\_WIN32))\ \&\&\ !defined(GNUWINCE)}}
\DoxyCodeLine{00168\ }
\DoxyCodeLine{00169\ \textcolor{preprocessor}{\#define\ DEFAULT\_DEVICE\ (char*)DEV\_MAPPER}}
\DoxyCodeLine{00170\ }
\DoxyCodeLine{00174\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }ad\_rec\_s\ \{}
\DoxyCodeLine{00175\ \ \ \ \ HWAVEIN\ h\_wavein;\ \ \ \textcolor{comment}{/*\ "{}HANDLE"{}\ to\ the\ audio\ input\ device\ */}}
\DoxyCodeLine{00176\ \ \ \ \ ad\_wbuf\_t\ *wi\_buf;\ \ \textcolor{comment}{/*\ Recording\ buffers\ provided\ to\ system\ */}}
\DoxyCodeLine{00177\ \ \ \ \ int32\ n\_buf;\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ \#Recording\ buffers\ provided\ to\ system\ */}}
\DoxyCodeLine{00178\ \ \ \ \ int32\ opened;\ \ \ \ \ \ \ \textcolor{comment}{/*\ Flag;\ A/D\ opened\ for\ recording\ */}}
\DoxyCodeLine{00179\ \ \ \ \ int32\ recording;}
\DoxyCodeLine{00180\ \ \ \ \ int32\ curbuf;\ \ \ \ \ \ \ \textcolor{comment}{/*\ Current\ buffer\ with\ data\ for\ application\ */}}
\DoxyCodeLine{00181\ \ \ \ \ int32\ curoff;\ \ \ \ \ \ \ \textcolor{comment}{/*\ Start\ of\ data\ for\ application\ in\ curbuf\ */}}
\DoxyCodeLine{00182\ \ \ \ \ int32\ curlen;\ \ \ \ \ \ \ \textcolor{comment}{/*\ \#samples\ of\ data\ from\ curoff\ in\ curbuf\ */}}
\DoxyCodeLine{00183\ \ \ \ \ int32\ lastbuf;\ \ \ \ \ \ \textcolor{comment}{/*\ Last\ buffer\ containing\ data\ after\ recording\ stopped\ */}}
\DoxyCodeLine{00184\ \ \ \ \ int32\ sps;\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Samples/sec\ */}}
\DoxyCodeLine{00185\ \ \ \ \ int32\ bps;\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Bytes/sample\ */}}
\DoxyCodeLine{00186\ \}\ ad\_rec\_t;}
\DoxyCodeLine{00187\ }
\DoxyCodeLine{00188\ \textcolor{preprocessor}{\#elif\ defined(AD\_BACKEND\_OSS)}}
\DoxyCodeLine{00189\ }
\DoxyCodeLine{00190\ \textcolor{preprocessor}{\#define\ DEFAULT\_DEVICE\ "{}/dev/dsp"{}}}
\DoxyCodeLine{00191\ }
\DoxyCodeLine{00195\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00196\ \ \ \ \ int32\ dspFD;\ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Audio\ device\ descriptor\ */}}
\DoxyCodeLine{00197\ \ \ \ \ int32\ recording;}
\DoxyCodeLine{00198\ \ \ \ \ int32\ sps;\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Samples/sec\ */}}
\DoxyCodeLine{00199\ \ \ \ \ int32\ bps;\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Bytes/sample\ */}}
\DoxyCodeLine{00200\ \}\ ad\_rec\_t;}
\DoxyCodeLine{00201\ }
\DoxyCodeLine{00202\ \textcolor{preprocessor}{\#elif\ defined(AD\_BACKEND\_PULSEAUDIO)}}
\DoxyCodeLine{00203\ }
\DoxyCodeLine{00204\ \textcolor{preprocessor}{\#define\ DEFAULT\_DEVICE\ NULL}}
\DoxyCodeLine{00205\ }
\DoxyCodeLine{00206\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00207\ \ \ \ \ pa\_simple*\ pa;}
\DoxyCodeLine{00208\ \ \ \ \ int32\ recording;}
\DoxyCodeLine{00209\ \ \ \ \ int32\ sps;}
\DoxyCodeLine{00210\ \ \ \ \ int32\ bps;}
\DoxyCodeLine{00211\ \}\ ad\_rec\_t;}
\DoxyCodeLine{00212\ }
\DoxyCodeLine{00213\ \textcolor{preprocessor}{\#elif\ defined(AD\_BACKEND\_ALSA)}}
\DoxyCodeLine{00214\ }
\DoxyCodeLine{00215\ \textcolor{preprocessor}{\#define\ DEFAULT\_DEVICE\ "{}default"{}}}
\DoxyCodeLine{00216\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00217\ \ \ \ \ snd\_pcm\_t\ *dspH;}
\DoxyCodeLine{00218\ \ \ \ \ int32\ recording;}
\DoxyCodeLine{00219\ \ \ \ \ int32\ sps;}
\DoxyCodeLine{00220\ \ \ \ \ int32\ bps;}
\DoxyCodeLine{00221\ \}\ ad\_rec\_t;}
\DoxyCodeLine{00222\ }
\DoxyCodeLine{00223\ \textcolor{preprocessor}{\#elif\ defined(AD\_BACKEND\_JACK)}}
\DoxyCodeLine{00224\ }
\DoxyCodeLine{00225\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00226\ \ \ \ \ jack\_client\_t\ *client;}
\DoxyCodeLine{00227\ \ \ \ \ jack\_port\_t\ *input\_port;}
\DoxyCodeLine{00228\ \ \ \ \ jack\_port\_t\ *output\_port;}
\DoxyCodeLine{00229\ \ \ \ \ jack\_ringbuffer\_t*\ rbuffer;}
\DoxyCodeLine{00230\ \ \ \ \ jack\_default\_audio\_sample\_t*\ sample\_buffer;\ \ \ \ }
\DoxyCodeLine{00231\ \ \ \ \ int32\ recording;}
\DoxyCodeLine{00232\ \ \ \ \ int32\ sps;}
\DoxyCodeLine{00233\ \ \ \ \ int32\ bps;}
\DoxyCodeLine{00234\ \textcolor{preprocessor}{\#ifdef\ HAVE\_SAMPLERATE\_H}}
\DoxyCodeLine{00235\ \ \ \ \ SRC\_STATE\ *resample\_state;}
\DoxyCodeLine{00236\ \ \ \ \ jack\_default\_audio\_sample\_t\ *resample\_buffer;}
\DoxyCodeLine{00237\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00238\ \}\ ad\_rec\_t;}
\DoxyCodeLine{00239\ }
\DoxyCodeLine{00240\ \textcolor{preprocessor}{\#elif\ defined(AD\_BACKEND\_S60)}}
\DoxyCodeLine{00241\ }
\DoxyCodeLine{00242\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }ad\_rec\_s\ \{}
\DoxyCodeLine{00243\ \ \ \ \ \textcolor{keywordtype}{void}*\ recorder;}
\DoxyCodeLine{00244\ \ \ \ \ int32\ recording;}
\DoxyCodeLine{00245\ \ \ \ \ int32\ sps;}
\DoxyCodeLine{00246\ \ \ \ \ int32\ bps;}
\DoxyCodeLine{00247\ \}\ ad\_rec\_t;}
\DoxyCodeLine{00248\ }
\DoxyCodeLine{00249\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00250\ ad\_rec\_t\ *ad\_open\_sps\_bufsize\ (int32\ samples\_per\_sec,\ int32\ bufsize\_msec);}
\DoxyCodeLine{00251\ }
\DoxyCodeLine{00252\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00253\ }
\DoxyCodeLine{00254\ \textcolor{preprocessor}{\#define\ DEFAULT\_DEVICE\ NULL}}
\DoxyCodeLine{00255\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00256\ \ \ \ \ int32\ sps;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00257\ \ \ \ \ int32\ bps;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00258\ \}\ ad\_rec\_t;\ \ \ \ \ }
\DoxyCodeLine{00259\ }
\DoxyCodeLine{00260\ }
\DoxyCodeLine{00261\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00262\ }
\DoxyCodeLine{00263\ }
\DoxyCodeLine{00273\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00274\ ad\_rec\_t\ *ad\_open\_dev\ (}
\DoxyCodeLine{00275\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *dev,\ }
\DoxyCodeLine{00276\ \ \ \ \ \ \ \ \ int32\ samples\_per\_sec\ }
\DoxyCodeLine{00277\ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00278\ }
\DoxyCodeLine{00282\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00283\ ad\_rec\_t\ *ad\_open\_sps\ (}
\DoxyCodeLine{00284\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ samples\_per\_sec\ }
\DoxyCodeLine{00285\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00286\ }
\DoxyCodeLine{00287\ }
\DoxyCodeLine{00291\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00292\ ad\_rec\_t\ *ad\_open\ (\ \textcolor{keywordtype}{void}\ );}
\DoxyCodeLine{00293\ }
\DoxyCodeLine{00294\ }
\DoxyCodeLine{00295\ \textcolor{preprocessor}{\#if\ defined(WIN32)\ \&\&\ !defined(GNUWINCE)}}
\DoxyCodeLine{00296\ \textcolor{comment}{/*}}
\DoxyCodeLine{00297\ \textcolor{comment}{\ *\ Like\ ad\_open\_sps\ but\ specifies\ buffering\ required\ within\ driver.\ \ This\ function\ is}}
\DoxyCodeLine{00298\ \textcolor{comment}{\ *\ useful\ if\ the\ default\ (5000\ msec\ worth)\ is\ too\ small\ and\ results\ in\ loss\ of\ data.}}
\DoxyCodeLine{00299\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00300\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00301\ ad\_rec\_t\ *ad\_open\_sps\_bufsize\ (int32\ samples\_per\_sec,\ int32\ bufsize\_msec);}
\DoxyCodeLine{00302\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00303\ }
\DoxyCodeLine{00304\ }
\DoxyCodeLine{00305\ \textcolor{comment}{/*\ Start\ audio\ recording.\ \ Return\ value:\ 0\ if\ successful,\ <0\ otherwise\ */}}
\DoxyCodeLine{00306\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00307\ int32\ ad\_start\_rec\ (ad\_rec\_t\ *);}
\DoxyCodeLine{00308\ }
\DoxyCodeLine{00309\ }
\DoxyCodeLine{00310\ \textcolor{comment}{/*\ Stop\ audio\ recording.\ \ Return\ value:\ 0\ if\ successful,\ <0\ otherwise\ */}}
\DoxyCodeLine{00311\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00312\ int32\ ad\_stop\_rec\ (ad\_rec\_t\ *);}
\DoxyCodeLine{00313\ }
\DoxyCodeLine{00314\ }
\DoxyCodeLine{00315\ \textcolor{comment}{/*\ Close\ the\ recording\ device.\ \ Return\ value:\ 0\ if\ successful,\ <0\ otherwise\ */}}
\DoxyCodeLine{00316\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00317\ int32\ ad\_close\ (ad\_rec\_t\ *);}
\DoxyCodeLine{00318\ }
\DoxyCodeLine{00319\ }
\DoxyCodeLine{00320\ \textcolor{comment}{/*}}
\DoxyCodeLine{00321\ \textcolor{comment}{\ *\ Read\ next\ block\ of\ audio\ samples\ while\ recording;\ read\ upto\ max\ samples\ into\ buf.}}
\DoxyCodeLine{00322\ \textcolor{comment}{\ *\ Return\ value:\ \#\ samples\ actually\ read\ (could\ be\ 0\ since\ non-\/blocking);\ -\/1\ if\ not}}
\DoxyCodeLine{00323\ \textcolor{comment}{\ *\ recording\ and\ no\ more\ samples\ remaining\ to\ be\ read\ from\ most\ recent\ recording.}}
\DoxyCodeLine{00324\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00325\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00326\ int32\ ad\_read\ (ad\_rec\_t\ *,\ int16\ *buf,\ int32\ max);}
\DoxyCodeLine{00327\ }
\DoxyCodeLine{00328\ }
\DoxyCodeLine{00329\ \textcolor{comment}{/*\ -\/-\/-\/-\/-\/-\/\ PLAYBACK;\ SIMILAR\ TO\ RECORDING\ -\/-\/-\/-\/-\/-\/-\/\ */}}
\DoxyCodeLine{00330\ }
\DoxyCodeLine{00331\ \textcolor{preprocessor}{\#if\ defined(WIN32)\ \&\&\ !defined(GNUWINCE)}}
\DoxyCodeLine{00332\ }
\DoxyCodeLine{00333\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00334\ \ \ \ \ HWAVEOUT\ h\_waveout;\ \textcolor{comment}{/*\ "{}HANDLE"{}\ to\ the\ audio\ output\ device\ */}}
\DoxyCodeLine{00335\ \ \ \ \ ad\_wbuf\_t\ *wo\_buf;\ \ \textcolor{comment}{/*\ Playback\ buffers\ given\ to\ the\ system\ */}}
\DoxyCodeLine{00336\ \ \ \ \ int32\ opened;\ \ \ \ \ \ \ \textcolor{comment}{/*\ Flag;\ A/D\ opened\ for\ playback\ */}}
\DoxyCodeLine{00337\ \ \ \ \ int32\ playing;}
\DoxyCodeLine{00338\ \ \ \ \ \textcolor{keywordtype}{char}\ *busy;\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ flags\ [N\_WO\_BUF]\ indicating\ whether\ given\ to\ system\ */}}
\DoxyCodeLine{00339\ \ \ \ \ int32\ nxtbuf;\ \ \ \ \ \ \ \textcolor{comment}{/*\ Next\ buffer\ [0..N\_WO\_BUF-\/1]\ to\ be\ used\ for\ playback\ data\ */}}
\DoxyCodeLine{00340\ \ \ \ \ int32\ sps;\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Samples/sec\ */}}
\DoxyCodeLine{00341\ \ \ \ \ int32\ bps;\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Bytes/sample\ */}}
\DoxyCodeLine{00342\ \}\ ad\_play\_t;}
\DoxyCodeLine{00343\ }
\DoxyCodeLine{00344\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00345\ }
\DoxyCodeLine{00346\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00347\ \ \ \ \ int32\ sps;\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Samples/sec\ */}}
\DoxyCodeLine{00348\ \ \ \ \ int32\ bps;\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Bytes/sample\ */}}
\DoxyCodeLine{00349\ \}\ ad\_play\_t;\ \ \ \textcolor{comment}{/*\ Dummy\ definition\ for\ systems\ without\ A/D\ stuff\ */}}
\DoxyCodeLine{00350\ }
\DoxyCodeLine{00351\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00352\ }
\DoxyCodeLine{00353\ }
\DoxyCodeLine{00354\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00355\ ad\_play\_t\ *ad\_open\_play\_sps\ (int32\ samples\_per\_sec);}
\DoxyCodeLine{00356\ }
\DoxyCodeLine{00357\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00358\ ad\_play\_t\ *ad\_open\_play\ (\ \textcolor{keywordtype}{void}\ );}
\DoxyCodeLine{00359\ }
\DoxyCodeLine{00360\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00361\ int32\ ad\_start\_play\ (ad\_play\_t\ *);}
\DoxyCodeLine{00362\ }
\DoxyCodeLine{00363\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00364\ int32\ ad\_stop\_play\ (ad\_play\_t\ *);}
\DoxyCodeLine{00365\ }
\DoxyCodeLine{00366\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00367\ int32\ ad\_close\_play\ (ad\_play\_t\ *);}
\DoxyCodeLine{00368\ }
\DoxyCodeLine{00369\ }
\DoxyCodeLine{00378\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00379\ int32\ ad\_write\ (ad\_play\_t\ *,\ int16\ *buf,\ int32\ len);}
\DoxyCodeLine{00380\ }
\DoxyCodeLine{00381\ }
\DoxyCodeLine{00382\ \textcolor{comment}{/*\ -\/-\/-\/-\/-\/-\/\ MISCELLANEOUS\ -\/-\/-\/-\/-\/-\/-\/\ */}}
\DoxyCodeLine{00383\ }
\DoxyCodeLine{00387\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00388\ \textcolor{keywordtype}{void}\ ad\_mu2li\ (int16\ *outbuf,\ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ Out:\ PCM\ data\ placed\ here\ (allocated\ by\ user)\ */}}
\DoxyCodeLine{00389\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ *inbuf,\ \ \ \ \textcolor{comment}{/*\ In:\ Input\ buffer\ with\ mulaw\ data\ */}}
\DoxyCodeLine{00390\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ n\_samp);\ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ In:\ \#Samples\ in\ inbuf\ */}}
\DoxyCodeLine{00391\ }
\DoxyCodeLine{00392\ \textcolor{preprocessor}{\#ifdef\ \_\_cplusplus}}
\DoxyCodeLine{00393\ \}}
\DoxyCodeLine{00394\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00395\ }
\DoxyCodeLine{00396\ }
\DoxyCodeLine{00397\ \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
