Lume
    Preparing search index...

    Class DrumPadGrid

    DrumPadGrid generates a grid of square buttons, meant to represent the soft rectangular pads you would see on a MIDI controller.

    Hierarchy (View Summary)

    Index

    Accessors

    • get boostThreshold(): number

      Returns the amount of time (in milleseconds) that a button takes to transition from it's boosted size and color to it's regular held values when it's activated.

      Returns number

    • set boostThreshold(value: number): void

      Sets the amount of time (in milleseconds) that a button takes to transition from it's boosted size and color to it's regular held values when it's activated.

      Value must be a positive number.

      Parameters

      • value: number

      Returns void

    • get gridHeight(): number

      Returns the amount of buttons in each column.

      Returns number

    • set gridHeight(value: number): void

      Sets the amount of buttons that appear in each column.

      Parameters

      • value: number

      Returns void

      Value must be greater than zero.

    • get gridWidth(): number

      Returns the amount of buttons in each row.

      Returns number

    • set gridWidth(value: number): void

      Sets the amount of buttons that appear in each row.

      Parameters

      • value: number

      Returns void

      Value must be greater than zero.

    • get isFadeToBackground(): boolean

      Returns the isFadeToBackground flag, which if true, fades buttons immediately to the idle color rather than holding.

      Returns boolean

    • set isFadeToBackground(value: boolean): void

      Sets the isFadeToBackground flag.

      Set this property to true if you want to represent MIDI notes without sustain, typically on percussive instruments.

      Note that notes will immediately render as inactive if the note duration is shorter than the boost threshold, as it cannot track notes that aren't currently being played.

      Parameters

      • value: boolean

      Returns void

    • get padWidth(): number

      Returns the width (in pixels) of an individual drum pad.

      Returns number

    • set padWidth(value: number): void

      Sets the width (in pixels) for each drum pad.

      Parameters

      • value: number

      Returns void

      Value must be greater than zero.

    • get ringThickness(): number

      Returns the width (in pixels) for the ring that separates the core of each button from the edge.

      Returns number

    • set ringThickness(value: number): void

      Sets the width (in pixels) for the ring that separates the core of each button from the edge. Setting the ring thickness to a value of zero will make the button a circle.

      Parameters

      • value: number

      Returns void

      Value must be zero or greater.

    • get rootNote(): number

      Returns the root note -- the lowest note that can be read.

      Returns number

    • set rootNote(value: number): void

      Sets the root note.

      Parameters

      • value: number

      Returns void

      Value must be greater than zero.

    • get sizeBoost(): number

      Returns the amount (in pixels) that the buttons increase when hit.

      Returns number

    • set sizeBoost(value: number): void

      Sets the amount (in pixels) that the buttons increase when hit.

      Value must be greater or equal to zero. Setting this value to zero means that the buttons never change in size.

      Parameters

      • value: number

      Returns void

    • get voidThickness(): number

      Returns the width (in pixels) for the border that is inbetween the core of the button and the ring around it.

      Returns number

    • set voidThickness(value: number): void

      Sets the width (in pixels) for the border that is inbetween the core of a button and the ring around it.

      If this value is zero, there will be no gap whatsoever and the button will appear to be a flat square.

      Parameters

      • value: number

      Returns void

      Value must be zero or greater.

    Constructors

    Methods

    • Called by the rendering engine on every frame.

      When overriding this method, ensure that the p5 instance is configured properly. For example, rectangles may be drawn incorrectly if a previous CanvasDrawer had modified p5.rectMode(). CanvasDrawer classes are not obligated/expected to use the default p5 attributes.

      See the p5 documentation on attributes for more information: https://p5js.org/reference/#Attributes

      Returns void