@@ -49,6 +49,8 @@ AeolusAudioProcessorEditor::AeolusAudioProcessorEditor (AeolusAudioProcessor& p)
4949 , _volumeLevelL{p.getEngine ().getVolumeLevel ().left , ui::LevelIndicator::Orientation::Horizontal}
5050 , _volumeLevelR{p.getEngine ().getVolumeLevel ().right , ui::LevelIndicator::Orientation::Horizontal}
5151 , _tuningButton{" tuningButton" , DrawableButton::ImageFitted}
52+ , _mtsConnectedLabel{{}, " connected to MTS master" }
53+ , _mtsDisconnectedLabel{{}, " no MTS master found" }
5254 , _panicButton{" PANIC" }
5355 , _cancelButton{" Cancel" }
5456 , _midiControlChannelLabel{{}, {" Control" }}
@@ -132,19 +134,26 @@ AeolusAudioProcessorEditor::AeolusAudioProcessorEditor (AeolusAudioProcessor& p)
132134
133135 _tuningButton.onClick = [this ] {
134136 auto content = std::make_unique<ui::GlobalTuningComponent>();
135- content->setSize (240 , 144 );
137+ content->setSize (240 , 182 );
136138 auto * contentPtr = content.get ();
137139
138140 auto & box = CallOutBox::launchAsynchronously (std::move (content), _tuningButton.getBounds (), this );
139141 contentPtr->onCancel = [&box] { box.dismiss (); };
140142 contentPtr->onOk = [&box, contentPtr] {
143+ auto * g = aeolus::EngineGlobal::getInstance ();
144+ const bool mtsWasEnabled{ g->isMTSEnabled () };
145+ bool mtsChanged{ contentPtr->isMTSTuningEnabled () != mtsWasEnabled };
146+
141147 const float freq = contentPtr->getTuningFrequency ();
142148 const auto scaleType = contentPtr->getTuningScaleType ();
143149
144- auto * g = aeolus::EngineGlobal::getInstance ();
145- const bool changed = (g->getTuningFrequency () != freq) || (g->getScale ().getType () != scaleType);
150+ const bool scaleChanged = (g->getTuningFrequency () != freq) || (g->getScale ().getType () != scaleType);
146151
147- if (changed) {
152+ if (mtsChanged) {
153+ g->setMTSEnabled (contentPtr->isMTSTuningEnabled ());
154+ }
155+
156+ if (scaleChanged) {
148157 g->setTuningFrequency (freq);
149158 g->setScaleType (scaleType);
150159 g->rebuildRankwaves ();
@@ -155,6 +164,12 @@ AeolusAudioProcessorEditor::AeolusAudioProcessorEditor (AeolusAudioProcessor& p)
155164 };
156165 };
157166
167+ addAndMakeVisible (_mtsConnectedLabel);
168+ addAndMakeVisible (_mtsDisconnectedLabel);
169+
170+ _mtsConnectedLabel.setColour (Label::textColourId, Colour (204 , 255 , 204 ));
171+ _mtsDisconnectedLabel.setColour (Label::textColourId, Colour (255 , 204 , 204 ));
172+
158173 _panicButton.setColour (TextButton::textColourOffId, Colour (0xFF , 0xFF , 0xFF ));
159174 _panicButton.setColour (TextButton::buttonColourId, Colour (0xCC , 0x33 , 0x00 ));
160175 addAndMakeVisible (_panicButton);
@@ -276,6 +291,9 @@ void AeolusAudioProcessorEditor::resized()
276291
277292 _tuningButton.setBounds (_volumeSlider.getRight () + 40 , margin - 2 , 24 , 24 );
278293
294+ _mtsConnectedLabel.setBounds (_tuningButton.getRight () + 40 , margin, 160 , 20 );
295+ _mtsDisconnectedLabel.setBounds (_mtsConnectedLabel.getBounds ());
296+
279297 _panicButton.setBounds (getWidth () - 90 , margin, 50 , 20 );
280298
281299 constexpr int T = margin * 2 + 20 ;
@@ -341,13 +359,25 @@ void AeolusAudioProcessorEditor::populateDivisions()
341359
342360void AeolusAudioProcessorEditor::refresh ()
343361{
362+ updateMTS ();
344363 updateMeters ();
345364 updateDivisionViews ();
346365 updateSequencerView ();
347366 updateMidiKeyboardRange ();
348367 updateMidiKeyboardKeySwitches ();
349368}
350369
370+ void AeolusAudioProcessorEditor::updateMTS ()
371+ {
372+ auto * g = aeolus::EngineGlobal::getInstance ();
373+
374+ const bool mtsEnabled{ g->isMTSEnabled () };
375+ const bool mtsConnected{ g->isConnectedToMTSMaster () };
376+
377+ _mtsConnectedLabel.setVisible (mtsEnabled && mtsConnected);
378+ _mtsDisconnectedLabel.setVisible (mtsEnabled && !mtsConnected);
379+ }
380+
351381void AeolusAudioProcessorEditor::updateMeters ()
352382{
353383 auto strLoad = String (int (_audioProcessor.getProcessLoad () * 100 .0f )) + " %" ;
0 commit comments