forked from PALYGAP/MidyAX-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CCmapping.cpp
executable file
·119 lines (100 loc) · 3.6 KB
/
CCmapping.cpp
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include "CCmapping.h"
#include "ui_CCmapping.h"
#include <QMessageBox>
#include "midyax.h"
//extern unsigned char EffectBlock__ID[71];
//extern int Parameter__minDispValue[AXEFX_NumOf_Parameters_DEFINE];
//extern int Parameter__maxDispValue[AXEFX_NumOf_Parameters_DEFINE];
//extern int Parameter__unit[AXEFX_NumOf_Parameters_DEFINE];
//extern char *Parameter__unitModalValues[8];
//extern char *EffectBlock__names[AXEFX_NUMBER_EFFECTS_BLOCK];
//extern int AXEFX_Effect_Block_ID_to_Effect_Type_ID[ AXEFX_NUMBER_EFFECTS_BLOCK ];
//extern int EffectType__numOfParameters[AXEFX_NUMBER_EFFECT_TYPE-1];
//extern char *Parameter__labels[AXEFX_NumOf_Parameters_DEFINE];
//extern int Parameter__types[AXEFX_NumOf_Parameters_DEFINE];
//extern int EffectBlock__effectTypeID[AXEFX_NUMBER_EFFECTS_BLOCK];
extern int AXE_effect_CC_CC[128];
extern QStringList AXE_effect_CC_Label;
// Learn mode variables
extern bool g_learnMode;
extern int g_learnModeCount;
extern unsigned char g_learnModeChan;
extern unsigned char g_learnModeCC;
extern double g_learn_paramDispValue;
extern unsigned char g_learn_MIDIValue;
extern int g_learn_callingDialog;
CCMapping::CCMapping(QWidget *parent) :
QDialog(parent),
ui(new Ui::CCMapping)
{
ui->setupUi(this);
localpalette = palette();
// set black background
localpalette.setColor(QPalette::Background, Qt::darkGray);
this->setAutoFillBackground(true);
this->setPalette(localpalette);
}
CCMapping::~CCMapping()
{
delete ui;
}
void CCMapping::init( struct CCpageMappingTable *mappingTableElement )
{
int CCposition;
loadCCList();
// Set the Position to the current selected mapping if any
if( mappingTableElement->number !=255) CCposition = ui->cboControlName->findText( mappingTableElement->controlName );
else CCposition = -1;
// Update UI accordingly
ui->cboControlName->setCurrentIndex( CCposition );
ui->cboCCnumber->setCurrentIndex( CCposition );
}
void CCMapping::loadCCList( void )
{
ui->cboControlName->addItem(QString::null, -1);
ui->cboCCnumber->addItem(QString::null, -1);
for(int i = 0; i < 128; i++)
{
if( AXE_effect_CC_CC[i] != 0)
{
ui->cboControlName->addItem( AXE_effect_CC_Label[i], i );
ui->cboCCnumber->addItem( QString::number( AXE_effect_CC_CC[i] ), i );
}
}
}
void CCMapping::on_buttonBox_accepted()
{
if(ui->cboCCnumber->currentIndex() != 0)
{
m_selectedControlNumber = ui->cboCCnumber->currentIndex();
m_selectedControlCC = AXE_effect_CC_CC[ ui->cboControlName->currentIndex() -1 ];
}
else {
m_selectedControlNumber = 255;
m_selectedControlCC = 255;
}
QDialog::accept();
}
//void ParamMappingMOD1::get_ParamMappingMOD1( unsigned char *effectBlockID, unsigned char *effectParamID)
void CCMapping::get_paramMapping( struct CCpageMappingTable *mappingTableElement )
{
//Update MIDIMapping (BCF2000 or BCR2000) for the current Slider with the new BlockID and ParamID
if ( mappingTableElement != NULL)
{
if( m_selectedControlNumber != -1 && m_selectedControlNumber != 255 )
{
mappingTableElement->number = m_selectedControlNumber;
mappingTableElement->controlName = AXE_effect_CC_Label[m_selectedControlNumber-1];
mappingTableElement->AXE_CC = m_selectedControlCC;
}
else{
mappingTableElement->number = 255;
mappingTableElement->controlName = "";
mappingTableElement->AXE_CC = 255;
}
}
}
void CCMapping::on_cboControlName_currentIndexChanged(int index)
{
ui->cboCCnumber->setCurrentIndex( index );
}