/* OpenWaveFile: open source wave file and extract portion if indicated */ HTime OpenWaveFile(char *src) { Wave w, cw; long nSamps; short *data; if((w = OpenWaveInput(&iStack,src,srcFF,0,0,&srcSampRate))==NULL) HError(1013,"OpenWaveFile: OpenWaveInput failed"); srcPK = WAVEFORM; tgtSampRate = srcSampRate; cw = (chopF)?ChopWave(w,st,en,srcSampRate) : w; data = GetWaveDirect(cw,&nSamps); wv = OpenWaveOutput(&oStack, &srcSampRate, nSamps); PutWaveSample(wv,nSamps,data); CloseWaveInput(cw); return(nSamps*srcSampRate); }
HTime period; int sampSize; int numComps; long nSamples; }HeadInfo; /* PrBar: print a horizantal bar of length n including title */ void PrBar(char *title) { int i,len,n; if (rawOut) return; len = strlen(title); n = (barwidth - len)/2; for (i=1; i<n; i++) putchar(barc); printf(" %s ",title); n = barwidth - n - len; for (i=1; i<n; i++) putchar(barc); putchar('\n'); } /* SetBarWidth: set bar width according to nItems and item type */ void SetBarWidth(int itemWidth)
/* AppendWave: append the src file to global wave wv */ HTime AppendWave(char *src) { Wave w, cw; HTime period=0.0; long nSamps; short *data; if((w = OpenWaveInput(&iStack,src, srcFF, 0, 0, &period))==NULL) HError(1013,"AppendWave: OpenWaveInput failed"); if(trace & T_KINDS ) printf("Appending file %s format: %s [WAVEFORM]\n",src, Format2Str(WaveFormat(w))); if(period != srcSampRate) HError(1032,"AppendWave: Input file %s has inconsistent sampling rate",src); cw = (chopF)? ChopWave(w,st,en,srcSampRate) : w; data = GetWaveDirect(cw,&nSamps); PutWaveSample(wv,nSamps,data); CloseWaveInput(cw); return(nSamps*period); }