9 #include "pluginaclient.h"
12 class CompressorEffect
;
18 class CompressorCanvas
: public BC_SubWindow
21 CompressorCanvas(CompressorEffect
*plugin
, int x
, int y
, int w
, int h
);
22 int button_press_event();
23 int button_release_event();
24 int cursor_motion_event();
34 int current_operation
;
35 CompressorEffect
*plugin
;
39 class CompressorReaction
: public BC_TextBox
42 CompressorReaction(CompressorEffect
*plugin
, int x
, int y
);
44 int button_press_event();
45 CompressorEffect
*plugin
;
48 class CompressorClear
: public BC_GenericButton
51 CompressorClear(CompressorEffect
*plugin
, int x
, int y
);
53 CompressorEffect
*plugin
;
56 class CompressorX
: public BC_TextBox
59 CompressorX(CompressorEffect
*plugin
, int x
, int y
);
61 CompressorEffect
*plugin
;
64 class CompressorY
: public BC_TextBox
67 CompressorY(CompressorEffect
*plugin
, int x
, int y
);
69 CompressorEffect
*plugin
;
72 class CompressorTrigger
: public BC_TextBox
75 CompressorTrigger(CompressorEffect
*plugin
, int x
, int y
);
77 int button_press_event();
78 CompressorEffect
*plugin
;
81 class CompressorDecay
: public BC_TextBox
84 CompressorDecay(CompressorEffect
*plugin
, int x
, int y
);
86 int button_press_event();
87 CompressorEffect
*plugin
;
90 class CompressorSmooth
: public BC_CheckBox
93 CompressorSmooth(CompressorEffect
*plugin
, int x
, int y
);
95 CompressorEffect
*plugin
;
98 class CompressorInput
: public BC_PopupMenu
101 CompressorInput(CompressorEffect
*plugin
, int x
, int y
);
102 void create_objects();
104 static char* value_to_text(int value
);
105 static int text_to_value(char *text
);
106 CompressorEffect
*plugin
;
111 class CompressorWindow
: public BC_Window
114 CompressorWindow(CompressorEffect
*plugin
, int x
, int y
);
115 void create_objects();
117 void update_textboxes();
118 void update_canvas();
123 CompressorCanvas
*canvas
;
124 CompressorReaction
*reaction
;
125 CompressorClear
*clear
;
128 CompressorTrigger
*trigger
;
129 CompressorDecay
*decay
;
130 CompressorSmooth
*smooth
;
131 CompressorInput
*input
;
132 CompressorEffect
*plugin
;
135 PLUGIN_THREAD_HEADER(CompressorEffect
, CompressorThread
, CompressorWindow
)
140 // DB from min_db - 0
142 } compressor_point_t
;
144 class CompressorConfig
149 void copy_from(CompressorConfig
&that
);
150 int equivalent(CompressorConfig
&that
);
151 void interpolate(CompressorConfig
&prev
,
152 CompressorConfig
&next
,
155 int64_t current_frame
);
158 void remove_point(int number
);
160 // Return values of a specific point
161 double get_y(int number
);
162 double get_x(int number
);
163 // Returns db output from db input
164 double calculate_db(double x
);
165 int set_point(double x
, double y
);
182 ArrayList
<compressor_point_t
> levels
;
185 class CompressorEffect
: public PluginAClient
188 CompressorEffect(PluginServer
*server
);
191 int is_multichannel();
193 void read_data(KeyFrame
*keyframe
);
194 void save_data(KeyFrame
*keyframe
);
195 int process_buffer(int64_t size
,
197 int64_t start_position
,
199 double calculate_gain(double input
);
201 // Calculate linear output from linear input
202 double calculate_output(double x
);
211 PLUGIN_CLASS_MEMBERS(CompressorConfig
, CompressorThread
)
213 // The raw input data for each channel with readahead
214 double **input_buffer
;
215 // Number of samples in the input buffer
217 // Number of samples allocated in the input buffer
218 int64_t input_allocated
;
219 // Starting sample of input buffer relative to project in requested rate.
222 // ending input value of smoothed input
224 // starting input value of smoothed input
225 double previous_target
;
226 // samples between previous and next target value for readahead
228 // current sample from 0 to target_samples
229 int target_current_sample
;
230 // current smoothed input value
231 double current_value
;
232 // Temporaries for linear transfer
233 ArrayList
<compressor_point_t
> levels
;