60
62
int outChannel = track->outChannel();
61
63
int outPort = track->outPort();
62
int ichMask = track->inChannelMask();
64
///int ichMask = track->inChannelMask();
63
65
//int iptMask = track->inPortMask();
64
unsigned int iptMask = track->inPortMask();
66
///unsigned int iptMask = track->inPortMask();
66
68
MidiPort* mp = &midiPorts[outPort];
76
78
// Check for detection of midi general activity on chosen channels...
79
for(; mpt < MIDI_PORTS; ++mpt)
81
RouteList* rl = track->inRoutes();
83
ciRoute r = rl->begin();
84
//for( ; mpt < MIDI_PORTS; ++mpt)
85
for( ; r != rl->end(); ++r)
87
//if(!r->isValid() || ((r->type != Route::ALSA_MIDI_ROUTE) && (r->type != Route::JACK_MIDI_ROUTE)))
88
//if(!r->isValid() || (r->type != Route::MIDI_DEVICE_ROUTE))
89
if(!r->isValid() || (r->type != Route::MIDI_PORT_ROUTE)) // p3.3.49
92
// NOTE: TODO: Code for channelless events like sysex, ** IF we end up using the 'special channel 17' method.
93
//if(r->channel == -1)
94
if(r->channel == -1 || r->channel == 0) // p3.3.50
97
// No port assigned to the device?
98
//mpt = r->device->midiPort();
99
mpt = r->midiPort; // p3.3.49
100
if(mpt < 0 || mpt >= MIDI_PORTS)
81
103
//for(; mch < MIDI_CHANNELS; ++mch)
83
105
//if(midiPorts[mpt].syncInfo().actDetect(mch) && (iptMask & (1 << mpt)) && (ichMask & (1 << mch)) )
84
if((iptMask & bitShiftLU[mpt]) && (midiPorts[mpt].syncInfo().actDetectBits() & ichMask) )
106
//if((iptMask & bitShiftLU[mpt]) && (midiPorts[mpt].syncInfo().actDetectBits() & ichMask) )
107
//if(midiPorts[mpt].syncInfo().actDetectBits() & bitShiftLU[r->channel])
108
if(midiPorts[mpt].syncInfo().actDetectBits() & r->channel) // p3.3.50 Use new channel mask.
86
110
//if(midiTrackInfo->iChanTextLabel->paletteBackgroundColor() != green)
87
111
// midiTrackInfo->iChanTextLabel->setPaletteBackgroundColor(green);
88
112
//if(midiTrackInfo->iChanDetectLabel->pixmap() != greendotIcon)
89
113
if(!midiTrackInfo->_midiDetect)
91
// Added by Tim. p3.3.6
92
115
//printf("Arranger::midiTrackInfoHeartBeat setting green icon\n");
94
117
midiTrackInfo->_midiDetect = true;
547
565
track->setInPortMask(val);
570
//---------------------------------------------------------
571
// routingPopupMenuActivated
572
//---------------------------------------------------------
574
void Arranger::routingPopupMenuActivated(int n)
576
//if(gRoutingPopupMenuMaster != this || !track || !track->isMidiTrack())
577
if(!midiTrackInfo || gRoutingPopupMenuMaster != midiTrackInfo || !selected || !selected->isMidiTrack())
580
//if (n >= MIDI_PORTS * MIDI_CHANNELS) { // p3.3.50
581
// for (int i = 0; i < MIDI_CHANNELS; i++)
582
//muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n-1000));
583
// muse->routingPopupMenuActivated(selected, i + MIDI_CHANNELS * (n - MIDI_PORTS * MIDI_CHANNELS)); // p3.3.50
586
muse->routingPopupMenuActivated(selected, n);
590
//---------------------------------------------------------
592
//---------------------------------------------------------
594
void Arranger::inRoutesPressed()
599
///song->chooseMidiRoutes(midiTrackInfo->iRButton, (MidiTrack*)selected, false);
601
if(!selected->isMidiTrack())
604
//song->chooseMidiRoutes(iR, (MidiTrack*)track, false);
605
PopupMenu* pup = muse->prepareRoutingPopupMenu(selected, false);
610
//gRoutingPopupMenuMaster = this;
611
gRoutingPopupMenuMaster = midiTrackInfo;
612
connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
613
// Nope, can't clear menu and mm list in there, sub-menus stay open. Never mind for now...
614
connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
615
pup->popup(QCursor::pos(), 0);
616
midiTrackInfo->iRButton->setDown(false);
620
//---------------------------------------------------------
622
//---------------------------------------------------------
624
void Arranger::outRoutesPressed()
629
///song->chooseMidiRoutes(midiTrackInfo->oRButton, (MidiTrack*)selected, true);
631
if(!selected->isMidiTrack())
634
//song->chooseMidiRoutes(iR, (MidiTrack*)track, false);
635
PopupMenu* pup = muse->prepareRoutingPopupMenu(selected, true);
640
//gRoutingPopupMenuMaster = this;
641
gRoutingPopupMenuMaster = midiTrackInfo;
642
connect(pup, SIGNAL(activated(int)), SLOT(routingPopupMenuActivated(int)));
643
// Nope, can't clear menu and mm list in there, sub-menus stay open. Never mind for now...
644
connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide()));
645
pup->popup(QCursor::pos(), 0);
646
midiTrackInfo->oRButton->setDown(false);
551
650
//---------------------------------------------------------
552
651
// iProgHBankChanged
1124
1223
//connect(midiTrackInfo->iName, SIGNAL(returnPressed()), SLOT(iNameChanged()));
1126
1225
connect(midiTrackInfo->iOutputChannel, SIGNAL(valueChanged(int)), SLOT(iOutputChannelChanged(int)));
1127
connect(midiTrackInfo->iInputChannel, SIGNAL(textChanged(const QString&)), SLOT(iInputChannelChanged(const QString&)));
1226
///connect(midiTrackInfo->iInputChannel, SIGNAL(textChanged(const QString&)), SLOT(iInputChannelChanged(const QString&)));
1128
1227
connect(midiTrackInfo->iHBank, SIGNAL(valueChanged(int)), SLOT(iProgHBankChanged()));
1129
1228
connect(midiTrackInfo->iLBank, SIGNAL(valueChanged(int)), SLOT(iProgLBankChanged()));
1130
1229
connect(midiTrackInfo->iProgram, SIGNAL(valueChanged(int)), SLOT(iProgramChanged()));
1141
1240
connect(midiTrackInfo->iPan, SIGNAL(valueChanged(int)), SLOT(iPanChanged(int)));
1142
1241
connect(midiTrackInfo->iPan, SIGNAL(doubleClicked()), SLOT(iPanDoubleClicked()));
1143
1242
connect(midiTrackInfo->iOutput, SIGNAL(activated(int)), SLOT(iOutputPortChanged(int)));
1144
connect(midiTrackInfo->iInput, SIGNAL(textChanged(const QString&)), SLOT(iInputPortChanged(const QString&)));
1243
///connect(midiTrackInfo->iInput, SIGNAL(textChanged(const QString&)), SLOT(iInputPortChanged(const QString&)));
1145
1244
connect(midiTrackInfo->recordButton, SIGNAL(clicked()), SLOT(recordClicked()));
1146
1245
connect(midiTrackInfo->progRecButton, SIGNAL(clicked()), SLOT(progRecClicked()));
1147
1246
connect(midiTrackInfo->volRecButton, SIGNAL(clicked()), SLOT(volRecClicked()));
1148
1247
connect(midiTrackInfo->panRecButton, SIGNAL(clicked()), SLOT(panRecClicked()));
1149
1248
connect(midiTrackInfo->recEchoButton, SIGNAL(toggled(bool)), SLOT(recEchoToggled(bool)));
1249
connect(midiTrackInfo->iRButton, SIGNAL(pressed()), SLOT(inRoutesPressed()));
1251
// TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values...
1252
midiTrackInfo->oRButton->setEnabled(false);
1253
connect(midiTrackInfo->oRButton, SIGNAL(pressed()), SLOT(outRoutesPressed()));
1151
1255
connect(heartBeatTimer, SIGNAL(timeout()), SLOT(midiTrackInfoHeartBeat()));
1163
1267
if(flags == SC_MIDI_CONTROLLER)
1270
// p3.3.47 Update the routing popup menu if anything relevant changes.
1271
//if(gRoutingPopupMenuMaster == midiTrackInfo && selected && (flags & (SC_ROUTE | SC_CHANNELS | SC_CONFIG)))
1272
if(flags & (SC_ROUTE | SC_CHANNELS | SC_CONFIG)) // p3.3.50
1273
// Use this handy shared routine.
1274
//muse->updateRouteMenus(selected);
1275
muse->updateRouteMenus(selected, midiTrackInfo); // p3.3.50
1166
1277
// Added by Tim. p3.3.9
1167
1278
setTrackInfoLabelText();
1168
1279
setTrackInfoLabelFont();
1171
1282
int outChannel = track->outChannel();
1172
int inChannel = track->inChannelMask();
1283
///int inChannel = track->inChannelMask();
1173
1284
int outPort = track->outPort();
1174
1285
//int inPort = track->inPortMask();
1175
unsigned int inPort = track->inPortMask();
1286
///unsigned int inPort = track->inPortMask();
1177
midiTrackInfo->iInput->clear();
1288
//midiTrackInfo->iInput->clear();
1178
1289
midiTrackInfo->iOutput->clear();
1180
1291
for (int i = 0; i < MIDI_PORTS; ++i) {