Skip to content

PadManager

#include "crosspad/pad/PadManager.hpp"

Generated from crosspad/pad/PadManager.hpp in crosspad-core. Edit the header’s doxygen comments to change this page.

Recipes that use it: Pads and LEDs, Play a sample, MIDI out, Tempo and transport

PadManager & getPadManager()

Platform-injected singleton accessor.

Used in Pads and LEDs, Tempo and transport.

Declared in crosspad/pad/PadManager.hpp:235.

Portable pad manager — input handling, MIDI, LED coordination.

Manages pad interactions, note mapping, pad-logic-handler dispatch, and coordinates PadLedController + PadAnimator. Uses IMidiOutput and IEventBus for platform-independent MIDI output and event posting.

Used in Pads and LEDs, Play a sample, MIDI out, Tempo and transport.

Members

MemberDescription
PadManager
initPlatform only The platform calls it once at start-up (crosspad_platform_init).
beginPlatform only The platform calls it once at start-up (crosspad_platform_init).
updatePlatform only The firmware calls it every 10 ms from its worker task.
setInputSuppressed
isInputSuppressed
allNotesOff
handlePadPressPlatform only source says who pressed: a finger (PadManager, the default) or the loop recorder playing a take back (SequencerCallback).
handlePadRelease
setInputTap
pressSourceWho made the last press or release of padIdx.
handlePadPressure
notifyPadPressure
notifyPadPan
getPadPan
notifyNoteOn
notifyNoteOff
notifySamplePlay
handleMidiNoteOn
handleMidiNoteOff
handleMidiAftertouch
handleSamplePlay
togglePadPlay
isPadPressed
isPadPlaying
setPadColor
setDefaultColor
setPressedColor
setPlayingColor
setPadColor
clearPadColor
setDefaultColor
setPressedColor
setPlayingColor
getPadColor
getPressedColor
getPlayingColor
setBrightness
getBrightness
setFeedbackMode
getFeedbackMode
setCustomColorCallback
loadPadConfig
setPadNote
getPadNote
setChordNote
getChordNote
setPadChannel
getPadChannel
applyDefaultOffsetToPadNotes
getMidiNoteForPad
getPadForMidiNote
getRGBCallbackManager
registerPadLogic
setActivePadLogicDo not call Activate appName’s logic.
setBasePadLogicInstall the system instrument: the logic that owns the pads whenever no app has claimed them, so pads keep playing outside any app.
getBasePadLogic
getActivePadLogic
unregisterPadLogic
getRegisteredPadLogics
getPadLogicThe handler registered under appName, or null.
pushPadLogicDo not call Save the currently active pad logic on an internal stack, then activate appName.
popPadLogicDo not call Re-activate the logic saved by the matching pushPadLogic().
getLedController
getAnimator

Methods

PadManager() = default

Platform only The platform calls it once at start-up (crosspad_platform_init).

void init(PadLedController &ledController, PadAnimator &animator, IMidiOutput &midiOutput, IEventBus &eventBus, CrosspadSettings *settings, CrosspadStatus *status)

Platform only The platform calls it once at start-up (crosspad_platform_init).

void begin()

Platform only The firmware calls it every 10 ms from its worker task.

void update()
void setInputSuppressed(bool suppressed)
bool isInputSuppressed() const
void allNotesOff()

Platform only The pad, MIDI-in and sequencer paths of the firmware and the simulator call it, and the Sampler for its previews. Your app gets presses through its IPadLogicHandler and never calls it.

void handlePadPress(uint8_t padIdx, uint8_t velocity=127, EventSource source=EventSource::PadManager)

source says who pressed: a finger (PadManager, the default) or the loop recorder playing a take back (SequencerCallback).

It travels with the bus events, and pad logic reads it with pressSource().

void handlePadRelease(uint8_t padIdx, EventSource source=EventSource::PadManager)
void setInputTap(InputTap tap, void *ctx)
EventSource pressSource(uint8_t padIdx) const

Who made the last press or release of padIdx.

Per pad, not per call: a take playing pad 3 while a finger holds pad 5 answers each right.

Used in Play a sample.

void handlePadPressure(uint8_t padIdx, uint8_t pressure)
void notifyPadPressure(uint8_t padIdx, uint8_t pressure)
void notifyPadPan(uint8_t padIdx, int8_t pan)
int8_t getPadPan(uint8_t padIdx)
void notifyNoteOn(uint8_t padIdx, uint8_t velocity, bool fromSampler=false)

Used in Play a sample.

void notifyNoteOff(uint8_t padIdx, bool fromSampler=false)

Used in Play a sample.

void notifySamplePlay(uint8_t padIdx, bool isPlaying)
void handleMidiNoteOn(uint8_t channel, uint8_t note, uint8_t velocity)
void handleMidiNoteOff(uint8_t channel, uint8_t note)
void handleMidiAftertouch(uint8_t channel, uint8_t note, uint8_t pressure)
void handleSamplePlay(uint8_t padIdx, bool isPlaying, uint8_t wavIdx=0)
void togglePadPlay(uint8_t padIdx)
bool isPadPressed(uint8_t padIdx)
bool isPadPlaying(uint8_t padIdx)
void setPadColor(uint8_t padIdx, RgbColor color)

Used in Pads and LEDs, MIDI out, Tempo and transport.

void setDefaultColor(RgbColor color)
void setPressedColor(RgbColor color)
void setPlayingColor(RgbColor color)
void setPadColor(uint8_t padIdx, uint8_t r, uint8_t g, uint8_t b)

Used in Pads and LEDs, MIDI out, Tempo and transport.

void clearPadColor(uint8_t padIdx)

Used in Pads and LEDs, MIDI out, Tempo and transport.

void setDefaultColor(uint8_t r, uint8_t g, uint8_t b)
void setPressedColor(uint8_t r, uint8_t g, uint8_t b)
void setPlayingColor(uint8_t r, uint8_t g, uint8_t b)
RgbColor getPadColor(uint8_t padIdx)
RgbColor getPressedColor(uint8_t padIdx)
RgbColor getPlayingColor(uint8_t padIdx)
void setBrightness(uint8_t brightness)
uint8_t getBrightness()
void setFeedbackMode(KeypadFeedbackMode mode)
KeypadFeedbackMode getFeedbackMode()
void setCustomColorCallback(KeypadCustomColorCallback callback)
void loadPadConfig(Pad *pads, uint8_t count)
void setPadNote(uint8_t padIdx, uint8_t note)
uint8_t getPadNote(uint8_t padIdx)
void setChordNote(uint8_t padIdx, uint8_t chordIdx, int8_t note)
int8_t getChordNote(uint8_t padIdx, uint8_t chordIdx)
void setPadChannel(uint8_t padIdx, uint8_t channel)
uint8_t getPadChannel(uint8_t padIdx)
void applyDefaultOffsetToPadNotes()
uint8_t getMidiNoteForPad(uint8_t padIdx)
uint8_t getPadForMidiNote(uint8_t note)
RGBCallbackManager & getRGBCallbackManager()
void registerPadLogic(const std::string &appName, std::shared_ptr< IPadLogicHandler > handler)

Used in Pads and LEDs.

Do not call With REGISTER_APP_PL the framework gives your pad logic the pads while the app is open and takes them back when it closes. Never call this yourself, and never from onActivate or onDeactivate.

void setActivePadLogic(const std::string &appName)

Activate appName’s logic.

An empty name hands the pads to the base logic (see setBasePadLogic()), so they always have a handler.

void setBasePadLogic(const std::string &appName)

Install the system instrument: the logic that owns the pads whenever no app has claimed them, so pads keep playing outside any app.

Apps preempt it through pushPadLogic()/setActivePadLogic() and hand it back on teardown. Pass "" to remove it (pads go silent with no app again).

The handler must stay registered for as long as it is the base — do not unregisterPadLogic() a base handler on app teardown, or the fallback resolves to nothing.

std::string getBasePadLogic() const

Used in Play a sample.

std::string getActivePadLogic() const
void unregisterPadLogic(const std::string &appName)
std::vector< std::string > getRegisteredPadLogics() const
std::shared_ptr< IPadLogicHandler > getPadLogic(const std::string &appName) const

The handler registered under appName, or null.

For a logic that plays through another an app that owns the pads but keeps the base instrument sounding under them.

Used in Play a sample.

Do not call With REGISTER_APP_PL the framework pushes and pops your pad logic. Never call this yourself, and never from onActivate or onDeactivate.

void pushPadLogic(const std::string &appName)

Save the currently active pad logic on an internal stack, then activate appName.

Pair with popPadLogic() — used by screens/apps that overlay a temporary logic and must hand control back on teardown.

Call popPadLogic() before you unregister your own handler.

Do not call pushPadLogic() or setActivePadLogic() from inside a handler’s onActivate() or onDeactivate().

Do not call With REGISTER_APP_PL the framework pops your pad logic when the app closes. Never call this yourself, and never from onActivate or onDeactivate.

void popPadLogic()

Re-activate the logic saved by the matching pushPadLogic().

No-op when the stack is empty. Same unregister-ordering and reentrancy caveats as pushPadLogic() apply — see its doc comment.

PadLedController & getLedController()
PadAnimator & getAnimator()

Declared in crosspad/pad/PadManager.hpp:30.