X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Freverb%2Freverb.h;h=2b889c89a7f1357bab9af288cb64169fa0672b38;hb=0e6cf5b52d1ebce9272270144bcf43df4683507e;hp=629c74ce173ef24dc38a620217fe4393f5c0f36b;hpb=f068b73c1d4afafbf6d86e7f5bc8f1c96b5366d3;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/plugins/reverb/reverb.h b/cinelerra-5.1/plugins/reverb/reverb.h index 629c74ce..2b889c89 100644 --- a/cinelerra-5.1/plugins/reverb/reverb.h +++ b/cinelerra-5.1/plugins/reverb/reverb.h @@ -1,7 +1,7 @@ /* * CINELERRA - * Copyright (C) 2008 Adam Williams + * Copyright (C) 2008-2019 Adam Williams * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * */ #ifndef REVERB_H @@ -24,13 +23,18 @@ class Reverb; class ReverbEngine; +class ReverbFFT; +#include "compressortools.h" +#include "fourier.h" #include "reverbwindow.h" +#include "loadbalance.h" #include "pluginaclient.h" #define MAX_DELAY_INIT 1000 #define MIN_REFLECTIONS 1 #define MAX_REFLECTIONS 255 +#define MIN_REFLENGTH 3 #define MAX_REFLENGTH 5000 class ReverbConfig @@ -41,21 +45,23 @@ public: int equivalent(ReverbConfig &that); void copy_from(ReverbConfig &that); - void interpolate(ReverbConfig &prev, - ReverbConfig &next, - int64_t prev_frame, - int64_t next_frame, - int64_t current_frame); + void interpolate(ReverbConfig &prev, ReverbConfig &next, + int64_t prev_frame, int64_t next_frame, int64_t current_frame); void dump(); void boundaries(); - double level_init; - int64_t delay_init; - double ref_level1; - double ref_level2; - int64_t ref_total; - int64_t ref_length; - int64_t lowpass1, lowpass2; + float level_init; + int delay_init; + float ref_level1; + float ref_level2; + int ref_total; + int ref_length; +// high frequency + int high; +// low frequency + int low; + float q; + int window_size; }; class Reverb : public PluginAClient @@ -64,54 +70,110 @@ public: Reverb(PluginServer *server); ~Reverb(); + void reset(); + void render_stop(); void update_gui(); -// int load_from_file(char *data); -// int save_to_file(char *data); - -// data for reverb - char config_directory[1024]; - double **main_in, **main_out; - double **dsp_in; - int64_t **ref_channels, **ref_offsets, **ref_lowpass; - double **ref_levels; - int64_t dsp_in_length; - int redo_buffers; -// skirts for lowpass filter - double **lowpass_in1, **lowpass_in2; - DB db; // required for all realtime/multichannel plugins - PLUGIN_CLASS_MEMBERS(ReverbConfig); - int process_realtime(int64_t size, Samples **input_ptr, Samples **output_ptr); + int process_buffer(int64_t size, Samples **buffer, + int64_t start_position, int sample_rate); + double gauss(double sigma, double center, double x); + void calculate_envelope(); + void reallocate_dsp(int new_dsp_allocated); + int is_realtime(); int is_synthesis(); int is_multichannel(); - int show_gui(); - int set_string(); void save_data(KeyFrame *keyframe); void read_data(KeyFrame *keyframe); - void raise_window(); - ReverbEngine **engine; - int initialized; +// the output all reflections are painted on + double **dsp_in; +// may have to expand it for fft windows larger than the reflected time + int dsp_in_allocated; +// total samples read into dsp_in by the FFT + int dsp_in_length; +// new value calculated by the FFT readers + int new_dsp_length; +// total spectrogram frames generated by the FFT. Each channel overwrites the same +// spectrograms + int new_spectrogram_frames; + +// source channels of reflections + int **ref_channels; +// destination offsets of reflections + int **ref_offsets; +// levels of reflections + double **ref_levels; +// detect seeking + int64_t last_position; +// start_position / sample_rate + double start_pos; +// get_direction fwd=1, rev=-1, stop=0 + int dir; + DB db; + + ReverbEngine *engine; + ReverbFFT **fft; + double *envelope; + int need_reconfigure; +}; + +class ReverbClientFrame : public CompressorFreqFrame +{ +public: + ReverbClientFrame(int size); + ~ReverbClientFrame(); +}; + + +class ReverbFFT :public CrossfadeFFT +{ +public: + ReverbFFT(Reverb *plugin, int channel); + ~ReverbFFT(); + + int signal_process(); + int post_process(); + int read_samples(int64_t output_sample, int samples, Samples *buffer); + + Reverb *plugin; + ReverbClientFrame *frame; + int channel; +}; + + +class ReverbPackage : public LoadPackage +{ +public: + ReverbPackage(); + int channel; +}; + + +class ReverbUnit : public LoadClient +{ +public: + ReverbUnit(ReverbEngine *engine, Reverb *plugin); + ~ReverbUnit(); + void process_package(LoadPackage *package); + ReverbEngine *engine; + Reverb *plugin; }; -class ReverbEngine : public Thread +// This allocates 1 CPU for each output channel. +// They simultaneously read from all the input FFT channels. +class ReverbEngine : public LoadServer { public: ReverbEngine(Reverb *plugin); ~ReverbEngine(); - int process_overlay(double *in, double *out, double &out1, double &out2, double level, int64_t lowpass, int64_t samplerate, int64_t size); - int process_overlays(int output_buffer, int64_t size); - int wait_process_overlays(); - void run(); + void init_packages(); + LoadClient* new_client(); + LoadPackage* new_package(); - Mutex input_lock, output_lock; - int completed; - int output_buffer; - int64_t size; Reverb *plugin; };