-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmidi_controller.h
More file actions
74 lines (67 loc) · 2.15 KB
/
midi_controller.h
File metadata and controls
74 lines (67 loc) · 2.15 KB
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
// Pithesiser - a software synthesiser for Raspberry Pi
// Copyright (C) 2015 Nicholas Tuckett
//
// 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 3 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/>.
/*
* midi_controller.h
*
* Created on: 11 Feb 2013
* Author: ntuckett
*/
#ifndef MIDI_CONTROLLER_H_
#define MIDI_CONTROLLER_H_
#include "setting.h"
typedef enum
{
NONE = -1,
CONTINUOUS,
CONTINUOUS_WITH_HELD,
CONTINUOUS_RELATIVE,
CONTINUOUS_RELATIVE_WITH_HELD,
TOGGLE,
EVENT
} controller_type_t;
typedef struct midi_controller_t
{
const char* name;
controller_type_t type;
int midi_channel;
int midi_cc[2];
struct midi_controller_t* indexer_control;
int indexer_value;
union
{
struct
{
int min;
int max;
} midi_range;
int midi_threshold;
};
int output_min;
int output_max;
int output_held;
int delta_scale;
int last_output;
} midi_controller_t;
extern void midi_controller_create(midi_controller_t* controller, const char* name);
extern void midi_controller_init(midi_controller_t* controller);
extern int midi_controller_update(midi_controller_t* controller);
extern int midi_controller_read(midi_controller_t* controller);
extern int midi_controller_update_and_read(midi_controller_t* controller, int* value);
extern void midi_controller_set_setting(midi_controller_t* controller, setting_t* setting);
extern midi_controller_t* midi_controller_new_index_control(const char* name);
extern midi_controller_t* midi_controller_find_index_control(const char* name);
extern void midi_controller_update_index_controls();
#endif /* MIDI_CONTROLLER_H_ */