|
| 1 | +--- a/JuceLibraryCode/modules/juce_midi_ci/ci/juce_CIProfileDelegate.h |
| 2 | ++++ b/JuceLibraryCode/modules/juce_midi_ci/ci/juce_CIProfileDelegate.h |
| 3 | +@@ -56,6 +56,10 @@ |
| 4 | + [[maybe_unused]] ProfileAtAddress profileAtAddress, |
| 5 | + [[maybe_unused]] int numChannels, |
| 6 | + [[maybe_unused]] bool enabled) = 0; |
| 7 | ++ |
| 8 | ++ virtual std::vector<std::byte> profileDetailsInquired ([[maybe_unused]] MUID x, |
| 9 | ++ [[maybe_unused]] ProfileAtAddress profileAtAddress, |
| 10 | ++ [[maybe_unused]] std::byte target) { return std::vector<std::byte>(); } |
| 11 | + }; |
| 12 | + |
| 13 | + } // namespace juce::midi_ci |
| 14 | +--- a/JuceLibraryCode/modules/juce_midi_ci/ci/juce_CIDevice.cpp |
| 15 | ++++ b/JuceLibraryCode/modules/juce_midi_ci/ci/juce_CIDevice.cpp |
| 16 | +@@ -1057,7 +1057,16 @@ |
| 17 | + |
| 18 | + device.profileHost->setProfileEnablement (profileAtAddress, enabled ? jmax (1, numChannels) : 0); |
| 19 | + } |
| 20 | ++ |
| 21 | ++ virtual std::vector<std::byte> profileDetailsInquired (MUID x, ProfileAtAddress profileAtAddress, std::byte target) override |
| 22 | ++ { |
| 23 | ++ if (auto* d = device.options.getProfileDelegate()) |
| 24 | ++ return d->profileDetailsInquired (x, profileAtAddress, target); |
| 25 | ++ |
| 26 | ++ return std::vector<std::byte>(); |
| 27 | ++ } |
| 28 | + |
| 29 | ++ |
| 30 | + private: |
| 31 | + Impl& device; |
| 32 | + }; |
| 33 | +--- a/JuceLibraryCode/modules/juce_midi_ci/ci/juce_CIProfileHost.cpp |
| 34 | ++++ b/JuceLibraryCode/modules/juce_midi_ci/ci/juce_CIProfileHost.cpp |
| 35 | +@@ -111,23 +111,37 @@ |
| 36 | + |
| 37 | + bool messageReceived (const Message::ProfileDetails& body) const |
| 38 | + { |
| 39 | ++ const auto address = ChannelAddress{}.withGroup (output->getIncomingGroup()) |
| 40 | ++ .withChannel (output->getIncomingHeader().deviceID); |
| 41 | ++ const ProfileAtAddress profileAtAddress { body.profile, address }; |
| 42 | ++ |
| 43 | + if (body.target == std::byte{}) |
| 44 | + { |
| 45 | +- const auto address = ChannelAddress{}.withGroup (output->getIncomingGroup()) |
| 46 | +- .withChannel (output->getIncomingHeader().deviceID); |
| 47 | +- const ProfileAtAddress profileAtAddress { body.profile, address }; |
| 48 | + const auto state = host->getState (profileAtAddress); |
| 49 | + std::vector<std::byte> extraData; |
| 50 | + detail::Marshalling::Writer { extraData } (state.active, state.supported); |
| 51 | +- detail::MessageTypeUtils::send (*output, Message::ProfileDetailsResponse { body.profile, body.target, extraData }); |
| 52 | ++ sendProfileDetailsResponse(body, extraData); |
| 53 | + } |
| 54 | + else |
| 55 | + { |
| 56 | +- detail::MessageTypeUtils::sendNAK (*output, std::byte { 0x04 }); |
| 57 | ++ const auto extraData = host->delegate.profileDetailsInquired(output->getIncomingHeader().source, profileAtAddress, body.target); |
| 58 | ++ if (extraData.empty()) |
| 59 | ++ { |
| 60 | ++ detail::MessageTypeUtils::sendNAK (*output, std::byte { 0x04 }); |
| 61 | ++ } |
| 62 | ++ else |
| 63 | ++ { |
| 64 | ++ sendProfileDetailsResponse(body, extraData); |
| 65 | ++ } |
| 66 | + } |
| 67 | + |
| 68 | + return true; |
| 69 | + } |
| 70 | ++ |
| 71 | ++ void sendProfileDetailsResponse (const Message::ProfileDetails& body, const std::vector<std::byte>& extraData) const |
| 72 | ++ { |
| 73 | ++ detail::MessageTypeUtils::send (*output, Message::ProfileDetailsResponse { body.profile, body.target, extraData }); |
| 74 | ++ } |
| 75 | + |
| 76 | + template <typename Body> |
| 77 | + bool profileEnablementReceived (const Body& request) const |
0 commit comments