Skip to content
Newer
Older
100644 99 lines (83 sloc) 2.48 KB
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
9ef4906 @jeremysalwen fixed up copyright and License headers
authored May 20, 2011
3 * so-kl5.h
4 *
5 * Copyright (C) 2011 - Jeremy Salwen
6 * Copyright (C) 2010 - 50m30n3
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
11 * (at your option) any later version.
9ef4906 @jeremysalwen fixed up copyright and License headers
authored May 20, 2011
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
20 */
9ef4906 @jeremysalwen fixed up copyright and License headers
authored May 20, 2011
21
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
22 #include <lv2.h>
23 #include <string.h>
46ab09b @jeremysalwen Use system extension headers.
authored May 30, 2011
24 #include "lv2/lv2plug.in/ns/ext/event/event-helpers.h"
25 #include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h"
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <unistd.h>
29 #include <math.h>
30
31 #define NUMNOTES 80
32 #define BASENOTE 21
33
34 #define MIDI_COMMANDMASK 0xF0
35 #define MIDI_CHANNELMASK 0x0F
36
37 #define MIDI_NOTEON 0x90
38 #define MIDI_NOTEOFF 0x80
39 #define MIDI_CONTROL 0xB0
40
ccd9b2d Fixed up enums and made it compile well.
Jeremy Salwen authored Jan 2, 2011
41 enum KL5_PORTS {
42 KL5_PORT_OUTPUT=0,
43 KL5_PORT_MIDI,
44 KL5_PORT_CONTROLMODE,
45 KL5_PORT_SUSTAIN,
46 KL5_PORT_RESONANCE,
47 KL5_PORT_CUTOFF,
48 KL5_PORT_ATTACK,
49 KL5_PORT_VOLUME,
50 KL5_PORT_CHANNEL
64ed20f Added in LV2 control ports, and cleaned up some terminal output.
Jeremy Salwen authored Jan 1, 2011
51 };
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
52
0b7f439 Fixed staticyness.
Jeremy Salwen authored Dec 31, 2010
53 void runSO_kl5( LV2_Handle arg, uint32_t nframes );
54 LV2_Handle instantiateSO_kl5(const LV2_Descriptor *descriptor,double s_rate, const char *path,const LV2_Feature * const* features);
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
55 void cleanupSO_kl5(LV2_Handle instance);
56 void connectPortSO_kl5(LV2_Handle instance, uint32_t port, void *data_location);
57
58 static LV2_Descriptor so_kl5_Descriptor= {
59 .URI="urn:50m30n3:plugins:SO-kl5",
60 .instantiate=instantiateSO_kl5,
61 .connect_port=connectPortSO_kl5,
62 .activate=NULL,
63 .run=runSO_kl5,
64 .deactivate=NULL,
65 .cleanup=cleanupSO_kl5,
66 .extension_data=NULL,
67 };
68
69 typedef struct so_kl5_t {
70 float* output;
71 LV2_Event_Buffer *MidiIn;
72 LV2_Event_Iterator in_iterator;
73
74 LV2_Event_Feature* event_ref;
75 int midi_event_id;
64ed20f Added in LV2 control ports, and cleaned up some terminal output.
Jeremy Salwen authored Jan 1, 2011
76
77 float* controlmode_p;
78 float* volume_p;
79 float* resonance_p;
80 float* cutoff_p;
81 float* sustain_p;
82 float* attack_p;
83
5ed58a5 replaced double with float.
Jeremy Salwen authored Dec 31, 2010
84 float *strings[NUMNOTES];
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
85 unsigned int stringpos[NUMNOTES];
86 unsigned int stringlength[NUMNOTES];
5ed58a5 replaced double with float.
Jeremy Salwen authored Dec 31, 2010
87 float stringcutoff[NUMNOTES];
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
88 int status[NUMNOTES];
89
90 unsigned int volume;
91
5ed58a5 replaced double with float.
Jeremy Salwen authored Dec 31, 2010
92 float lpval, lplast;
93 float fcutoff, freso, ssustain,sattack;
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
94
64ed20f Added in LV2 control ports, and cleaned up some terminal output.
Jeremy Salwen authored Jan 1, 2011
95 float* channel_p;
ab39367 Ported kl5 synth.
Jeremy Salwen authored Dec 31, 2010
96
5ed58a5 replaced double with float.
Jeremy Salwen authored Dec 31, 2010
97 float* tempstring;
3f03ce5 Apply patches from 50m30n3
Jeremy Salwen authored Jan 4, 2011
98 } so_kl5;
Something went wrong with that request. Please try again.