Struct launchy::launchpad_s::Output

source ·
pub struct Output { /* private fields */ }
Expand description

The Launchpad S output connection handler.

Double buffering

To make more economical use of data, the Launchpad has a feature called double buffering. Essentially, Launchpad manages two sets of LED data - buffers - for each pad. By default, these are configured so that the buffer that is updated by incoming MIDI messages is the same as the one that is visible, so that note-on messages immediately change their respective pads. However, the buffers can also be configured so that Launchpad’s LED status is updated invisibly. With a single command, these buffers can then be swapped. The pads will instantly update to show their pre-programmed state, while the pads can again be updated invisibly ready for the next swap. The visible buffer can alternatively be configured to swap automatically at 280ms intervals in order to configure LEDs to flash.

Implementations§

source§

impl Output

source

pub fn set_button( &mut self, button: Button, color: Color, d: DoubleBufferingBehavior ) -> Result<(), MidiError>

Updates the state for a single LED, specified by button. The color, as well as the double buffering attributes, are specified in light_state.

source

pub fn set_button_rapid( &mut self, color1: Color, dbb1: DoubleBufferingBehavior, color2: Color, dbb2: DoubleBufferingBehavior ) -> Result<(), MidiError>

In order to make maximum use of the original Launchpad’s slow midi speeds, a rapid LED lighting mode was invented which allows the lighting of two leds in just a single message. To use this mode, simply start sending these message and the Launchpad will update the 8x8 grid in left-to-right, top-to-bottom order, then the eight scene launch buttons in top-to-bottom order, and finally the eight Automap/Live buttons in left-to-right order (these are otherwise inaccessible using note-on messages). Overflowing data will be ignored.

To leave the mode, simply send any other message. Sending another kind of message and then re-sending this message will reset the cursor to the top left of the grid.

source

pub fn turn_on_all_leds( &mut self, brightness: Brightness ) -> Result<(), MidiError>

Turns on all LEDs to a certain brightness, dictated by the brightness parameter. According to the Launchpad documentation, sending this command resets various configuration settings - see reset() for more information. However, in my experience, that only sometimes happens. Weird.

This function is primarily intended as a diagnostics tool to verify that the library and the device is working correctly.

source

pub fn set_duty_cycle( &mut self, numerator: u8, denominator: u8 ) -> Result<(), MidiError>

Launchpad controls the brightness of its LEDs by continually switching them on and off faster than the eye can see: a technique known as multiplexing. This command provides a way of altering the proportion of time for which the LEDs are on while they are in low- and medium-brightness modes. This proportion is known as the duty cycle.

Manipulating this is useful for fade effects, for adjusting contrast, and for creating custom palettes.

The default duty cycle is 1/5 meaning that low-brightness LEDs are on for only every fifth multiplex pass, and medium-brightness LEDs are on for two passes in every five. Generally, lower duty cycles (numbers closer to zero) will increase contrast between different brightness settings but will also increase flicker; higher ones will eliminate flicker, but will also reduce contrast. Note that using less simple ratios (such as 3/17 or 2/11) can also increase perceived flicker.

If you are particularly sensitive to strobing lights, please use this command with care when working with large areas of low-brightness LEDs: in particular, avoid duty cycles of 1/8 or less.

source

pub fn control_double_buffering( &mut self, d: DoubleBuffering ) -> Result<(), MidiError>

This method controls the double buffering mode on the Launchpad. See the module documentation for an explanation on double buffering.

The default state is no flashing; the first buffer is both the update and the displayed buffer: In this mode, any LED data written to Launchpad is displayed instantly. Sending this message also resets the flash timer, so it can be used to resynchronise the flash rates of all the Launchpads connected to a system.

  • If copy is set, copy the LED states from the new displayed buffer to the new updating buffer.
  • If flash is set, continually flip displayed buffers to make selected LEDs flash.
  • updated: the new updated buffer
  • displayed: the new displayed buffer
source

pub fn request_device_inquiry( &mut self, query: DeviceIdQuery ) -> Result<(), MidiError>

source

pub fn request_version_inquiry(&mut self) -> Result<(), MidiError>

source

pub fn scroll_text( &mut self, text: &[u8], color: Color, should_loop: bool ) -> Result<(), MidiError>

source

pub fn reset(&mut self) -> Result<(), MidiError>

All LEDs are turned off, and the mapping mode, buffer settings, and duty cycle are reset to their default values.

source

pub fn set_all_buttons( &mut self, color: Color, dbb: DoubleBufferingBehavior ) -> Result<(), MidiError>

source

pub fn light(&mut self, button: Button, color: Color) -> Result<(), MidiError>

source

pub fn light_all_rapid(&mut self, color: Color) -> Result<(), MidiError>

Trait Implementations§

source§

impl OutputDevice for Output

source§

const MIDI_CONNECTION_NAME: &'static str = "Launchy S output"

source§

const MIDI_DEVICE_KEYWORD: &'static str = "Launchpad S"

source§

fn from_connection(connection: MidiOutputConnection) -> Result<Self, MidiError>

Initiate from an existing midir connection.
source§

fn send(&mut self, bytes: &[u8]) -> Result<(), MidiError>

source§

fn guess() -> Result<Self, MidiError>

Auto Trait Implementations§

§

impl !RefUnwindSafe for Output

§

impl Send for Output

§

impl !Sync for Output

§

impl Unpin for Output

§

impl UnwindSafe for Output

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.