Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/flickernoise
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5606d55
Choose a base ref
...
head repository: m-labs/flickernoise
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fedfe72
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Nov 5, 2011

  1. midi.c: "learn" mode for controllers

    While a miniN tag is being clicked (click button 1 and hold down),
    any incoming controller message will map that MIDI variable to the
    respective controller. This simplified MIDI configuration.
    
    Controls appearing as multiple controllers may need special
    precautions. E.g., an X/Y pad may have three controllers: X, Y, and
    touch/release. X and Y can be distinguished by moving the finger
    and simply stopping when the right value has been taken. To prevent
    release from overriding an X/Y controller, release the mouse button
    before releasing the pad.
    
    Some scenarios may be beyond the capabilities of this simple
    mechanism and require manual setup.
    wpwrak authored and Sebastien Bourdeauducq committed Nov 5, 2011
    Copy the full SHA
    a77d1c9 View commit details
  2. midi.c: use mtk_bindf + style corrections

    Sebastien Bourdeauducq committed Nov 5, 2011
    Copy the full SHA
    fedfe72 View commit details
Showing with 17 additions and 0 deletions.
  1. +17 −0 src/midi.c
17 changes: 17 additions & 0 deletions src/midi.c
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
#include <string.h>
#include <dirent.h>
#include <unistd.h>
#include <assert.h>
#include <mtklib.h>

#include "util.h"
@@ -158,6 +159,7 @@ static int midistr(const char *str)

static int appid;
static struct filedialog *browse_dlg;
static int learn = -1;

static int w_open;

@@ -269,6 +271,8 @@ static void note_event(int code)
static void controller_event(int controller, int value)
{
mtk_cmdf(appid, "l_lastctl.set(-text \"%d (%d)\")", controller, value);
if(learn != -1)
mtk_cmdf(appid, "e_midi%d.set(-text \"%d\")", learn, controller);
}

static void midi_event(mtk_event *e, int count)
@@ -347,6 +351,17 @@ static void addupdate_callback(mtk_event *e, void *arg)
mtk_cmd(appid, "e_filename.set(-text \"\")");
}

static void press_callback(mtk_event *e, void *arg)
{
learn = (int)arg;
assert(learn >= 0 && learn < MIDI_COUNT);
}

static void release_callback(mtk_event *e, void *arg)
{
learn = -1;
}

static int cmpstringp(const void *p1, const void *p2)
{
return strcmp(*(char * const *)p1, *(char * const *)p2);
@@ -537,6 +552,8 @@ void init_midi()
mtk_cmdf(appid, "e_midi%d = new Entry()", i);
mtk_cmdf(appid, "g_vars.place(l_midi%d, -column 1 -row %d)", i, i);
mtk_cmdf(appid, "g_vars.place(e_midi%d, -column 2 -row %d)", i, i);
mtk_bindf(appid, "l_midi%d", "press", press_callback, (void *)i, i);
mtk_bindf(appid, "l_midi%d", "release", release_callback, NULL, i);
}

mtk_bind(appid, "lst_existing", "selchange", selchange_callback, NULL);