mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
UMP: Migrate to std::byte
This commit is contained in:
parent
f1f68007c6
commit
78a12d2f57
13 changed files with 230 additions and 191 deletions
|
|
@ -82,9 +82,9 @@ struct U32ToBytestreamHandler : public U32InputHandler
|
|||
|
||||
void pushMidiData (const uint32_t* begin, const uint32_t* end, double time) override
|
||||
{
|
||||
dispatcher.dispatch (begin, end, time, [this] (const MidiMessage& m)
|
||||
dispatcher.dispatch (begin, end, time, [this] (const BytestreamMidiView& m)
|
||||
{
|
||||
callback.handleIncomingMidiMessage (&input, m);
|
||||
callback.handleIncomingMidiMessage (&input, m.getMessage());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace CoreMidiHelpers
|
|||
{
|
||||
virtual ~SenderBase() noexcept = default;
|
||||
|
||||
virtual void send (MIDIPortRef port, MIDIEndpointRef endpoint, const MidiMessage& m) = 0;
|
||||
virtual void send (MIDIPortRef port, MIDIEndpointRef endpoint, const ump::BytestreamMidiView& m) = 0;
|
||||
virtual void send (MIDIPortRef port, MIDIEndpointRef endpoint, ump::Iterator b, ump::Iterator e) = 0;
|
||||
|
||||
virtual ump::MidiProtocol getProtocol() const noexcept = 0;
|
||||
|
|
@ -88,7 +88,7 @@ namespace CoreMidiHelpers
|
|||
: umpConverter (getProtocolForEndpoint (ep))
|
||||
{}
|
||||
|
||||
void send (MIDIPortRef port, MIDIEndpointRef endpoint, const MidiMessage& m) override
|
||||
void send (MIDIPortRef port, MIDIEndpointRef endpoint, const ump::BytestreamMidiView& m) override
|
||||
{
|
||||
newSendImpl (port, endpoint, m);
|
||||
}
|
||||
|
|
@ -182,7 +182,7 @@ namespace CoreMidiHelpers
|
|||
{
|
||||
explicit Sender (MIDIEndpointRef) {}
|
||||
|
||||
void send (MIDIPortRef port, MIDIEndpointRef endpoint, const MidiMessage& m) override
|
||||
void send (MIDIPortRef port, MIDIEndpointRef endpoint, const ump::BytestreamMidiView& m) override
|
||||
{
|
||||
oldSendImpl (port, endpoint, m);
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ namespace CoreMidiHelpers
|
|||
{
|
||||
std::for_each (b, e, [&] (const ump::View& v)
|
||||
{
|
||||
bytestreamConverter.convert (v, 0.0, [&] (const MidiMessage& m)
|
||||
bytestreamConverter.convert (v, 0.0, [&] (const ump::BytestreamMidiView& m)
|
||||
{
|
||||
send (port, endpoint, m);
|
||||
});
|
||||
|
|
@ -206,7 +206,7 @@ namespace CoreMidiHelpers
|
|||
private:
|
||||
ump::ToBytestreamConverter bytestreamConverter { 2048 };
|
||||
|
||||
void oldSendImpl (MIDIPortRef port, MIDIEndpointRef endpoint, const MidiMessage& message)
|
||||
void oldSendImpl (MIDIPortRef port, MIDIEndpointRef endpoint, const ump::BytestreamMidiView& message)
|
||||
{
|
||||
#if JUCE_IOS
|
||||
const MIDITimeStamp timeStamp = mach_absolute_time();
|
||||
|
|
@ -217,7 +217,7 @@ namespace CoreMidiHelpers
|
|||
HeapBlock<MIDIPacketList> allocatedPackets;
|
||||
MIDIPacketList stackPacket;
|
||||
auto* packetToSend = &stackPacket;
|
||||
auto dataSize = (size_t) message.getRawDataSize();
|
||||
auto dataSize = message.bytes.size();
|
||||
|
||||
if (message.isSysEx())
|
||||
{
|
||||
|
|
@ -234,7 +234,7 @@ namespace CoreMidiHelpers
|
|||
{
|
||||
p->timeStamp = timeStamp;
|
||||
p->length = (UInt16) jmin (maxPacketSize, bytesLeft);
|
||||
memcpy (p->data, message.getRawData() + pos, p->length);
|
||||
memcpy (p->data, message.bytes.data() + pos, p->length);
|
||||
pos += p->length;
|
||||
bytesLeft -= p->length;
|
||||
p = MIDIPacketNext (p);
|
||||
|
|
@ -254,7 +254,7 @@ namespace CoreMidiHelpers
|
|||
auto& p = *(packetToSend->packet);
|
||||
p.timeStamp = timeStamp;
|
||||
p.length = (UInt16) dataSize;
|
||||
memcpy (p.data, message.getRawData(), dataSize);
|
||||
memcpy (p.data, message.bytes.data(), dataSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -278,7 +278,7 @@ namespace CoreMidiHelpers
|
|||
: sender (makeImpl (ep))
|
||||
{}
|
||||
|
||||
void send (MIDIPortRef port, MIDIEndpointRef endpoint, const MidiMessage& m)
|
||||
void send (MIDIPortRef port, MIDIEndpointRef endpoint, const ump::BytestreamMidiView& m)
|
||||
{
|
||||
sender->send (port, endpoint, m);
|
||||
}
|
||||
|
|
@ -379,7 +379,7 @@ namespace CoreMidiHelpers
|
|||
endpoint.release();
|
||||
}
|
||||
|
||||
void send (const MidiMessage& m)
|
||||
void send (const ump::BytestreamMidiView& m)
|
||||
{
|
||||
sender.send (*port, *endpoint, m);
|
||||
}
|
||||
|
|
@ -1298,7 +1298,7 @@ MidiOutput::~MidiOutput()
|
|||
|
||||
void MidiOutput::sendMessageNow (const MidiMessage& message)
|
||||
{
|
||||
internal->send (message);
|
||||
internal->send (ump::BytestreamMidiView (&message));
|
||||
}
|
||||
|
||||
MidiDeviceListConnection MidiDeviceListConnection::make (std::function<void()> cb)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue