00001 /* 00002 00003 Server for beamformed audio 00004 Copyright (C) 2000-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 00025 #include <dsp/DSPOp.hh> 00026 00027 #include "Config.h" 00028 #include "LocalMsg.h" 00029 #include "CfgFile.hh" 00030 #include "FreqBeamDipole.hh" 00031 #include "FreqBeamLine.hh" 00032 #include "Messages.hh" 00033 #include "SockClie.hh" 00034 #include "SockOp.hh" 00035 00036 00037 #ifndef BEAMAUDIO_HH 00038 #define BEAMAUDIO_HH 00039 00040 00041 enum 00042 { 00043 BA_ARRAY_TYPE_DIPOLE = 0, 00044 BA_ARRAY_TYPE_TRIANGLE = 1, 00045 BA_ARRAY_TYPE_LINE = 2, 00046 BA_ARRAY_TYPE_PLANE = 3, 00047 BA_ARRAY_TYPE_CYLINDER = 4, 00048 BA_ARRAY_TYPE_SPHERE = 5 00049 }; 00050 00051 00055 class clBeamAudio 00056 { 00057 bool bRun; 00058 // Configuration parameters 00059 int iArrayType; 00060 int iShadingType; 00061 long lStartCh; 00062 long lWindowSize; 00063 long lSensorCount; 00064 GDT fSensorSpacing; 00065 char cpStreamSocket[_POSIX_PATH_MAX + 1]; 00066 //- 00067 GDT fAttenuation; 00068 stBeamAudioReq sRequest; 00069 stBeamAudioRes sResHdr; 00070 stRawDataFirst sRawHdr; 00071 clCfgFile CfgFile; 00072 clBeamAudioMsg Msg; 00073 clDSPOp DSP; 00074 clSockClie SClient; 00075 clSockOp SOpRaw; 00076 clSockOp SOpRequest; 00077 clSockOp SOpResult; 00078 clFreqBeamDipole FBeamDipole; 00079 clFreqBeamLine FBeamLine; 00080 bool GetCfg (); 00081 bool GetRq (); 00082 bool ConnectStream (); 00083 bool InitBeam (); 00084 bool SendFirst (); 00085 void SetDirection (); 00086 void ProcessLoop (); 00087 bool SendResult (GDT *, long); 00088 public: 00089 clBeamAudio (int, int); 00090 ~clBeamAudio (); 00091 int Main (); 00092 void Stop () { bRun = false; } 00093 }; 00094 00095 #endif 00096
1.3.3