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