Coder Social home page Coder Social logo

Comments (6)

tttapa avatar tttapa commented on July 20, 2024

The callback is in the Control_Surface_ class. There's no user-accessable callback at the moment, but I'll add one tonight.

from control-surface.

ransa808 avatar ransa808 commented on July 20, 2024

amazing, thank you

from control-surface.

tttapa avatar tttapa commented on July 20, 2024

Added it in e786d11

You can use it like this:

#include <Control_Surface.h> // Include the Control Surface library

USBDebugMIDI_Interface midi;

bool realTimeMessageCallback(uint8_t message) {
    Serial << "Real-Time message: " << hex << message << dec << endl;
    return true;  // Return true to indicate that handling is done, 
                  // and Control_Surface shouldn't handle it anymore.
                  // If you want Control_Surface to handle it as well, 
                  // return false.
}

void setup() {
    Serial.begin(115200);
    Control_Surface.begin();
    Control_Surface.setMIDIInputCallbacks(nullptr, 
                                          nullptr, 
                                          realTimeMessageCallback);
}

void loop() {
    Control_Surface.loop();
}

Documentation here: https://tttapa.github.io/Control-Surface/Doc/Doxygen/dc/d45/classControl__Surface__.html#ac9f7e995df0b998287da442587f73e1b

from control-surface.

ransa808 avatar ransa808 commented on July 20, 2024

Works amazing, thank you very much

from control-surface.

tttapa avatar tttapa commented on July 20, 2024

I'm going to reopen it for now, because I'll have to add the MIDI Cable Number as a parameter.

from control-surface.

tttapa avatar tttapa commented on July 20, 2024

I added the Cable Number in f9455f8.

#include <Control_Surface.h> // Include the Control Surface library
USBDebugMIDI_Interface midi;
bool realTimeMessageCallback(RealTimeMessage rt) {
Serial << F("Real-Time message: ") << hex << rt.message << dec
<< F(" on cable ") << rt.CN << endl;
return true; // Return true to indicate that handling is done,
// and Control_Surface shouldn't handle it anymore.
// If you want Control_Surface to handle it as well,
// return false.
}
void setup() {
Serial.begin(115200);
Control_Surface.begin();
Control_Surface.setMIDIInputCallbacks(nullptr,
nullptr,
realTimeMessageCallback);
}
void loop() {
Control_Surface.loop();
}

from control-surface.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.