-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a3ec70
commit 7f2e545
Showing
6 changed files
with
143 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright (c) 2021 Christof Ruch. All rights reserved. | ||
Dual licensed: Distributed under Affero GPL license by default, an MIT license is available for purchase | ||
*/ | ||
|
||
#include "ReceiveManualDumpWindow.h" | ||
|
||
#include "MidiController.h" | ||
|
||
#include "Capability.h" | ||
|
||
ReceiveManualDumpWindow::ReceiveManualDumpWindow(std::shared_ptr<midikraft::Synth> synth) : | ||
ThreadWithProgressWindow("Waiting for sysex messages from " + synth->getName() +"...", false, true, 1000, "Stop"), synth_(synth) | ||
{ | ||
// Create a MIDI log view with a decent size | ||
midiLog_ = std::make_unique<MidiLogView>(false, true); | ||
midiLog_->setSize(800, 400); | ||
|
||
// Add this as a custom component to our AlertWindow | ||
getAlertWindow()->addCustomComponent(midiLog_.get()); | ||
} | ||
|
||
void ReceiveManualDumpWindow::run() | ||
{ | ||
// Determine which MIDI port to listen to | ||
auto locationCap = midikraft::Capability::hasCapability<midikraft::MidiLocationCapability>(synth_); | ||
|
||
auto incomingHandler = midikraft::MidiController::makeOneHandle(); | ||
midikraft::MidiController::instance()->addMessageHandler(incomingHandler, [this, locationCap](MidiInput *source, MidiMessage const &received) { | ||
// Just capture all messages incoming from the devices' input port. That might be too many... | ||
if (!locationCap || locationCap->midiInput() == source->getName()) { | ||
midiLog_->addMessageToList(received, source->getName(), false); | ||
receivedMessages_.push_back(received); | ||
} | ||
}); | ||
|
||
do { | ||
} while (!threadShouldExit()); | ||
} | ||
|
||
std::vector<juce::MidiMessage> ReceiveManualDumpWindow::result() const | ||
{ | ||
return receivedMessages_; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Copyright (c) 2021 Christof Ruch. All rights reserved. | ||
Dual licensed: Distributed under Affero GPL license by default, an MIT license is available for purchase | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "JuceHeader.h" | ||
|
||
#include "Synth.h" | ||
#include "MidiLogView.h" | ||
|
||
|
||
class ReceiveManualDumpWindow : public ThreadWithProgressWindow { | ||
public: | ||
ReceiveManualDumpWindow(std::shared_ptr<midikraft::Synth> synth); | ||
|
||
virtual void run() override; | ||
|
||
std::vector<MidiMessage> result() const; | ||
|
||
private: | ||
std::shared_ptr<midikraft::Synth> synth_; | ||
std::unique_ptr<MidiLogView> midiLog_; | ||
|
||
std::vector<MidiMessage> receivedMessages_; | ||
}; | ||
|
||
|
Submodule juce-widgets
updated
4 files
+11 −8 | LogView.cpp | |
+1 −1 | LogView.h | |
+1 −1 | MidiLogView.cpp | |
+1 −1 | MidiLogView.h |