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 #ifdef HAVE_CONFIG_H
00027 #include <config.h>
00028 #endif
00029
00030 #include "aflibAudio.h"
00031 #include "aflibFFT.h"
00032
00033 #define MAX_ARRAY_SIZE 1024
00034
00035 typedef void (*powermeter_callback)(double *);
00036 typedef void (*spectrum_callback)(int, double *);
00037
00048 class aflibAudioSpectrum : public aflibAudio {
00049
00050 public:
00051
00052
00053 aflibAudioSpectrum(aflibAudio& audio);
00054 ~aflibAudioSpectrum();
00055
00056 bool
00057 setParameters(
00058 int num_samples,
00059 int resp_per_sec,
00060 int channels);
00061
00062 void
00063 setPowerMeterCallback( powermeter_callback func_ptr);
00064
00065 void
00066 setAudioSpectrumCallback( spectrum_callback func_ptr);
00067
00068 void
00069 setInputConfig(const aflibConfig& cfg);
00070
00071 aflibStatus
00072 compute_segment(
00073 list<aflibData *>& data,
00074 long long position = -1) ;
00075
00077 const char *
00078 getName() const { return "aflibAudioSpectrum";};
00079
00080 protected:
00081
00082 virtual void
00083 setPowerMeter(double*);
00084
00085 virtual void
00086 setAudioSpectrum(int, double*);
00087
00088 bool _pm;
00089 bool _spectrum;
00090 private:
00091
00092 aflibAudioSpectrum();
00093
00094 aflibAudioSpectrum(const aflibAudioSpectrum& op);
00095
00096 const aflibAudioSpectrum&
00097 operator=(const aflibAudioSpectrum& op);
00098
00099 void
00100 allocateMemory();
00101
00102 aflibFFT _fft;
00103 int _num_samples;
00104 int _responses;
00105 int _channels;
00106 int _samples_between_responses;
00107 int _samples_counter;
00108 double * _in_real;
00109 double * _power_out;
00110 double * _spec_out;
00111 powermeter_callback _pm_func_ptr;
00112 spectrum_callback _spectrum_func_ptr;
00113
00114 };
00115
00116
00117 #endif