From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- third_party/rust/midir/src/lib.rs | 65 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 third_party/rust/midir/src/lib.rs (limited to 'third_party/rust/midir/src/lib.rs') diff --git a/third_party/rust/midir/src/lib.rs b/third_party/rust/midir/src/lib.rs new file mode 100644 index 0000000000..99d6840c33 --- /dev/null +++ b/third_party/rust/midir/src/lib.rs @@ -0,0 +1,65 @@ +extern crate memalloc; + +#[cfg(feature = "jack")] +#[macro_use] extern crate bitflags; + +#[repr(u8)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +/// An enum that is used to specify what kind of MIDI messages should +/// be ignored when receiving messages. +pub enum Ignore { + None = 0x00, + Sysex = 0x01, + Time = 0x02, + SysexAndTime = 0x03, + ActiveSense = 0x04, + SysexAndActiveSense = 0x05, + TimeAndActiveSense = 0x06, + All = 0x07 +} + +impl std::ops::BitOr for Ignore { + type Output = Ignore; + #[inline(always)] + fn bitor(self, rhs: Self) -> Self::Output { + // this is safe because all combinations also exist as variants + unsafe { std::mem::transmute(self as u8 | rhs as u8) } + } +} + +impl Ignore { + #[inline(always)] + pub fn contains(self, other: Ignore) -> bool { + self as u8 & other as u8 != 0 + } +} + +/// A MIDI structure used internally by some backends to store incoming +/// messages. Each message represents one and only one MIDI message. +/// The timestamp is represented as the elapsed microseconds since +/// a point in time that is arbitrary, but does not change for the +/// lifetime of a given MidiInputConnection. +#[derive(Debug, Clone)] +struct MidiMessage { + bytes: Vec, + timestamp: u64 +} + +impl MidiMessage { + fn new() -> MidiMessage { + MidiMessage { + bytes: vec![], + timestamp: 0 + } + } +} + +pub mod os; // include platform-specific behaviour + +mod errors; +pub use errors::*; + +mod common; +pub use common::*; + +mod backend; \ No newline at end of file -- cgit v1.2.3