Skip to content

Commit c7fe8f1

Browse files
committed
Use serde_bytes to deserialize MIDI data
For some reason this doesn't seem to work without
1 parent b6ac1cf commit c7fe8f1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lighthouse-protocol/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ license.workspace = true
1313
rand = "0.8"
1414
rmpv = { version = "1.0.1", features = ["with-serde"] }
1515
serde = { version = "1.0", features = ["derive"] }
16+
serde_bytes = "0.11.17"
1617
serde_with = "3.4"
1718

1819
[dev-dependencies]

lighthouse-protocol/src/input/midi_event.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
33
use super::EventSource;
44

55
/// A MIDI message event.
6-
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
6+
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
77
pub struct MidiEvent {
88
/// The client identifier. Also unique per MIDI input device.
99
pub source: EventSource,
@@ -30,5 +30,6 @@ pub struct MidiEvent {
3030
/// - https://www.w3.org/TR/webmidi/#terminology
3131
/// - http://www.opensound.com/pguide/midi/midi5.html
3232
/// - https://www.songstuff.com/recording/article/midi-message-format/
33+
#[serde(with = "serde_bytes")]
3334
pub data: Vec<u8>,
3435
}

0 commit comments

Comments
 (0)