Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

gapesignaldisplay.cpp

00001 //gapesignaldisplay.cpp
00002 //Dave Chisholm dkc@ccrma.stanford.edu
00003 //11/24/00
00004 
00005 #include "gapesignaldisplay.h"
00006 #include "gapecoswindow.h"
00007 #include "gapepowerspectrum.h"
00008 #include "gapeaccumulator.h"
00009 #include "gapeaudioplot.h"
00010 
00011 GapeTimeDomainDisplay::GapeTimeDomainDisplay(QWidget* parent)
00012 :GapeSignalDisplay(new GapeTimeDomainPlot(parent)) {
00013     GapeTimeDomainPlot* plot = (GapeTimeDomainPlot*) (getControllers()[0]);
00014     accumulator = new GapeAccumulator(AUDIOPLOT_DEFAULT_NUM_SAMPLES);
00015     connect(accumulator, SIGNAL(emitTick(const GapeFloat*, int)), plot, SLOT(receiveTick(const GapeFloat*, int)));
00016     connect(plot, SIGNAL(emitNumSamples(int)), accumulator, SLOT(resizeAccumulator(int)));
00017 }
00018 
00019 void GapeTimeDomainDisplay::receiveTick(const GapeFloat* values, int numValues) {
00020     if (muted) {
00021         emit emitTick(values,numValues);
00022         return;
00023     }
00024 
00025     if ((numValues > 0) && (values != NULL)) {
00026         accumulator->receiveTick(values,1);//only grab the first channel of audio even if there are > 1
00027     }
00028 
00029     emit emitTick(values, numValues);
00030 }
00031 
00032 GapeFreqDomainDisplay::GapeFreqDomainDisplay(QWidget* parent)
00033 :GapeSignalDisplay(new GapeFreqDomainPlot(parent)) {
00034 
00035 
00036 
00037     GapeFreqDomainPlot* plot = (GapeFreqDomainPlot*) (getControllers()[0]);
00038     accumulator = new GapeAccumulator(GAPE_NFFT_LENGTH);
00039     window = new GapeCosWindow(GAPE_NFFT_LENGTH);
00040     powerSpectrum = new GapePowerSpectrum(GAPE_NFFT_LENGTH);
00041 
00042     connect(accumulator, SIGNAL(emitTick(const GapeFloat*, int)), window, SLOT(receiveTick(const GapeFloat*, int)));
00043     connect(window, SIGNAL(emitTick(const GapeFloat*, int)), powerSpectrum, SLOT(receiveTick(const GapeFloat*, int)));
00044     connect(powerSpectrum, SIGNAL(emitTick(const GapeFloat*, int)), plot, SLOT(receiveTick(const GapeFloat*, int)));
00045     connect(plot, SIGNAL(emitNumSamples(int)), accumulator, SLOT(resizeAccumulator(int)));
00046     connect(plot, SIGNAL(emitTakeLogOfSpectrum(bool)), powerSpectrum, SLOT(takeLog(bool)));
00047 }
00048 
00049 void GapeFreqDomainDisplay::receiveTick(const GapeFloat* values, int numValues) {
00050     if (muted) {
00051         emit emitTick(values,numValues);
00052         return;
00053     }
00054 
00055     if ((numValues > 0) && (values != NULL)) {
00056         accumulator->receiveTick(values,1);//only grab the first channel of audio even if there are > 1
00057     }
00058 
00059     emit emitTick(values,numValues);
00060 }

Generated at Thu Jun 21 13:28:49 2001 for GAPE by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001