LMMS
Loading...
Searching...
No Matches
modules_dev.h
Go to the documentation of this file.
1/* Calf DSP Library
2 * Prototype audio modules
3 *
4 * Copyright (C) 2008 Thor Harald Johansen <thj@thj.no>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02111-1307, USA.
20 */
21#ifndef __CALF_MODULES_DEV_H
22#define __CALF_MODULES_DEV_H
23
24#include <calf/metadata.h>
25
26#if ENABLE_EXPERIMENTAL
27#include <fluidsynth.h>
28#endif
29
30namespace calf_plugins {
31
32#if ENABLE_EXPERIMENTAL
33
35class fluidsynth_audio_module: public audio_module<fluidsynth_metadata>
36{
37protected:
39 uint32_t srate;
41 fluid_settings_t *settings;
43 fluid_synth_t *synth;
45 std::string soundfont;
47 std::string soundfont_name;
49 std::string soundfont_preset_list;
51 int sfid;
53 std::map<uint32_t, std::string> sf_preset_names;
55 uint32_t last_selected_presets[16];
57 volatile int status_serial;
59 volatile int set_presets[16];
60 volatile bool soundfont_loaded;
61
63 void update_preset_num(int channel);
65 void select_preset_in_channel(int ch, int new_preset);
67 fluid_synth_t *create_synth(int &new_sfid);
68public:
70 fluidsynth_audio_module();
71
72 void post_instantiate(uint32_t sr);
73 void set_sample_rate(uint32_t sr) { srate = sr; }
75 void note_on(int channel, int note, int vel);
77 void note_off(int channel, int note, int vel);
79 inline void pitch_bend(int channel, int value)
80 {
81 fluid_synth_pitch_bend(synth, channel, value + 0x2000);
82 }
84 void control_change(int channel, int controller, int value);
86 void program_change(int channel, int program);
87
89 void params_changed() {
90 }
91 void activate();
92 void deactivate();
94 bool is_cv(int param_no) const { return false; }
96 bool is_noisy(int param_no) const { return true; }
98 uint32_t process(uint32_t offset, uint32_t nsamples, uint32_t inputs_mask, uint32_t outputs_mask);
100 char *configure(const char *key, const char *value);
101 void send_configures(send_configure_iface *sci);
102 int send_status_updates(send_updates_iface *sui, int last_serial);
103 uint32_t message_run(const void *valid_inputs, void *output_ports) {
104 // silence a default printf (which is kind of a warning about unhandled message_run)
105 return 0;
106 }
107 ~fluidsynth_audio_module();
108};
109
110
111
112#endif
113
114};
115
116#endif
Controller controller
Definition main.C:5
SYNTH_T * synth
Definition LocalZynAddSubFx.cpp:47
void process(Alg_seq_ptr seq, bool tempo_flag, double tempo, bool flatten_flag)
Definition allegroconvert.cpp:42
static void deactivate(LV2_Handle instance)
Definition bindings_test_plugin.c:128
Empty implementations for plugin functions.
Definition giface.h:519
static PuglViewHint int value
Definition pugl.h:1708
unsigned int uint32_t
Definition mid.cpp:100
Definition benchmark.cpp:53
ZCONST char * key
Definition crypt.c:587