Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

ArrayBase.cc

Go to the documentation of this file.
00001 /*
00002 
00003     Base class for array operations
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 <stdio.h>
00024 #include <math.h>
00025 #include <float.h>
00026 
00027 #include "ArrayBase.hh"
00028 
00029 
00030 static const char *cpaShadingTypes[] = { "Rectangle", "Blackman",
00031     "Kaiser-Bessel" };
00032 
00033 
00034 void clArrayBase::SetSampleRate (int iSampleRate)
00035 {
00036     fSampleSpacing = (GDT) 1.0 / (GDT) iSampleRate;
00037     if (bDebug) printf("Sample spacing %g ms\n", fSampleSpacing * 1000.0);
00038 }
00039 
00040 
00041 void clArrayBase::SetSoundSpeed (GDT fSndSpeed)
00042 {
00043     fSoundSpeed = fSndSpeed;
00044     fSecsPerMeter = (GDT) 1.0 / fSndSpeed;
00045     if (bDebug) printf("Sound speed %g ms/m\n", fSecsPerMeter * 1000.0);
00046 }
00047 
00048 
00049 void clArrayBase::SetShading (GDT *fpCoeffs, int iShadeType, long lSensCount)
00050 {
00051     if (bDebug) printf("Generate %s shading coefficients for %li sensors\n",
00052         cpaShadingTypes[iShadeType], lSensCount);
00053     switch (iShadeType)
00054     {
00055         case AB_SHADE_RECTANGLE:
00056             DSP.Set(fpCoeffs, (GDT) 1.0, lSensCount);
00057             break;
00058         case AB_SHADE_BLACKMAN:
00059             DSP.WinExactBlackman(fpCoeffs, lSensCount);
00060             break;
00061         case AB_SHADE_KAISER_BESSEL:
00062             DSP.WinKaiserBessel(fpCoeffs, AB_KBWIN_ALPHA, lSensCount);
00063             break;
00064         default:
00065             DSP.Set(fpCoeffs, (GDT) 1.0, lSensCount);
00066     }
00067 }
00068 

Generated on Sun Oct 26 19:11:18 2003 for HASAS by doxygen 1.3.3