Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions midi2/src/channel_voice2/per_note_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub(crate) const STATUS: u8 = 0b1111;
/// MIDI 2.0 Channel Voice Per Note Management Message
///
/// See the [module docs](crate::channel_voice2) for more info.
#[midi2_proc::generate_message(Via(crate::channel_voice2::ChannelVoice2), FixedSize, MinSizeUmp(1))]
#[midi2_proc::generate_message(Via(crate::channel_voice2::ChannelVoice2), FixedSize, MinSizeUmp(2))]
struct PerNoteManagement {
#[property(common_properties::UmpMessageTypeProperty<UMP_MESSAGE_TYPE>)]
ump_type: (),
Expand Down Expand Up @@ -49,7 +49,7 @@ mod tests {
#[test]
fn note_number() {
assert_eq!(
PerNoteManagement::try_from(&[0x4BF9_1C03][..])
PerNoteManagement::try_from(&[0x4BF9_1C03, 0x0][..])
.unwrap()
.note_number(),
u7::new(0x1C),
Expand All @@ -58,14 +58,14 @@ mod tests {

#[test]
fn detach() {
assert!(PerNoteManagement::try_from(&[0x4BF9_1C03][..])
assert!(PerNoteManagement::try_from(&[0x4BF9_1C03, 0x0][..])
.unwrap()
.detach(),);
}

#[test]
fn reset() {
assert!(PerNoteManagement::try_from(&[0x4BF9_1C03][..])
assert!(PerNoteManagement::try_from(&[0x4BF9_1C03, 0x0][..])
.unwrap()
.reset(),);
}
Expand Down
5 changes: 3 additions & 2 deletions midi2/src/flex_data.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ mod tests {

#[test]
fn try_from_set_tempo() {
let buffer = [0xD710_0000_u32, 0xF751_FE05];
let buffer = [0xD710_0000_u32, 0xF751_FE05, 0x0, 0x0];
assert_eq!(
FlexData::try_from(&buffer[..]),
Ok(FlexData::SetTempo(
Expand All @@ -1235,8 +1235,9 @@ mod tests {

#[test]
fn read_bank() {
// Set Tempo
assert_eq!(
FlexData::try_from(&[0xD710_0000_u32, 0xF751_FE05][..])
FlexData::try_from(&[0xD710_0000_u32, 0xF751_FE05, 0x0, 0x0][..])
.unwrap()
.bank(),
Bank::SetupAndPerformance,
Expand Down
14 changes: 7 additions & 7 deletions midi2/src/flex_data/set_key_signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const STATUS: u8 = 0x5;
/// MIDI 2.0 Flex Data Set Key Signature Message
///
/// See the [module docs](crate::flex_data) for more info.
#[midi2_proc::generate_message(Via(crate::flex_data::FlexData), FixedSize, MinSizeUmp(2))]
#[midi2_proc::generate_message(Via(crate::flex_data::FlexData), FixedSize, MinSizeUmp(4))]
struct SetKeySignature {
#[property(common_properties::UmpMessageTypeProperty<UMP_MESSAGE_TYPE>)]
ump_type: (),
Expand Down Expand Up @@ -147,7 +147,7 @@ mod tests {
#[test]
fn tonic() {
assert_eq!(
SetKeySignature::try_from(&[0xD410_0005, 0x5400_0000][..])
SetKeySignature::try_from(&[0xD410_0005, 0x5400_0000, 0x0, 0x0][..])
.unwrap()
.tonic(),
flex_data::tonic::Tonic::D,
Expand All @@ -157,7 +157,7 @@ mod tests {
#[test]
fn sharps_flats() {
assert_eq!(
SetKeySignature::try_from(&[0xD410_0005, 0x5400_0000][..])
SetKeySignature::try_from(&[0xD410_0005, 0x5400_0000, 0x0, 0x0][..])
.unwrap()
.sharps_flats(),
SharpsFlats::Sharps(u3::new(5)),
Expand All @@ -167,7 +167,7 @@ mod tests {
#[test]
fn sharps_flats_with_flats() {
assert_eq!(
SetKeySignature::try_from(&[0xD410_0005, 0xB400_0000][..])
SetKeySignature::try_from(&[0xD410_0005, 0xB400_0000, 0x0, 0x0][..])
.unwrap()
.sharps_flats(),
SharpsFlats::Flats(u3::new(5)),
Expand All @@ -177,7 +177,7 @@ mod tests {
#[test]
fn sharps_flats_non_standard() {
assert_eq!(
SetKeySignature::try_from(&[0xD410_0005, 0x8000_0000][..])
SetKeySignature::try_from(&[0xD410_0005, 0x8000_0000, 0x0, 0x0][..])
.unwrap()
.sharps_flats(),
SharpsFlats::NonStandard,
Expand All @@ -187,7 +187,7 @@ mod tests {
#[test]
fn channel() {
assert_eq!(
SetKeySignature::try_from(&[0xD40D_0005, 0x8000_0000][..])
SetKeySignature::try_from(&[0xD40D_0005, 0x8000_0000, 0x0, 0x0][..])
.unwrap()
.optional_channel(),
Some(u4::new(0xD)),
Expand All @@ -197,7 +197,7 @@ mod tests {
#[test]
fn no_channel() {
assert_eq!(
SetKeySignature::try_from(&[0xD410_0005, 0x8000_0000][..])
SetKeySignature::try_from(&[0xD410_0005, 0x8000_0000, 0x0, 0x0][..])
.unwrap()
.optional_channel(),
None,
Expand Down
14 changes: 7 additions & 7 deletions midi2/src/flex_data/set_metronome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const STATUS: u8 = 0x2;
/// MIDI 2.0 Flex Data Set Metronome Message
///
/// See the [module docs](crate::flex_data) for more info.
#[midi2_proc::generate_message(Via(crate::flex_data::FlexData), FixedSize, MinSizeUmp(3))]
#[midi2_proc::generate_message(Via(crate::flex_data::FlexData), FixedSize, MinSizeUmp(4))]
struct SetMetronome {
#[property(common_properties::UmpMessageTypeProperty<UMP_MESSAGE_TYPE>)]
ump_type: (),
Expand Down Expand Up @@ -81,7 +81,7 @@ mod tests {
#[test]
fn number_of_clocks_per_primary_click() {
assert_eq!(
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000][..])
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000, 0x0][..])
.unwrap()
.number_of_clocks_per_primary_click(),
0x9B,
Expand All @@ -91,7 +91,7 @@ mod tests {
#[test]
fn bar_accent1() {
assert_eq!(
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000][..])
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000, 0x0][..])
.unwrap()
.bar_accent1(),
0x4A,
Expand All @@ -101,7 +101,7 @@ mod tests {
#[test]
fn bar_accent2() {
assert_eq!(
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000][..])
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000, 0x0][..])
.unwrap()
.bar_accent2(),
0xFE,
Expand All @@ -111,7 +111,7 @@ mod tests {
#[test]
fn bar_accent3() {
assert_eq!(
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000][..])
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000, 0x0][..])
.unwrap()
.bar_accent3(),
0x56,
Expand All @@ -121,7 +121,7 @@ mod tests {
#[test]
fn number_of_subdivision_clicks1() {
assert_eq!(
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000][..])
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000, 0x0][..])
.unwrap()
.number_of_subdivision_clicks1(),
0xB8,
Expand All @@ -131,7 +131,7 @@ mod tests {
#[test]
fn number_of_subdivision_clicks2() {
assert_eq!(
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000][..])
SetMetronome::try_from(&[0xD110_0002, 0x9B4A_FE56, 0xB81B_0000, 0x0][..])
.unwrap()
.number_of_subdivision_clicks2(),
0x1B,
Expand Down
4 changes: 2 additions & 2 deletions midi2/src/flex_data/set_tempo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const STATUS: u8 = 0x0;
/// MIDI 2.0 Flex Data Set Tempo Message
///
/// See the [module docs](crate::flex_data) for more info.
#[midi2_proc::generate_message(Via(crate::flex_data::FlexData), FixedSize, MinSizeUmp(2))]
#[midi2_proc::generate_message(Via(crate::flex_data::FlexData), FixedSize, MinSizeUmp(4))]
struct SetTempo {
#[property(common_properties::UmpMessageTypeProperty<UMP_MESSAGE_TYPE>)]
ump_type: (),
Expand Down Expand Up @@ -48,7 +48,7 @@ mod tests {
#[test]
fn number_of_10_nanosecond_units_per_quarter_note() {
assert_eq!(
SetTempo::try_from(&[0xD710_0000, 0xF751_FE05,][..])
SetTempo::try_from(&[0xD710_0000, 0xF751_FE05, 0x0, 0x0][..])
.unwrap()
.number_of_10_nanosecond_units_per_quarter_note(),
0xF751FE05,
Expand Down
12 changes: 6 additions & 6 deletions midi2/src/flex_data/set_time_signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const STATUS: u8 = 0x1;
/// MIDI 2.0 Flex Data Set Time Signature Message
///
/// See the [module docs](crate::flex_data) for more info.
#[midi2_proc::generate_message(Via(crate::flex_data::FlexData), FixedSize, MinSizeUmp(2))]
#[midi2_proc::generate_message(Via(crate::flex_data::FlexData), FixedSize, MinSizeUmp(4))]
struct SetTimeSignature {
#[property(common_properties::UmpMessageTypeProperty<UMP_MESSAGE_TYPE>)]
ump_type: (),
Expand Down Expand Up @@ -63,7 +63,7 @@ mod tests {
#[test]
fn numerator() {
assert_eq!(
SetTimeSignature::try_from(&[0xDA10_0001, 0xCD90_7E00,][..])
SetTimeSignature::try_from(&[0xDA10_0001, 0xCD90_7E00, 0x0, 0x0][..])
.unwrap()
.numerator(),
0xCD,
Expand All @@ -73,7 +73,7 @@ mod tests {
#[test]
fn denominator() {
assert_eq!(
SetTimeSignature::try_from(&[0xDA10_0001, 0xCD90_7E00,][..])
SetTimeSignature::try_from(&[0xDA10_0001, 0xCD90_7E00, 0x0, 0x0][..])
.unwrap()
.denominator(),
0x90,
Expand All @@ -83,7 +83,7 @@ mod tests {
#[test]
fn number_of_32nd_notes() {
assert_eq!(
SetTimeSignature::try_from(&[0xDA10_0001, 0xCD90_7E00,][..])
SetTimeSignature::try_from(&[0xDA10_0001, 0xCD90_7E00, 0x0, 0x0][..])
.unwrap()
.number_of_32nd_notes(),
0x7E,
Expand All @@ -93,7 +93,7 @@ mod tests {
#[test]
fn bank() {
assert_eq!(
SetTimeSignature::try_from(&[0xDA10_0001, 0xCD90_7E00,][..])
SetTimeSignature::try_from(&[0xDA10_0001, 0xCD90_7E00, 0x0, 0x0][..])
.unwrap()
.bank(),
flex_data::Bank::SetupAndPerformance,
Expand All @@ -103,7 +103,7 @@ mod tests {
#[test]
fn status() {
assert_eq!(
SetTimeSignature::try_from(&[0xDA10_0001, 0xCD90_7E00,][..])
SetTimeSignature::try_from(&[0xDA10_0001, 0xCD90_7E00, 0x0, 0x0][..])
.unwrap()
.status(),
STATUS,
Expand Down
6 changes: 3 additions & 3 deletions midi2/src/ump_stream/end_of_clip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{detail::common_properties, ump_stream, ump_stream::UMP_MESSAGE_TYPE}

pub(crate) const STATUS: u16 = 0x21;

#[midi2_proc::generate_message(Via(ump_stream::UmpStream), FixedSize, MinSizeUmp(1))]
#[midi2_proc::generate_message(Via(ump_stream::UmpStream), FixedSize, MinSizeUmp(4))]
struct EndOfClip {
#[property(common_properties::UmpMessageTypeProperty<UMP_MESSAGE_TYPE>)]
ump_type: (),
Expand All @@ -28,8 +28,8 @@ mod tests {
#[test]
fn from_data() {
assert_eq!(
EndOfClip::try_from(&[0xF021_0000][..]),
Ok(EndOfClip(&[0xF021_0000][..]))
EndOfClip::try_from(&[0xF021_0000, 0x0, 0x0, 0x0][..]),
Ok(EndOfClip(&[0xF021_0000, 0x0, 0x0, 0x0][..]))
);
}
}
16 changes: 8 additions & 8 deletions midi2/src/ump_stream/endpoint_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{

pub(crate) const STATUS: u16 = 0x0;

#[midi2_proc::generate_message(Via(ump_stream::UmpStream), FixedSize, MinSizeUmp(2))]
#[midi2_proc::generate_message(Via(ump_stream::UmpStream), FixedSize, MinSizeUmp(4))]
struct EndpointDiscovery {
#[property(common_properties::UmpMessageTypeProperty<UMP_MESSAGE_TYPE>)]
ump_type: (),
Expand Down Expand Up @@ -54,7 +54,7 @@ mod tests {
#[test]
fn ump_version_major() {
assert_eq!(
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F][..])
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F, 0x0, 0x0][..])
.unwrap()
.ump_version_major(),
0x1,
Expand All @@ -64,7 +64,7 @@ mod tests {
#[test]
fn ump_version_minor() {
assert_eq!(
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F][..])
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F, 0x0, 0x0][..])
.unwrap()
.ump_version_minor(),
0x1,
Expand All @@ -74,7 +74,7 @@ mod tests {
#[test]
fn request_endpoint_info() {
assert_eq!(
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F][..])
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F, 0x0, 0x0][..])
.unwrap()
.request_endpoint_info(),
true,
Expand All @@ -84,7 +84,7 @@ mod tests {
#[test]
fn request_device_identity() {
assert_eq!(
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F][..])
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F, 0x0, 0x0][..])
.unwrap()
.request_device_identity(),
true,
Expand All @@ -94,7 +94,7 @@ mod tests {
#[test]
fn request_endpoint_name() {
assert_eq!(
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F][..])
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F, 0x0, 0x0][..])
.unwrap()
.request_endpoint_name(),
true,
Expand All @@ -104,7 +104,7 @@ mod tests {
#[test]
fn request_product_instance_id() {
assert_eq!(
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F][..])
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F, 0x0, 0x0][..])
.unwrap()
.request_product_instance_id(),
true,
Expand All @@ -114,7 +114,7 @@ mod tests {
#[test]
fn request_stream_configuration() {
assert_eq!(
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F][..])
EndpointDiscovery::try_from(&[0xF000_0101, 0x0000_001F, 0x0, 0x0][..])
.unwrap()
.request_stream_configuration(),
true,
Expand Down
Loading
Loading