00001 #ifndef PITCH_H
00002 #define PITCH_H
00003
00004
00005
00006 #include "bchash.inc"
00007 #include "fourier.h"
00008 #include "guicast.h"
00009 #include "mutex.h"
00010 #include "pluginaclient.h"
00011 #include "vframe.inc"
00012
00013
00014 class PitchEffect;
00015
00016 class PitchScale : public BC_FPot
00017 {
00018 public:
00019 PitchScale(PitchEffect *plugin, int x, int y);
00020 int handle_event();
00021 PitchEffect *plugin;
00022 };
00023
00024 class PitchWindow : public BC_Window
00025 {
00026 public:
00027 PitchWindow(PitchEffect *plugin, int x, int y);
00028 void create_objects();
00029 void update();
00030 int close_event();
00031 PitchScale *scale;
00032 PitchEffect *plugin;
00033 };
00034
00035 PLUGIN_THREAD_HEADER(PitchEffect, PitchThread, PitchWindow)
00036
00037
00038 class PitchConfig
00039 {
00040 public:
00041 PitchConfig();
00042
00043
00044 int equivalent(PitchConfig &that);
00045 void copy_from(PitchConfig &that);
00046 void interpolate(PitchConfig &prev,
00047 PitchConfig &next,
00048 int64_t prev_frame,
00049 int64_t next_frame,
00050 int64_t current_frame);
00051
00052
00053 double scale;
00054 };
00055
00056 class PitchFFT : public CrossfadeFFT
00057 {
00058 public:
00059 PitchFFT(PitchEffect *plugin);
00060 ~PitchFFT();
00061 int signal_process_oversample(int reset);
00062 int read_samples(int64_t output_sample,
00063 int samples,
00064 double *buffer);
00065 PitchEffect *plugin;
00066
00067 double *last_phase;
00068 double *new_freq;
00069 double *new_magn;
00070 double *sum_phase;
00071 double *anal_freq;
00072 double *anal_magn;
00073 };
00074
00075 class PitchEffect : public PluginAClient
00076 {
00077 public:
00078 PitchEffect(PluginServer *server);
00079 ~PitchEffect();
00080
00081 VFrame* new_picon();
00082 char* plugin_title();
00083 int is_realtime();
00084 void read_data(KeyFrame *keyframe);
00085 void save_data(KeyFrame *keyframe);
00086 int process_buffer(int64_t size,
00087 double *buffer,
00088 int64_t start_position,
00089 int sample_rate);
00090 int show_gui();
00091 void raise_window();
00092 int set_string();
00093
00094
00095
00096
00097 int load_defaults();
00098 int save_defaults();
00099 int load_configuration();
00100 void reset();
00101 void update_gui();
00102
00103
00104 BC_Hash *defaults;
00105 PitchThread *thread;
00106 PitchFFT *fft;
00107 PitchConfig config;
00108 };
00109
00110
00111 #endif