[−][src]Trait launchy::DeviceSpec
Launchpad's implement this trait to signify how they can be used as a Canvas
. Based on this
specification, DeviceCanvas
provides a generic Canvas
implemention that can be used for all
devices.
You as a user of this library will not need to use this trait directly.
Associated Types
Loading content...Associated Constants
const BOUNDING_BOX_WIDTH: u32
The width of the smallest rectangle that still fully encapsulates the shape of this device
const BOUNDING_BOX_HEIGHT: u32
The height of the smallest rectangle that still fully encapsulates the shape of this device
const COLOR_PRECISION: u16
How many different colors can be shown per channel. As an example; the MK2 uses 6 bit color, so it supports color values from 0 up to 63 - in total 64 values.
Required methods
fn is_valid(x: u32, y: u32) -> bool
Returns whether the point at the given x
and y
coordinates are in bounds
fn flush(
canvas: &mut DeviceCanvas<Self>,
changes: &[(u32, u32, (u8, u8, u8))]
) -> Result<(), MidiError> where
Self: Sized,
canvas: &mut DeviceCanvas<Self>,
changes: &[(u32, u32, (u8, u8, u8))]
) -> Result<(), MidiError> where
Self: Sized,
Flush the changes, as specified by changes
, to the given underlying output handler.
changes
is a slice of tuples (u32, u32, (u8, u8, u8))
, where the first element is the x
coordinate, the second element is the y coordinate, and the third element is an RGB color
tuple, according to COLOR_PRECISION
.
fn convert_message(
msg: <Self::Input as InputDevice>::Message
) -> Option<CanvasMessage>
msg: <Self::Input as InputDevice>::Message
) -> Option<CanvasMessage>
Convert a message from the underlying input handler into an abstract CanvasMessage. If the low-level message has no CanvasMessage equivalent, i.e. if it's irrelevant in a canvas context, None is returned.
Provided methods
fn setup(output: &mut Self::Output) -> Result<(), MidiError>
Optional code to setup this device for canvas usage