4 * Copyright (C) 2008 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
27 #include "filexml.inc"
30 #include "pluginaclient.h"
47 class PianoWindow : public BC_Window
50 PianoWindow(Piano *plugin, int x, int y);
53 void create_objects();
55 int resize_event(int w, int h);
57 int waveform_to_text(char *text, int waveform);
58 void update_scrollbar();
59 void update_oscillators();
67 class PianoCanvas : public BC_SubWindow
70 PianoCanvas(Piano *plugin,
84 class PianoThread : public Thread
87 PianoThread(Piano *synth);
105 int equivalent(PianoConfig &that);
106 void copy_from(PianoConfig &that);
107 void interpolate(PianoConfig &prev,
111 int64_t current_frame);
117 class Piano : public PluginAClient
120 Piano(PluginServer *server);
127 int load_configuration();
128 const char* plugin_title();
129 void read_data(KeyFrame *keyframe);
130 void save_data(KeyFrame *keyframe);
134 int process_realtime(int64_t size, double *input_ptr, double *output_ptr);
142 void add_oscillator();
143 void delete_oscillator();
144 double get_total_power();
145 double get_oscillator_point(float x,
146 double normalize_constant,
148 double solve_eqn(double *output,
151 double normalize_constant,
153 double get_point(float x, double normalize_constant);
154 double function_square(double x);
155 double function_pulse(double x);
156 double function_noise();
157 double function_sawtooth(double x);
158 double function_triangle(double x);
160 int overlay_synth(int64_t start, int64_t length, double *input, double *output);
167 int need_reconfigure;
172 int64_t waveform_length; // length of loop buffer
173 int64_t waveform_sample; // current sample in waveform of loop
174 int64_t samples_rendered; // samples of the dsp_buffer rendered since last buffer redo
175 float period; // number of samples in a period for this frequency