-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathQt_control_change_widget_callbacks.h
95 lines (68 loc) · 2.39 KB
/
Qt_control_change_widget_callbacks.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
/* Copyright 2012 Kjetil S. Matheussen
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "Qt_control_change_widget.h"
class Control_change_widget : public QWidget, public Ui::Control_change_widget{
Q_OBJECT;
public:
Control_change_widget(QWidget *parent=NULL, const char *name="control change widget")
: QWidget(parent)
{
setupUi(this);
}
int ccnum;
struct PatchData *patchdata;
public slots:
void on_value_slider_valueChanged( int val)
{
value_spin->setValue(val);
}
void on_value_spin_valueChanged( int val)
{
if(value_slider->value()!=val)
value_slider->setValue(val);
patchdata->ccvalues[this->ccnum] = val;
printf("num: %d, value: %d\n",patchdata->cc[this->ccnum],val);
MIDI_send3(patchdata,
0xb0|patchdata->channel,
patchdata->cc[this->ccnum],
val
);
//set_editor_focus();
}
void on_value_spin_editingFinished (){
set_editor_focus();
}
void on_onoff_toggled(bool val)
{
if (val==true){
value_slider->setEnabled(true);
value_spin->setEnabled(true);
cctype->setEnabled(true);
if (this->patchdata==NULL) return;
this->patchdata->ccsonoff[this->ccnum] = true;
}else if(val==false){
value_slider->setEnabled(false);
value_spin->setEnabled(false);
cctype->setEnabled(false);
if (this->patchdata==NULL) return;
this->patchdata->ccsonoff[this->ccnum] = false;
}
}
void on_cctype_activated( int val)
{
patchdata->cc[this->ccnum] = val;
patchdata->ccnames[this->ccnum] = talloc_strdup(get_ccnames()[val]);
value_slider->_effect_num = patchdata->cc[ccnum];
printf("on_cctype_activated: Update effectnum for %d to %d\n",ccnum,patchdata->cc[ccnum]);
}
};