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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//! Sans-IO protocol library for Behringer `DeepMind` synthesizers.
//!
//! This crate models the `DeepMind` MIDI protocol and nothing else. It never opens a
//! port, never spawns a thread and never blocks. The host application owns the
//! transport, feeds inbound bytes in and sends outbound bytes out.
//!
//! ```text
//! DeepMind <--MIDI--> host application <--bytes--> deepmind-midi
//! ```
//!
//! # Layout
//!
//! | Module | Responsibility |
//! |---------------|--------------------------------------------------------------------|
//! | [`ids`] | Addressing primitives: device ID, model, bank, program number |
//! | [`error`] | Crate-wide error type |
//! | [`wire`] | MIDI bytes: running status, channel messages, `SysEx` reassembly |
//! | [`sysex`] | `DeepMind` framing, the packed MS-bit codec, typed messages |
//! | [`param`] | The 242 program parameters: names, ranges, value tables, NRPN |
//! | [`effect`] | What an effect engine's twelve bytes are, per algorithm |
//! | [`front`] | What the instrument's own front panel puts a control under |
//! | [`generator`] | The shapes a set of parameters makes, for a host that draws them |
//! | [`pixels`] | The one-bit grid of the marks, the source cells and the glyphs |
//! | [`program`] | A program: the 242 bytes, typed accessors, names, value types |
//! | [`syx`] | `.syx` files: the programs a preset pack carries, and building one |
//! | [`device`] | The state machine: what the synthesizer holds, and what to send |
//! | `transport` | The blocking adapter over a port and a clock (feature `transport`) |
//! | `sim` | The other end of the conversation, for tests (feature `sim`) |
//!
//! Each layer depends only on those above it: [`wire`] does not know what a
//! `DeepMind` is, and [`sysex`] does not know where its bytes came from.
//!
//! ```
//! use deepmind_midi::ids::DeviceId;
//! use deepmind_midi::sysex::{Frame, Message};
//! use deepmind_midi::wire::{Decoder, Event};
//!
//! // Bytes off a port, in whatever chunks they arrived in.
//! let mut decoder: Decoder = Decoder::new();
//! decoder.feed(&[0xF0, 0x00, 0x20, 0x32, 0x20, 0x00, 0x03, 0xF7], |event| {
//! if let Ok(Event::SysEx(bytes)) = event {
//! let frame = Frame::parse(bytes).expect("a DeepMind frame");
//! assert_eq!(frame.device, DeviceId::Unit(0));
//! assert_eq!(frame.message, Message::EditBufferDumpRequest);
//! }
//! });
//! ```
//!
//! See [`docs/architecture.md`] for the design and [`docs/midi-spec.md`] for the
//! protocol itself.
//!
//! [`docs/architecture.md`]: https://github.com/MysteriousWolf/deepmind-midi/blob/main/docs/architecture.md
//! [`docs/midi-spec.md`]: https://github.com/MysteriousWolf/deepmind-midi/blob/main/docs/midi-spec.md
//!
//! # Feature flags
//!
//! - `std` (default): implies `alloc`, and adds [`transport::StdClock`] when
//! `transport` is on. The error types implement [`core::error::Error`] with
//! or without it.
//! - `alloc`: APIs that allocate, such as bank decoding and `.syx` handling.
//! - `serde`: `Serialize`/`Deserialize` derives on the public data types.
//! - `transport`: the blocking adapter, which is the one part of this crate that
//! knows what IO is. Needs neither `std` nor an allocator.
//! - `sim`: a synthesizer to talk to, for testing a host without one plugged in.
//! - `descriptions`: what a parameter or an effect slot *does*, in a sentence.
//! [`param::ParamId::description`] and [`effect::FxSlot::description`] answer
//! `None` without it and a sentence with it, so a host writes one code path
//! and an embedded build carries no prose.
extern crate alloc;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Transport;
pub use ;