00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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