Capsim Block Documentation
This routine produces the spectrogram of the input buffer.
iip_Curve_Pt curveTime_P; iip_Curve_Pt curve_P; int samples; int numberPoints; int i,j,ii; float tmp; complex val; float wind; char title1[80]; char fname[80]; char curveSubTitle[80]; float* mag_P; float* phase_P; FILE *time_F; FILE *freq_F; |
---|
/* store as state the number of input/output buffers */ if((numberInputBuffers = NO_INPUT_BUFFERS()) <= 0) { fprintf(stderr,"spectrogram: no inputs connected\n"); return(1); } if(numberInputBuffers > 1) { fprintf(stderr,"spectrogram: only one input allowed \n"); return(2); } if((numberOutputBuffers = NO_OUTPUT_BUFFERS()) > numberInputBuffers) { fprintf(stderr,"spectrogram: too many outputs connected\n"); return(3); } if(samplingRate) dx=1.0/samplingRate; else dx=1.0; if (control) { /* * allocate arrays */ xpts = (float* )calloc(BLOCK_SIZE,sizeof(float)); ypts = (float* )calloc(BLOCK_SIZE,sizeof(float)); if(xpts==NULL || ypts ==NULL) { fprintf(stderr,"Spectrogram could not allocate space\n"); return(4); } } count = 0; totalCount = 0; switch(bufferType) { case FLOAT_BUFFER: SET_CELL_SIZE_IN(0,sizeof(float)); if(numberOutputBuffers == 1) SET_CELL_SIZE_OUT(0,sizeof(float)); break; case INTEGER_BUFFER: SET_CELL_SIZE_IN(0,sizeof(int)); if(numberOutputBuffers == 1) SET_CELL_SIZE_OUT(0,sizeof(int)); break; default: fprintf(stderr,"Bad buffer type specified in spectrogram \n"); return(5); break; } |
---|
for(samples = MIN_AVAIL(); samples > 0; --samples) { for(i=0; i |
---|
if(control == 0) return(0); if((totalCount - skip) > 0 ) { /* * callup the plot routine */ if(iip_hdr_P ) { /* * if in graphic mode callup iip */ xpts = (float *) realloc((char *) xpts, sizeof(float) * (blockOff + bufi)); ypts = (float *) realloc((char *) ypts, sizeof(float) * (blockOff + bufi)); if(xpts == NULL || ypts==NULL) { fprintf(stderr,"spectrogram: could not allocate space\n"); return(6); } curveTime_P = IIP_NewInitedCurveRec(); curveTime_P->qpCurveFlag = TRUE; curveTime_P->x_P = xpts; curveTime_P->y_P = ypts; curveTime_P->points = count; curveTime_P->note_A = NULL; curveTime_P->funcType = PLT_GROUP_TIME_DOMAIN; sprintf(title1,"%s Time Domain %s",spectTitle,SNAME(0)); IIP_SetTitles(curveTime_P,title1,NULL); if(timeFlag) IIP_AppendCurve(curveTime_P); curve_P=IIP_Spectrogram(curveTime_P,windowLength,overlap, zeropad, samplingRate, windowType,threshold,surfaceFlag, imageFlag,dBFlag,0,NULL); if(curve_P) strcpy(curve_P->title,spectTitle); } } |
---|
/* Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks) Copyright (C) 1989-2002 XCAD Corporation This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA http://www.xcad.com XCAD Corporation Raleigh, North Carolina */ |
---|
/* spectrogram.s */ /********************************************************************** spectrogram() *********************************************************************** inputs: (One channel) outputs: (optional feed-through of input channels) ************************************************************************* This routine produces the spectrogram of the input buffer. Programmer: Sasan Ardalan Date: Dec. 4, 1993 */ |
---|