-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathmidi3.c
66 lines (61 loc) · 1.53 KB
/
midi3.c
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
/*
* Layer-3 of MIDI support
*
* (C) Christoph van Wullen, DL1YCF
*
*
* In most cases, a certain action only makes sense for a specific
* type. For example, changing the VFO frequency will only be implemeted
* for MIDI_WHEEL, and TUNE off/on only with MIDI_KNOB.
*
* However, changing the volume makes sense both with MIDI_KNOB and MIDI_WHEEL.
*/
#include <gtk/gtk.h>
#include "radio.h"
#include "vfo.h"
#include "filter.h"
#include "band.h"
#include "mode.h"
#include "new_menu.h"
#include "sliders.h"
#include "ext.h"
#include "agc.h"
#include "actions.h"
#include "midi.h"
#ifdef LOCALCW
#include "iambic.h"
#endif
void DoTheMidi(int action, enum ACTIONtype type, int val) {
PROCESS_ACTION *a;
//g_print("%s: action=%d type=%d val=%d\n",__FUNCTION__,action,type,val);
switch(type) {
case MIDI_KEY:
if(action==CW_LEFT || action==CW_RIGHT) {
#ifdef LOCALCW
keyer_event(action==CW_LEFT,val);
#else
g_print("MIDI CW key but compiled without LOCALCW\n");
#endif
} else {
a=g_new(PROCESS_ACTION,1);
a->action=action;
a->mode=val?PRESSED:RELEASED;
g_idle_add(process_action,a);
}
break;
case MIDI_KNOB:
a=g_new(PROCESS_ACTION,1);
a->action=action;
a->mode=ABSOLUTE;
a->val=val;
g_idle_add(process_action,a);
break;
case MIDI_WHEEL:
a=g_new(PROCESS_ACTION,1);
a->action=action;
a->mode=RELATIVE;
a->val=val;
g_idle_add(process_action,a);
break;
}
}