diff --git a/Source/Processors/Editors/MessageCenterEditor.cpp b/Source/Processors/Editors/MessageCenterEditor.cpp index df82482ad9561a677bee7c187627b563e1d6cdbf..92972ce10d4e7417a4122286bd9f1b01d11795c3 100644 --- a/Source/Processors/Editors/MessageCenterEditor.cpp +++ b/Source/Processors/Editors/MessageCenterEditor.cpp @@ -26,8 +26,8 @@ MessageCenterEditor::MessageCenterEditor(MessageCenter* owner) : AudioProcessorEditor(owner), messageCenter(owner), - incomingBackground(Colours::grey.withAlpha(0.5f)), - outgoingBackground(Colours::grey.withAlpha(0.5f)) + incomingBackground(100, 100, 100), + outgoingBackground(100, 100, 100) { incomingMessageDisplayArea = new Label("Message Display Area","No new messages."); @@ -53,16 +53,96 @@ MessageCenterEditor::~MessageCenterEditor() void MessageCenterEditor::buttonClicked(Button* button) { messageCenter->setParameter(1,1); + } void MessageCenterEditor::labelTextChanged(Label* label) { + if (label == incomingMessageDisplayArea) + { + incomingBackground = Colours::orange; + startTimer(20); + } } void MessageCenterEditor::timerCallback() { + uint8 defaultValue = 100; + + uint8 inRed = incomingBackground.getRed(); + uint8 inGreen = incomingBackground.getGreen(); + uint8 inBlue = incomingBackground.getBlue(); + + uint8 outRed = outgoingBackground.getRed(); + uint8 outGreen = outgoingBackground.getGreen(); + uint8 outBlue = outgoingBackground.getBlue(); + + bool shouldRepaint = false; + + if (inGreen > defaultValue) + { + inGreen -= 1; shouldRepaint = true; + } + else if (inGreen < defaultValue) + { + inGreen += 1; shouldRepaint = true; + } + + if (inRed > defaultValue) + { + inRed -= 1; shouldRepaint = true; + } + else if (inRed < defaultValue) + { + inRed += 1; shouldRepaint = true; + } + + if (inBlue > defaultValue) + { + inBlue -= 1; shouldRepaint = true; + } + else if (inBlue < defaultValue) + { + inBlue += 1; shouldRepaint = true; + } + + if (outGreen > defaultValue) + { + outGreen -= 1; shouldRepaint = true; + } + else if (outGreen < defaultValue) + { + outGreen += 1; shouldRepaint = true; + } + + if (outRed > defaultValue) + { + outRed -= 1; shouldRepaint = true; + } + else if (outRed < defaultValue) + { + outRed += 1; shouldRepaint = true; + } + + if (outBlue > defaultValue) + { + outBlue -= 1; shouldRepaint = true; + } + else if (outBlue < defaultValue) + { + outBlue += 1; shouldRepaint = true; + } + + incomingBackground = Colour(inRed, inGreen, inBlue); + outgoingBackground = Colour(outRed, outGreen, outBlue); + + if (shouldRepaint) + repaint(); + else + stopTimer(); + } bool MessageCenterEditor::keyPressed(const KeyPress& key) @@ -90,10 +170,14 @@ void MessageCenterEditor::messageReceived(bool state) { if (!state) { - incomingMessageDisplayArea->setText("FAIL.", dontSendNotification); + incomingMessageDisplayArea->setText("Cannot save messages when recording is not active.", sendNotification); + incomingBackground = Colours::red; } else { - incomingMessageDisplayArea->setText("SUCCESS!", dontSendNotification); + incomingMessageDisplayArea->setText("Message sent.", sendNotification); + incomingBackground = Colours::green; } + + startTimer(20); } void MessageCenterEditor::paint(Graphics& g) @@ -128,11 +212,10 @@ void MessageCenterEditor::resized() void MessageCenterEditor::actionListenerCallback(const String& message) { - incomingMessageDisplayArea->setText(message, dontSendNotification); + incomingMessageDisplayArea->setText(message, sendNotification); incomingBackground = Colours::orange; - - repaint(); + startTimer(20); } diff --git a/Source/Processors/RecordNode.cpp b/Source/Processors/RecordNode.cpp index 8c1f3ab552e57b117e164f45c341a92e849755e0..93a707b52f80f5bfaaf60066f08a3d55c5d89a55 100755 --- a/Source/Processors/RecordNode.cpp +++ b/Source/Processors/RecordNode.cpp @@ -492,6 +492,9 @@ void RecordNode::handleEvent(int eventType, MidiMessage& event, int samplePositi memcpy(×tamp, dataptr + 4, 8); // remember to skip first four bytes EVERY_ENGINE->updateTimeStamp(timestamp); + } else if (eventType == MESSAGE) + { + std::cout << "Received event!" << std::endl; } }