Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 91 commits
  • 39 files changed
  • 0 comments
  • 1 contributor
Jan 29, 2012
Werner Almesberger renderer/stimuli.c: unified control input handling
This commit provides data structure and basic functions for the unified
control input handling.
3437cec
Werner Almesberger compiler.h: wrap nasty long lines c26922b
Werner Almesberger compiler: include basic elements for unified input events in patch st…
…ructure
97e1457
Werner Almesberger sampler.c: disentangle event_callback
Move pitch and control event handling into separate functions and
expose the logic of prying apart the event code more clearly.
30fa417
Werner Almesberger sampler.c: call stim_midi_ctrl upon reception of a MIDI controller event 53f48ec
Werner Almesberger stimuli: added crude stim_redirect hack to keep pointers valid across…
… copies

Maybe we can actually get rid of most of this copying. But for now,
this should work ... (untested so far, of course)
798fa31
Werner Almesberger eval.c: propagate control variables to patch registers 6c4895f
Werner Almesberger symtab: added "cvar" index to "struct sym" for binding control variables a6d4cc3
Werner Almesberger compiler.c: bind control variables to pfv and pvv registers 2fe2649
Werner Almesberger compiler.c: new function patch_add_cvar to allocate a new control var…
…iable
25b08ca
Werner Almesberger ptest: also link with stimuli.o a9f77a7
Werner Almesberger compiler: added "midi" control variable assignment (WIP) e2bebe0
Werner Almesberger compiler: update pointers after realloc() in patch_add_cvar 6d81665
Jan 30, 2012
Werner Almesberger midi control: added processors for encoders sending acceleration
Processor selection is via a 3rd argument to midi():

- linear: normal linear control (default)
- accel_linear: control sends acceleration data; map to linear
- accel_cyclic: control sends acceleration data; cycle in interval [0, 1]
8553095
Werner Almesberger experimental/T.fnp: Tornado Rain Dance variant for new MIDI control s…
…election

This is only temporary to better track changes.
1dd1b1c
Werner Almesberger controls: removed indirection via cvar array
MIDI input now changes the register array directly. Note that this
means that writing to a control variable changes its value until
the next time it is updated by MIDI. Not sure if this is more
feature or bug.
b4458bc
Werner Almesberger renderer: keep patch_lock around and clear current_patch when stopped
This commit makes renderer_lock_patch, renderer_unlock_patch, and
renderer_get_patch produce meaningful resuls also when the renderer
is not running.
23b34a3
Werner Almesberger sampler.c: only enter patch-specific stimulus processing if we have a…
… patch

Not checking for this crashed FN when running the sampler without
rendering, e.g., in the audio dialog.
f5721eb
Werner Almesberger compiler/stimuli: refuse to assign out of range channel/controller nu…
…mbers
9b64d06
Werner Almesberger compiler: move retrieval of stimuli pointer from parser into compiler.c
A bit cleaner this way.
bcb404d
Werner Almesberger stimuli: rename stim_add to stim_add_midi_ctrl
It's not generic.
e6fa3f6
Werner Almesberger stimuli: added processor for acceleration with an unbounded range
accel_unbounded is (re)settable, as shown in T.fnp
2f337e1
Werner Almesberger stimuli: remember and update base pointer for stim_redirect
Running a patch twice broke direct MIDI because pointers were updated
relative to the previous copy instead of the original patch. The commit
fixed the problem. The overall ugliness of the process remains, though.
c037acc
Werner Almesberger compiler: fix NULL pointer bug when running patches that don't use di…
…rect MIDI
a602258
Werner Almesberger stimuli.c: ptrdiff_t is defined in stddef.h, not sys/types.h 41804a4
Werner Almesberger compiler: don't include \n in "cannot add stimulus ..." message c1f5d02
Werner Almesberger test/stim: regression tests for current stimuli syntax (WIP) 230544d
Feb 07, 2012
Werner Almesberger stimuli: make MIDI channel numbers one-based 2ac7dc9
Werner Almesberger stimuli: added MIDI channel wildcard (WIP)
The syntax is ugly: midi([chan], controller [, style])

Note that the comma after the channel is required, even if the
channel number is omitted. This would be difficult to do better
with the present syntax, but will get easier further down the
road.
d543c6f
Feb 08, 2012
Werner Almesberger test/stim: update for one-based channel numbers 08dbe02
Werner Almesberger test/stim: added test for wildcard channel 7dafcae
Werner Almesberger gui/midi.c: clean up structure of midi_event() 7133915
Werner Almesberger gui/midi.c: show channel number in MIDI monitor and change display fo…
…rmat

This commit changes the format from  CTRL (VALUE)  to either
CHAN.CTRL = VALUE  if the channel is the one currently selected, or
(CHAN.CTRL = VALUE)  if this is on a different channel.

The parentheses indicate that the traditional midiX variables are
not affected by this controller.
39e2529
Werner Almesberger gui/midi.c: make channel numbers presented to user one-based
For compatibility, the number in the configuration is still zero-based.
We'll get rid of it eventually.
e01883c
Feb 09, 2012
Werner Almesberger stimuli: base for MIDI device database (WIP) 439a665
Werner Almesberger compiler: added parsing of MIDI device database (WIP)
Also updated the example code in T.fnp
cbf2fb1
Werner Almesberger compiler: added labeling of MIDI devices
There are three interconnected changes in this commit:
- added quoted strings (TOK_STRING) to scanner,
- use them in the grammar, for midi_device,
- update T.fnp example
2902efb
Werner Almesberger compiler: added binding of inputs (WIP)
Also updated the example code in T.fnp
d1e597c
Werner Almesberger compiler: make MIDI channel also wildcardable in device database entry eaf6ea0
Werner Almesberger test/stim: converted to split database style (DB side only) 3c3d02b
Werner Almesberger compiler: removed all-in-one MIDI control syntax f2413ed
Werner Almesberger stimuli: stim_add_midi_ctrl and midi_proc_* are now internal
Thus made them "static" and removed them from the header.
2de1183
Werner Almesberger stimuli: renamed midi_proc_accel_* to midi_proc_diff_*
For consistency with differential() and dt_diff.
25bd531
Werner Almesberger compiler: improved structure of sections in parser.y 08af98f
Feb 10, 2012
Werner Almesberger stimuli: separate set operation from midi_proc_linear
For future sharing.
6753ab4
Werner Almesberger stimuli: added button-to-toggle processor (untested) 180f37e
Werner Almesberger stimuli: added range-to-button processor (untested)
We use it also for range-to-toggle since this seems to be a better
approximation than requiring a zero-non-zero transition for each
toggle.
25dc757
Werner Almesberger stimuli: added differential-to-button processor (untested)
We use it also for differential-to-toggle, like in the range-to-button
case.
50542a4
Werner Almesberger stimuli: add section comments and align code with sections bfbecab
Werner Almesberger stimuli: make register update functions not MIDI specific
This just moves the ct->regs lookup across the API.
ea837ff
Werner Almesberger test/stim: renamed to stimdb and updated titles accordingly 32fae1f
Werner Almesberger stimuli: do_bind didn't check if the processor was NULL
Oops ...
a94de31
Werner Almesberger test/stimin: test cases for device to input binding 44bdea0
Werner Almesberger stimuli: stim_db_free to deallocate the device database bdcad90
Werner Almesberger compiler: free the input device database after compilation
Since the database is currently per patch, we need to free it once the
patch has been compiled. In the longer run, this is of course now what
we want - the database should be global and long-lived.
59ac669
Werner Almesberger patch editor: replace hard-coded patch buffer size with #define 8318d6f
Werner Almesberger patch editor: wrap long lines 650c1de
Werner Almesberger patch editor: escape all double quotes before calling ed.set d68317a
Werner Almesberger ptest: new options -v and -m to exercise MIDI message processing
-v var  enabled tracing of the specified control variable. This
variable must be a system variable. (This is due to an implementation
detail: we look it up after freeing the symbol table, so only the
system variables survive that long.)

-m [chan.]ctrl=value  injects a MIDI control message into the stimuli
system and prints the value of the traced variable after processing
the message. The -m option can be repeated.
42f7314
Werner Almesberger test/stimin: added MIDI injection to test cases
Also corrected differential -> range test that was actually
range -> range.
1f4cdb9
Werner Almesberger stimuli: ignore value 0 in midi_proc_diff_button
We should probably never receive a zero here. But if we do, ignoring
it seem to be the best choice.
7709d04
Werner Almesberger test/stimin: added differential -> { unbounded, cyclic, button } and …
…button -> toggle

This completes the set of "interesting" mappings.
f398564
Werner Almesberger compiler/doc: icons for MIDI controls a788442
Feb 11, 2012
Werner Almesberger stimuli: raise threshold for range -> button from 1 to 64
This means that we switch in the middle of the range, increasing
the zones in which the control can be safely "parked", and also
avoiding issues with devices that have difficulties reaching the
end of the range.

Also updated test/stimin
a60a417
Werner Almesberger stimuli: treat toggle -> button like toggle -> range
Before, this translation was not possible. But it doesn't seem to
stretch analogies more than, say, range -> button does.

Also updated test/stimin
5d9439e
Werner Almesberger compiler: device type "range" is now "fader" or "pot"
Both are  synonymous for now. This distinction will allow a future
GUI to use different graphical elements for them.
ee8d05c
Werner Almesberger stimuli: midi_proc_diff_unbounded now keeps the current value in "last"
This means that changing the control variable will not affect the
value written when the next MIDI message arrives. This is to make
diff -> unbounded behaviour consistent with the rest.
8e3e946
Feb 12, 2012
Werner Almesberger MIDI documentation (WIP) de90c93
Werner Almesberger stimuli, compiler: renamed "toggle" to "switch"
Switch is more general, a toggle button merely one possible implementation
of the concept.
9495de7
Werner Almesberger compiler/doc: renamed "toggle" to "switch" 7d5cc8b
Werner Almesberger compiler/doc: changed "MIDIC" to "MIDICC" to match MIDI terminology f45f7b5
Werner Almesberger compiler: fail if trying to use a "live" variable for control
A variable written to by set_pfv_from_frd can never be used as control
variable because set_pfv_from_frd would run after any updates from the
stimulus system, obliterating its changes.

The situation with transfer_pvv_regs is more difficult. At least in
theory, a variable like "sx" could act a control PFV but then
become a regular PVV. The compiler will bind the control PVV
regardlesss, but it will have no effect.

So we can only detect incorrect use of PFV and PVV that have a
corresponding PFV.
ab0d0e3
Werner Almesberger test/stimerr: test detection of duplicate control element and double …
…binding

The latter it is a new error check.
3c77035
Feb 13, 2012
Werner Almesberger stimuli: remember last MIDI value and reset control to it before star…
…ting

It's a little hackish to do this from stim_redirect, but since this is
what we call before launching a new patch and it has all the information
we need, it really is the best place.
63ea9e9
Werner Almesberger patch editor: generalized double quote protection
This will allow the use of double quote protection also for compiler
errors.
5e6707f
Werner Almesberger patch editor: protect double quotes also in compiler diagnostics 49a1282
Werner Almesberger stimuli: stim_db_free didn't reset the "last" pointer
This allowed only the first compilation of a patch with MIDI devices to work.
d516fe9
Werner Almesberger MIDI documentation (WIP, continuing) 3b739f3
Werner Almesberger MIDI documentation (still WIP, on-going) d64b327
Werner Almesberger stimuli: refuse to bind the same control twice
Also added the corresponding test to test/stimerr
6f45831
Werner Almesberger compiler: set SF_ASSIGNED for control variables to prevent -Wundefine…
…d warning

Also added a test case to test/stimin
cd8c356
Feb 14, 2012
Werner Almesberger compiler: allow multiple stimuli to set the same variable 3d96b27
Werner Almesberger ptest: free the symbol table in ptest (and not patch_compile)
This defers removal of the stimuli from the symbol table, which was
introduced when allowing binding control variables multiple times.
1a78844
Werner Almesberger compiler: allow multiple control variables to use the same stimulus 0963d9c
Werner Almesberger stimuli: stim_bind searched only the first device 9823551
Werner Almesberger test/stimmulti: test that binding a variable twice also works across …
…devices
cc6b764
Werner Almesberger More work on the MIDI documentation 212cb94
Feb 15, 2012
Werner Almesberger First draft of MIDI documentation a8d591d
Werner Almesberger T.fnp: improved structure of patch dd88600
Werner Almesberger Merge branch 'direct-midi' b3311cb
Werner Almesberger experimental/: removed leftover from development branch
T.fnp will come back in a different form at a later time.
9a098d5