这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Fix MUID serialization regression by changing 7-bit to 8-bit shifts

Problem

PR #22 introduced a regression in MUID (MIDI Unique Identifier) serialization where deserialization incorrectly used 7-bit shifts (<< 7, << 14, << 21) instead of proper 8-bit shifts (<< 8, << 16, << 24). This caused MUID values to be treated as packed 28-bit values instead of proper 32-bit values.

Solution

Fixed all MUID deserialization in src/midi-ci/messages/Messenger.cpp by changing:

  • source_muid and dest_muid parsing (lines 236-237)
  • target_muid parsing in INVALIDATE_MUID messages (line 269)
  • max_sysex parsing in DISCOVERY_REPLY and DISCOVERY_INQUIRY messages (lines 258, 376)

Changes Made

  • ✅ Changed << 7, << 14, << 21 to << 8, << 16, << 24 for MUID fields
  • ✅ Maintained 7-bit shifts for non-MUID fields (channels, header_size) as they are intentional per MIDI-CI protocol
  • ✅ Ensured consistency with serialize_muid_32() function which uses 8-bit shifts for serialization
  • ✅ Verified changes match test expectations in test_message_serialization.cpp

Testing

The changes ensure MUID serialization and deserialization are consistent:

  • Serialization: serialize_muid_32() uses >> 8, >> 16, >> 24
  • Deserialization: Now correctly uses << 8, << 16, << 24
  • Test validation: InvalidateMUIDSerialize test expects 8-bit shift pattern

Link to Devin run

https://app.devin.ai/sessions/309658372ab54a69ab1a3d7dce83412f

Requested by: Atsushi Eno (atsushieno@gmail.com)

- Change MUID deserialization from << 7, << 14, << 21 to << 8, << 16, << 24
- Fix source_muid, dest_muid, target_muid, and max_sysex parsing
- Maintain 7-bit shifts for non-MUID fields (channels, header_size)
- Ensures 32-bit MUID values are properly reconstructed instead of packed 28-bit values
- Addresses regression introduced in PR #22

Co-Authored-By: Atsushi Eno <atsushieno@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@atsushieno atsushieno merged commit f68550a into main Jun 16, 2025
@atsushieno atsushieno deleted the devin/1750064207-fix-muid-serialization-regression branch June 19, 2025 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants