1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! `DeepMind` `SysEx`: framing, the packed MS-bit codec and typed messages.
//!
//! Every `DeepMind` message is framed the same way:
//!
//! ```text
//! F0 00 20 32 20 <device> <command> <payload> F7
//! \______/ \/
//! Behringer model ID, shared by all six variants
//! ```
//!
//! [`Frame::parse`] turns those bytes into a [`Message`], borrowing any bulk
//! payload where it lies rather than copying it. Bulk payloads stay packed:
//! [`packed::unpack_into`] takes them the rest of the way, into a buffer the
//! caller owns.
//!
//! The universal device inquiry is framed differently, since it is a MIDI
//! message rather than a Behringer one, and lives in [`inquiry`].
//!
//! ```
//! use deepmind_midi::ids::DeviceId;
//! use deepmind_midi::sysex::{Frame, Message};
//! use deepmind_midi::wire::{Decoder, Event};
//!
//! let bytes = [0xF0, 0x00, 0x20, 0x32, 0x20, 0x00, 0x03, 0xF7];
//! let mut requests = 0;
//!
//! let mut decoder: Decoder = Decoder::new();
//! decoder.feed(&bytes, |event| {
//! if let Ok(Event::SysEx(frame)) = event {
//! let frame = Frame::parse(frame).expect("a DeepMind frame");
//! assert_eq!(frame.device, DeviceId::Unit(0));
//! if frame.message == Message::EditBufferDumpRequest {
//! requests += 1;
//! }
//! }
//! });
//!
//! assert_eq!(requests, 1);
//! ```
pub use ;
pub use Identity;
pub use ;