Skip to content

Commit 25b055e

Browse files
UMP translation with USB MIDI 1.0 endian format fix
Fix of endian formatting when connected as a USB MIDI 1.0 device.
1 parent 18e0746 commit 25b055e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ump_device.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ uint16_t tud_ump_read( uint8_t itf, uint32_t *pkts, uint16_t numAvail )
463463
// write to packets
464464
for (int pktCount = 0; pktCount < umpPacket.wordCount; pktCount++)
465465
{
466-
pkts[numRead++] = umpPacket.umpData.umpWords[pktCount];
466+
pkts[numRead++] = tu_u32(U32_TO_U8S_LE(umpPacket.umpData.umpWords[pktCount]));
467467
}
468468
}
469469
}
@@ -551,7 +551,7 @@ uint16_t tud_ump_write( uint8_t itf, uint32_t *words, uint16_t numWords )
551551
umpPacket.wordCount = 0;
552552

553553
// First determine the size of UMP packet based on message type
554-
umpPacket.umpData.umpWords[0] = words[numProcessed];
554+
umpPacket.umpData.umpWords[0] = tu_u32(U32_TO_U8S_LE(words[numProcessed]));
555555
switch(umpPacket.umpData.umpBytes[0] & UMP_MT_MASK)
556556
{
557557
case UMP_MT_UTILITY :
@@ -597,7 +597,7 @@ uint16_t tud_ump_write( uint8_t itf, uint32_t *words, uint16_t numWords )
597597
// Get rest of words if needed for UMP Packet
598598
for (int count = 1; count < umpPacket.wordCount; count++)
599599
{
600-
umpPacket.umpData.umpWords[count] = words[numProcessed+count];
600+
umpPacket.umpData.umpWords[count] = tu_u32(U32_TO_U8S_LE(words[numProcessed+count]));
601601
}
602602

603603
uint8_t cbl_num = umpPacket.umpData.umpBytes[0] & UMP_GROUP_MASK; // if used, cable num is group block num

0 commit comments

Comments
 (0)