Skip to content

Fix ordering and byte size of song position pointer data bytes#28

Merged
jimm merged 1 commit into
jimm:mainfrom
mike-bourgeous:mb-2023-02-05-song-pointer-bytes
Feb 5, 2023
Merged

Fix ordering and byte size of song position pointer data bytes#28
jimm merged 1 commit into
jimm:mainfrom
mike-bourgeous:mb-2023-02-05-song-pointer-bytes

Conversation

@mike-bourgeous
Copy link
Copy Markdown
Contributor

@mike-bourgeous mike-bourgeous commented Feb 5, 2023

Before, SongPointer#data_as_bytes was using 8-bit bytes in big-endian order. But the MIDI spec calls for two 7-bit bytes in little-endian order with LSB first, similar to the pitch bend message.

Related to arirusso/nibbler#5

References used

Before

Note that my program displays new messages at the top, while jack_midi_dump shows new messages at the bottom.

jack_midi_dump midilib
jack_midi_dump song pointer bytes swapped, lsb exceeds 0x7f midilib song pointer broken

After

jack_midi_dump midilib
image image

Before, SongPointer#data_as_bytes was using 8-bit bytes in big-endian
order.  But the MIDI spec calls for two 7-bit bytes in little-endian
order with LSB first, similar to the pitch bend message.

References used:
- https://www.midi.org/specifications-old/item/table-1-summary-of-midi-message
- jack_midi_dump output from a hardware sequencer
@jimm
Copy link
Copy Markdown
Owner

jimm commented Feb 5, 2023

@mike-bourgeous thanks so much for this fix!

@jimm jimm merged commit 19b2c7e into jimm:main Feb 5, 2023
@jimm
Copy link
Copy Markdown
Owner

jimm commented Feb 5, 2023

FYI I've published version 4.0.0, including this fix, on RubyGems. Thanks again for your help.

@mike-bourgeous mike-bourgeous deleted the mb-2023-02-05-song-pointer-bytes branch February 6, 2023 00:54
@mike-bourgeous
Copy link
Copy Markdown
Contributor Author

Awesome, thanks! Glad to help.

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