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

aflibAudioSpectrum.h

Go to the documentation of this file.
00001 /*
00002  * Copyright: (C) 1999-2001 Bruce W. Forsberg
00003  *
00004  *   This library is free software; you can redistribute it and/or
00005  *   modify it under the terms of the GNU Lesser General Public
00006  *   License as published by the Free Software Foundation; either
00007  *   version 2.1 of the License, or any later version.
00008  *
00009  *   This library is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *   Lesser General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU Lesser General Public
00015  *   License along with this library; if not, write to the Free Software
00016  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00017  *
00018  *   Bruce Forsberg  forsberg@tns.net
00019  *
00020  */
00021 
00022 
00023 #ifndef _AFLIBAUDIOSPECTRUM_H_
00024 #define _AFLIBAUDIOSPECTRUM_H_
00025 
00026 #include "aflibAudio.h"
00027 #include "aflibFFT.h"
00028 
00029 #define MAX_ARRAY_SIZE 1024
00030 
00031 typedef void (*powermeter_callback)(double *);
00032 typedef void (*spectrum_callback)(int, double *);
00033 
00044 class aflibAudioSpectrum : public aflibAudio {
00045 
00046 public:
00047 
00048    // Available contructors and destructors
00049    aflibAudioSpectrum(aflibAudio& audio);
00050    ~aflibAudioSpectrum();
00051 
00052    bool
00053    setParameters(
00054       int num_samples,
00055       int resp_per_sec,
00056       int channels);
00057 
00058    void
00059    setPowerMeterCallback( powermeter_callback func_ptr);
00060 
00061    void
00062    setAudioSpectrumCallback( spectrum_callback func_ptr);
00063 
00064    void
00065    setInputConfig(const aflibConfig& cfg);
00066 
00067    aflibStatus
00068    compute_segment(
00069       list<aflibData *>& data,
00070       long long position = -1) ;
00071 
00073    const char *
00074    getName() const { return "aflibAudioSpectrum";};
00075 
00076 private:
00077 
00078    aflibAudioSpectrum();
00079 
00080    aflibAudioSpectrum(const aflibAudioSpectrum& op);
00081 
00082    const aflibAudioSpectrum&
00083    operator=(const aflibAudioSpectrum& op);
00084 
00085    void
00086    allocateMemory();
00087 
00088 aflibFFT  _fft;
00089 int    _num_samples;
00090 int    _responses;
00091 int    _channels;
00092 int    _samples_between_responses;
00093 int    _samples_counter;
00094 double  * _in_real;
00095 double  * _power_out;
00096 double  * _spec_out;
00097 powermeter_callback  _pm_func_ptr;
00098 spectrum_callback  _spectrum_func_ptr;
00099 
00100 };
00101 
00102 
00103 #endif

Generated at Tue Aug 7 22:18:05 2001 for Open Source Audio Library Project by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001