@@ -89,8 +89,8 @@ MidiConfigDialog::MidiConfigDialog(MidiMapper& mapper, MidiLearnManager* learnMg
8989 {
9090 // Start MIDI Learn for selected parameter (host right-click fallback)
9191 midiLearnMgr->startLearning (paramId,
92- [this , paramId](int cc , int ch) {
93- midiMapper.addMapping (paramId, cc , ch);
92+ [this , paramId](int number , int ch, MidiMsgType type ) {
93+ midiMapper.addMapping (paramId, number , ch, type );
9494 refreshMappingTable ();
9595 });
9696 }
@@ -279,10 +279,21 @@ void MidiConfigDialog::timerCallback()
279279 int count = midiMapper.getMappingCount ();
280280 auto status = midiMapper.getStatus ();
281281 juce::String statusText = juce::String (count) + " mapping" + (count != 1 ? " s" : " " );
282- if (status == MidiMapper::Status::Healthy)
283- statusText += " | Receiving MIDI" ;
284- else if (status == MidiMapper::Status::Failed)
285- statusText += " | Device error" ;
282+ if (midiLearnMgr != nullptr && midiLearnMgr->isLearning ())
283+ {
284+ auto learnParam = midiLearnMgr->getLearningParamId ();
285+ statusText = " Waiting for MIDI... (" + getDisplayNameForParam (learnParam) + " )" ;
286+ statusLabel.setColour (juce::Label::textColourId, juce::Colour (0xff40E070 ));
287+ }
288+ else
289+ {
290+ if (status == MidiMapper::Status::Healthy)
291+ statusText += " | Receiving MIDI" ;
292+ else if (status == MidiMapper::Status::Failed)
293+ statusText += " | Device error" ;
294+ statusLabel.setColour (juce::Label::textColourId,
295+ juce::Colour (JamWideLookAndFeel::kTextSecondary ));
296+ }
286297 statusLabel.setText (statusText, juce::dontSendNotification);
287298}
288299
@@ -297,8 +308,9 @@ void MidiConfigDialog::refreshMappingTable()
297308 for (size_t i = 0 ; i < mappings.size (); ++i)
298309 {
299310 if (mappings[i].paramId != mappingRows[i].paramId
300- || mappings[i].ccNumber != mappingRows[i].ccNumber
301- || mappings[i].midiChannel != mappingRows[i].midiChannel )
311+ || mappings[i].number != mappingRows[i].number
312+ || mappings[i].midiChannel != mappingRows[i].midiChannel
313+ || mappings[i].type != mappingRows[i].type )
302314 {
303315 changed = true ;
304316 break ;
@@ -310,7 +322,7 @@ void MidiConfigDialog::refreshMappingTable()
310322
311323 mappingRows.clear ();
312324 for (const auto & m : mappings)
313- mappingRows.push_back ({m.paramId , m.ccNumber , m.midiChannel });
325+ mappingRows.push_back ({m.paramId , m.number , m.midiChannel , m. type });
314326
315327 rebuildTableRows ();
316328 resized ();
@@ -340,8 +352,11 @@ void MidiConfigDialog::rebuildTableRows()
340352 comp->paramLabel .setColour (juce::Label::backgroundColourId, bgColour);
341353 comp->addAndMakeVisible (comp->paramLabel );
342354
343- // CC#
344- comp->ccLabel .setText (juce::String (row.ccNumber ), juce::dontSendNotification);
355+ // CC# or Note#
356+ juce::String ccText = (row.type == MidiMsgType::Note)
357+ ? (" N" + juce::String (row.number ))
358+ : (" CC" + juce::String (row.number ));
359+ comp->ccLabel .setText (ccText, juce::dontSendNotification);
345360 comp->ccLabel .setFont (juce::FontOptions (12 .0f ));
346361 comp->ccLabel .setColour (juce::Label::textColourId,
347362 juce::Colour (JamWideLookAndFeel::kTextPrimary ));
@@ -372,16 +387,17 @@ void MidiConfigDialog::rebuildTableRows()
372387 comp->learnBtn .setColour (juce::TextButton::buttonColourId, bgColour);
373388 comp->learnBtn .setColour (juce::TextButton::textColourOffId,
374389 juce::Colour (JamWideLookAndFeel::kAccentConnect ));
375- comp->learnBtn .setTooltip (" Re-learn MIDI CC for this parameter" );
390+ comp->learnBtn .setTooltip (" Re-learn MIDI for this parameter" );
376391 juce::String paramIdCopy = row.paramId ;
377392 comp->learnBtn .onClick = [this , paramIdCopy]() {
378393 if (midiLearnMgr != nullptr )
379394 {
380- // Remove existing mapping, then start learn for re-assignment
381- midiMapper.removeMapping (paramIdCopy);
395+ // Start learn for re-assignment. Don't remove existing mapping first --
396+ // addMapping handles last-write-wins replacement, and the row stays
397+ // visible while waiting for MIDI input.
382398 midiLearnMgr->startLearning (paramIdCopy,
383- [this , paramIdCopy](int cc , int ch) {
384- midiMapper.addMapping (paramIdCopy, cc , ch);
399+ [this , paramIdCopy](int number , int ch, MidiMsgType type ) {
400+ midiMapper.addMapping (paramIdCopy, number , ch, type );
385401 refreshMappingTable ();
386402 });
387403 }
0 commit comments