4 * Copyright (C) 2008-2019 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "compressortools.h"
30 #include "reverbwindow.h"
31 #include "loadbalance.h"
32 #include "pluginaclient.h"
34 #define MAX_DELAY_INIT 1000
35 #define MIN_REFLECTIONS 1
36 #define MAX_REFLECTIONS 255
37 #define MIN_REFLENGTH 3
38 #define MAX_REFLENGTH 5000
46 int equivalent(ReverbConfig &that);
47 void copy_from(ReverbConfig &that);
48 void interpolate(ReverbConfig &prev, ReverbConfig &next,
49 int64_t prev_frame, int64_t next_frame, int64_t current_frame);
67 class Reverb : public PluginAClient
70 Reverb(PluginServer *server);
77 // required for all realtime/multichannel plugins
78 PLUGIN_CLASS_MEMBERS(ReverbConfig);
79 int process_buffer(int64_t size, Samples **buffer,
80 int64_t start_position, int sample_rate);
81 double gauss(double sigma, double center, double x);
82 void calculate_envelope();
83 void reallocate_dsp(int new_dsp_allocated);
87 int is_multichannel();
88 void save_data(KeyFrame *keyframe);
89 void read_data(KeyFrame *keyframe);
91 // the output all reflections are painted on
93 // may have to expand it for fft windows larger than the reflected time
95 // total samples read into dsp_in by the FFT
97 // new value calculated by the FFT readers
99 // total spectrogram frames generated by the FFT. Each channel overwrites the same
101 int new_spectrogram_frames;
103 // source channels of reflections
105 // destination offsets of reflections
107 // levels of reflections
110 int64_t last_position;
111 // start_position / sample_rate
113 // get_direction fwd=1, rev=-1, stop=0
117 ReverbEngine *engine;
120 int need_reconfigure;
123 class ReverbClientFrame : public CompressorFreqFrame
126 ReverbClientFrame(int size);
127 ~ReverbClientFrame();
131 class ReverbFFT :public CrossfadeFFT
134 ReverbFFT(Reverb *plugin, int channel);
137 int signal_process();
139 int read_samples(int64_t output_sample, int samples, Samples *buffer);
142 ReverbClientFrame *frame;
147 class ReverbPackage : public LoadPackage
155 class ReverbUnit : public LoadClient
158 ReverbUnit(ReverbEngine *engine, Reverb *plugin);
160 void process_package(LoadPackage *package);
161 ReverbEngine *engine;
165 // This allocates 1 CPU for each output channel.
166 // They simultaneously read from all the input FFT channels.
167 class ReverbEngine : public LoadServer
170 ReverbEngine(Reverb *plugin);
173 void init_packages();
174 LoadClient* new_client();
175 LoadPackage* new_package();