midi2/channel_voice1/
program_change.rs1use crate::{
2 channel_voice1::UMP_MESSAGE_TYPE,
3 detail::{common_properties, schema},
4};
5
6pub(crate) const STATUS: u8 = 0b1100;
7
8#[midi2_proc::generate_message(
12 Via(crate::channel_voice1::ChannelVoice1),
13 FixedSize,
14 MinSizeUmp(1),
15 MinSizeBytes(2)
16)]
17struct ProgramChange {
18 #[property(common_properties::UmpMessageTypeProperty<UMP_MESSAGE_TYPE>)]
19 ump_type: (),
20 #[property(common_properties::ChannelVoiceStatusProperty<STATUS>)]
21 status: (),
22 #[property(common_properties::ChannelProperty)]
23 channel: crate::ux::u4,
24 #[property(common_properties::GroupProperty)]
25 group: crate::ux::u4,
26 #[property(common_properties::HybridSchemaProperty<
27 crate::ux::u7,
28 schema::Bytes<0x00, 0x7F, 0x0>,
29 schema::Ump<0x0000_7F00, 0x0, 0x0, 0x0>,
30 >)]
31 program: crate::ux::u7,
32}
33
34#[cfg(test)]
35mod tests {
36 use super::*;
37 use crate::{
38 traits::{Channeled, Grouped},
39 ux::*,
40 };
41 use pretty_assertions::assert_eq;
42
43 #[test]
44 fn builder() {
45 let mut message = ProgramChange::<[u32; 4]>::new();
46 message.set_group(u4::new(0x4));
47 message.set_channel(u4::new(0x7));
48 message.set_program(u7::new(0x63));
49 assert_eq!(message, ProgramChange([0x24C7_6300, 0x0, 0x0, 0x0]));
50 }
51}