|
15 | 15 |
|
16 | 16 | #include "playmode-sub-panel.h" |
17 | 17 | #include <sst/jucegui/layouts/ListLayout.h> |
| 18 | +#include "libMTSClient.h" |
18 | 19 |
|
19 | 20 | namespace baconpaul::six_sines::ui |
20 | 21 | { |
@@ -175,6 +176,15 @@ PlayModeSubPanel::PlayModeSubPanel(SixSinesEditor &e) : HasEditor(e) |
175 | 176 | }; |
176 | 177 | addAndMakeVisible(*voiceLimit); |
177 | 178 |
|
| 179 | + mtsTitle = std::make_unique<jcmp::RuledLabel>(); |
| 180 | + mtsTitle->setText("MTS"); |
| 181 | + addAndMakeVisible(*mtsTitle); |
| 182 | + mtsStatusLabel = std::make_unique<jcmp::Label>(); |
| 183 | + mtsStatusLabel->setText("No MTS"); |
| 184 | + mtsStatusLabel->setJustification(juce::Justification::centred); |
| 185 | + mtsStatusLabel->setEnabled(false); |
| 186 | + addAndMakeVisible(*mtsStatusLabel); |
| 187 | + |
178 | 188 | panicTitle = std::make_unique<jcmp::RuledLabel>(); |
179 | 189 | panicTitle->setText("Panic"); |
180 | 190 | panicButton = std::make_unique<jcmp::TextPushButton>(); |
@@ -280,6 +290,8 @@ void PlayModeSubPanel::resized() |
280 | 290 | col4.add(jlo::Component(*mpeActiveButton).withHeight(uicLabelHeight)); |
281 | 291 | col4.add(jlo::Component(*mpeRange).withHeight(uicLabelHeight)); |
282 | 292 | col4.add(jlo::Component(*mpeRangeL).withHeight(uicLabelHeight)); |
| 293 | + col4.add(titleLabelGaplessLayout(mtsTitle)); |
| 294 | + col4.add(jlo::Component(*mtsStatusLabel).withHeight(uicLabelHeight)); |
283 | 295 | col4.add(titleLabelGaplessLayout(panicTitle)); |
284 | 296 | col4.add(jlo::Component(*panicButton).withHeight(uicLabelHeight)); |
285 | 297 | topRow.add(col4); |
@@ -494,4 +506,31 @@ void PlayModeSubPanel::setPolyLimit(int plVal) |
494 | 506 | voiceLimit->repaint(); |
495 | 507 | } |
496 | 508 |
|
| 509 | +void PlayModeSubPanel::updateMTSStatus() |
| 510 | +{ |
| 511 | + if (++mtsIdleCount < 50) |
| 512 | + return; |
| 513 | + mtsIdleCount = 0; |
| 514 | + |
| 515 | + auto *cli = editor.mtsClient; |
| 516 | + bool connected = cli && MTS_HasMaster(cli); |
| 517 | + std::string text; |
| 518 | + if (connected) |
| 519 | + { |
| 520 | + const char *name = MTS_GetScaleName(cli); |
| 521 | + text = (name && *name) ? std::string(name) : std::string("Connected"); |
| 522 | + } |
| 523 | + else |
| 524 | + { |
| 525 | + text = "No MTS"; |
| 526 | + } |
| 527 | + |
| 528 | + if (connected != mtsConnected || text != mtsStatusLabel->getText()) |
| 529 | + { |
| 530 | + mtsConnected = connected; |
| 531 | + mtsStatusLabel->setEnabled(connected); |
| 532 | + mtsStatusLabel->setText(text); |
| 533 | + } |
| 534 | +} |
| 535 | + |
497 | 536 | } // namespace baconpaul::six_sines::ui |
0 commit comments