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

Conversation

@devin-ai-integration
Copy link
Contributor

Fix Property Message Serialization to Match Kotlin Implementation

Problem

The C++ MIDI-CI tool was sending corrupt GetPropertyData messages that triggered NAK responses when connected to ktmidi-ci-tool. The root cause was that the C++ implementation used custom serialization logic that didn't follow the MIDI-CI specification properly.

Solution

This PR fixes the Property message serialization by aligning it with the Kotlin reference implementation:

Key Changes Made:

  1. Fixed MessageType enum values - Corrected incorrect hex values in Message.hpp:

    • SetPropertyData: 0x35 → 0x36
    • SetPropertyDataReply: 0x36 → 0x37
    • SubscribeProperty: 0x36 → 0x38
    • SubscribePropertyReply: 0x37 → 0x39
    • PropertyNotify: 0x38 → 0x3F
  2. Added proper MIDI-CI chunking protocol - Implemented serialize_property_chunks() function in MidiCIConstants.hpp that matches the Kotlin midiCIPropertyChunks() implementation with:

    • Proper header structure with numChunks and chunkIndex
    • 7-bit integer encoding functions
    • Correct chunk size handling
  3. Rewrote all Property message serialize() methods - Updated serialization for:

    • GetPropertyData and GetPropertyDataReply
    • SetPropertyData and SetPropertyDataReply
    • SubscribeProperty and SubscribePropertyReply

Technical Details:

  • Added serialize_7bit_int14() and serialize_property_common() helper functions
  • Replaced custom serialization with proper MIDI-CI property chunking protocol
  • Ensured all Property messages use consistent header format with MIDI-CI version byte
  • Maintained backward compatibility for single-packet messages

Testing

  • Successfully built the project with cmake and make
  • All compilation completed without errors or warnings related to the changes
  • Verified that the modified Message.cpp compiles correctly with the new chunking functions

Link to Devin run

https://app.devin.ai/sessions/42a4dd18eab74348af056c6b31db4ae5

Requested by

Atsushi Eno (atsushieno@gmail.com)

- Fix MessageType enum values for Property messages
- Add proper MIDI-CI property chunking protocol functions
- Rewrite all Property message serialize() methods to use chunking
- Add 7-bit integer encoding functions matching Kotlin implementation

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 b2d921d into main Jun 16, 2025
@atsushieno atsushieno deleted the devin/1750097301-fix-property-message-serialization 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