00001 /* 00002 00003 Sound card input server, header 00004 Copyright (C) 1999-2001 Jussi Laako 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 */ 00021 00022 00023 #include <limits.h> 00024 #include <signal.h> 00025 #include <pth.h> 00026 00027 #include <PthMutex.hh> 00028 #include <PthCond.hh> 00029 #include <dsp/DSPOp.hh> 00030 00031 #include "Messages.hh" 00032 #include "CfgFile.hh" 00033 #include "LogFile.hh" 00034 #include "Audio.hh" 00035 00036 00037 #ifndef SOUNDSRV_HH 00038 #define SOUNDSRV_HH 00039 00040 #define SS_PTH_MAJ ((PTH_VERSION&0xf00000)>>20) 00041 #define SS_PTH_MIN ((PTH_VERSION&0x0ff000)>>12) 00042 #define SS_PTH_PL (PTH_VERSION&0x0000ff) 00043 00044 00054 class clSoundSrv 00055 { 00056 int iAudioFrmt; 00057 int iAudioSr; 00058 int iAudioCh; 00059 int iAudioTypeSize; 00060 int iErrorCount; 00061 int iClientIdx; 00062 int ipClientH[SS_MAXCLIENTS]; 00063 int iSampleCount; 00064 int iOutBufSize; 00065 bool bRun; 00066 char cpProgName[_POSIX_PATH_MAX]; 00067 char *cpOutBuf; 00068 sigset_t sigsetQuit; 00069 pth_t tidInput; 00070 pth_t tidWaitConnect; 00071 pth_t ptidServeClient[SS_MAXCLIENTS]; 00072 clPthMutex MutexThis; 00073 clPthCond CondDataAvail; 00074 clSoundMsg SoundMsg; 00075 clDSPOp DSP; 00076 clCfgFile *CfgFile; 00077 clLogFile *LogFile; 00078 clAudio *Audio; 00079 int FindFreeClient(); 00080 int FindThisHandle(int); 00081 public: 00082 clSoundSrv (const char *, const char *); 00083 // (audio device) 00084 ~clSoundSrv (); 00085 void Exec (); 00086 void Quit (); 00087 void Quit (int); 00088 void InputExec (); 00089 void WaitConnectExec (); 00090 void ServeClientExec (void *); 00091 bool Run () { return bRun; } 00092 }; 00093 00094 #endif 00095
1.3.3