Class MIDIAddress

java.lang.Object
io.github.roboblazers7617.buttonbox.midi.MIDIAddress
All Implemented Interfaces:
Address<Double>, DoubleAddress

public class MIDIAddress extends Object implements DoubleAddress
An DoubleAddress that sends and recieves data over MIDI.
  • Field Details

    • midiDevice

      public final MIDIDevice midiDevice
      MIDIDevice to communicate with.
    • command

      public final int command
      MIDI command to use.
      See Also:
    • channel

      public final int channel
      MIDI channel to communicate on.
    • data1

      public final int data1
      Data1 to use (note number, CC number, etc).
  • Constructor Details

    • MIDIAddress

      public MIDIAddress(MIDIDevice midiDevice, int command, int channel, int data1)
      Creates a new MIDIAddress with the specified command, channel, and data1.
      Parameters:
      midiDevice - MIDIDevice to use.
      command - MIDI command to use.
      channel - MIDI channel to use.
      data1 - Data1 to use (note number, CC number, etc.).
  • Method Details

    • getCommand

      public int getCommand()
      Gets the address's command.
      Returns:
      MIDI command number.
    • getChannel

      public int getChannel()
      Gets the address's channel.
      Returns:
      MIDI channel number.
    • getData1

      public int getData1()
      Gets the address's data1 value.
      Returns:
      Data1 value.
    • send

      public void send(Double data)
      Description copied from interface: DoubleAddress
      Sends data to the address.
      Specified by:
      send in interface Address<Double>
      Specified by:
      send in interface DoubleAddress
      Parameters:
      data - Double between 0 and 1 to send.
    • sendRaw

      public void sendRaw(int data)
      Sends raw data to the address.
      Parameters:
      data - Integer between 0 and 127 to send.
    • getFeedback

      public Optional<Double> getFeedback()
      Description copied from interface: DoubleAddress
      Gets feedback from the address.
      Specified by:
      getFeedback in interface Address<Double>
      Specified by:
      getFeedback in interface DoubleAddress
      Returns:
      Double between 0 and 1 containing control feedback. Empty if no feedback has been recieved.
    • getFeedbackRaw

      public Optional<Integer> getFeedbackRaw()
      Gets feedback from the address.
      Returns:
      Integer between 0 and 127 containing control feedback. Empty if no feedback has been recieved.
    • setFeedbackRaw

      public void setFeedbackRaw(int feedback)
      Sets the feedback for the address. Not intended to be called outside of the MIDIRouter class.
      Parameters:
      feedback - The feedback value to set [0-127].
    • getFeedbackQueue

      public List<Double> getFeedbackQueue()
      Description copied from interface: DoubleAddress
      Gets the changes to the feedback from the address since the last call to this method.
      Specified by:
      getFeedbackQueue in interface Address<Double>
      Specified by:
      getFeedbackQueue in interface DoubleAddress
      Returns:
      Doubles between 0 and 1 containing control feedback changes, ordered from least to most recent. Empty if no feedback has been recieved.
    • getFeedbackQueueRaw

      public List<Integer> getFeedbackQueueRaw()
      Gets changes to the feedback from the address, and clears the queue of changes.
      Returns:
      Integers between 0 and 127 containing control feedback changes, ordered from least to most recent.