Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
Commits on Jan 30, 2012
@wpwrak wpwrak renderer/stimuli.c: unified control input handling
This commit provides data structure and basic functions for the unified
control input handling.
@wpwrak wpwrak compiler.h: wrap nasty long lines c26922b
@wpwrak wpwrak compiler: include basic elements for unified input events in patch st…
@wpwrak wpwrak 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.
@wpwrak wpwrak sampler.c: call stim_midi_ctrl upon reception of a MIDI controller event 53f48ec
@wpwrak wpwrak 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)
@wpwrak wpwrak eval.c: propagate control variables to patch registers 6c4895f
@wpwrak wpwrak symtab: added "cvar" index to "struct sym" for binding control variables a6d4cc3
@wpwrak wpwrak compiler.c: bind control variables to pfv and pvv registers 2fe2649
@wpwrak wpwrak compiler.c: new function patch_add_cvar to allocate a new control var…
@wpwrak wpwrak ptest: also link with stimuli.o a9f77a7
@wpwrak wpwrak compiler: added "midi" control variable assignment (WIP) e2bebe0
@wpwrak wpwrak compiler: update pointers after realloc() in patch_add_cvar 6d81665
@wpwrak wpwrak 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]
@wpwrak wpwrak experimental/T.fnp: Tornado Rain Dance variant for new MIDI control s…

This is only temporary to better track changes.
@wpwrak wpwrak 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.
@wpwrak wpwrak 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.
@wpwrak wpwrak 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.
@wpwrak wpwrak compiler/stimuli: refuse to assign out of range channel/controller nu…
@wpwrak wpwrak compiler: move retrieval of stimuli pointer from parser into compiler.c
A bit cleaner this way.
@wpwrak wpwrak stimuli: rename stim_add to stim_add_midi_ctrl
It's not generic.
@wpwrak wpwrak stimuli: added processor for acceleration with an unbounded range
accel_unbounded is (re)settable, as shown in T.fnp
@wpwrak wpwrak 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.
@wpwrak wpwrak compiler: fix NULL pointer bug when running patches that don't use di…
…rect MIDI
@wpwrak wpwrak stimuli.c: ptrdiff_t is defined in stddef.h, not sys/types.h 41804a4
@wpwrak wpwrak compiler: don't include \n in "cannot add stimulus ..." message c1f5d02
@wpwrak wpwrak test/stim: regression tests for current stimuli syntax (WIP) 230544d
Commits on Feb 07, 2012
@wpwrak wpwrak stimuli: make MIDI channel numbers one-based 2ac7dc9
Commits on Feb 08, 2012
@wpwrak wpwrak 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
@wpwrak wpwrak test/stim: update for one-based channel numbers 08dbe02
@wpwrak wpwrak test/stim: added test for wildcard channel 7dafcae
@wpwrak wpwrak gui/midi.c: clean up structure of midi_event() 7133915
@wpwrak wpwrak gui/midi.c: show channel number in MIDI monitor and change display fo…

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.
@wpwrak wpwrak 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.
Commits on Feb 09, 2012
@wpwrak wpwrak stimuli: base for MIDI device database (WIP) 439a665
@wpwrak wpwrak compiler: added parsing of MIDI device database (WIP)
Also updated the example code in T.fnp
@wpwrak wpwrak 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
@wpwrak wpwrak compiler: added binding of inputs (WIP)
Also updated the example code in T.fnp
Commits on Feb 10, 2012
@wpwrak wpwrak compiler: make MIDI channel also wildcardable in device database entry eaf6ea0
@wpwrak wpwrak test/stim: converted to split database style (DB side only) 3c3d02b
@wpwrak wpwrak compiler: removed all-in-one MIDI control syntax f2413ed
@wpwrak wpwrak stimuli: stim_add_midi_ctrl and midi_proc_* are now internal
Thus made them "static" and removed them from the header.
@wpwrak wpwrak stimuli: renamed midi_proc_accel_* to midi_proc_diff_*
For consistency with differential() and dt_diff.
@wpwrak wpwrak compiler: improved structure of sections in parser.y 08af98f
@wpwrak wpwrak stimuli: separate set operation from midi_proc_linear
For future sharing.
@wpwrak wpwrak stimuli: added button-to-toggle processor (untested) 180f37e
@wpwrak wpwrak 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
@wpwrak wpwrak stimuli: added differential-to-button processor (untested)
We use it also for differential-to-toggle, like in the range-to-button
@wpwrak wpwrak stimuli: add section comments and align code with sections bfbecab
@wpwrak wpwrak stimuli: make register update functions not MIDI specific
This just moves the ct->regs lookup across the API.
@wpwrak wpwrak test/stim: renamed to stimdb and updated titles accordingly 32fae1f
@wpwrak wpwrak stimuli: do_bind didn't check if the processor was NULL
Oops ...
@wpwrak wpwrak test/stimin: test cases for device to input binding 44bdea0
@wpwrak wpwrak stimuli: stim_db_free to deallocate the device database bdcad90
@wpwrak wpwrak 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.
@wpwrak wpwrak patch editor: replace hard-coded patch buffer size with #define 8318d6f
@wpwrak wpwrak patch editor: wrap long lines 650c1de
@wpwrak wpwrak patch editor: escape all double quotes before calling ed.set d68317a
@wpwrak wpwrak 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.
@wpwrak wpwrak test/stimin: added MIDI injection to test cases
Also corrected differential -> range test that was actually
range -> range.
@wpwrak wpwrak 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.
@wpwrak wpwrak test/stimin: added differential -> { unbounded, cyclic, button } and …
…button -> toggle

This completes the set of "interesting" mappings.
@wpwrak wpwrak compiler/doc: icons for MIDI controls a788442
Commits on Feb 11, 2012
@wpwrak wpwrak 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
@wpwrak wpwrak 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
@wpwrak wpwrak 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.
@wpwrak wpwrak 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.
Commits on Feb 12, 2012
@wpwrak wpwrak MIDI documentation (WIP) de90c93
@wpwrak wpwrak stimuli, compiler: renamed "toggle" to "switch"
Switch is more general, a toggle button merely one possible implementation
of the concept.
@wpwrak wpwrak compiler/doc: renamed "toggle" to "switch" 7d5cc8b
@wpwrak wpwrak compiler/doc: changed "MIDIC" to "MIDICC" to match MIDI terminology f45f7b5
@wpwrak wpwrak 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.
@wpwrak wpwrak test/stimerr: test detection of duplicate control element and double …

The latter it is a new error check.
Commits on Feb 13, 2012
@wpwrak wpwrak stimuli: remember last MIDI value and reset control to it before star…

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.
@wpwrak wpwrak patch editor: generalized double quote protection
This will allow the use of double quote protection also for compiler
@wpwrak wpwrak patch editor: protect double quotes also in compiler diagnostics 49a1282
@wpwrak wpwrak stimuli: stim_db_free didn't reset the "last" pointer
This allowed only the first compilation of a patch with MIDI devices to work.
@wpwrak wpwrak MIDI documentation (WIP, continuing) 3b739f3
Commits on Feb 14, 2012
@wpwrak wpwrak MIDI documentation (still WIP, on-going) d64b327
@wpwrak wpwrak stimuli: refuse to bind the same control twice
Also added the corresponding test to test/stimerr
@wpwrak wpwrak compiler: set SF_ASSIGNED for control variables to prevent -Wundefine…
…d warning

Also added a test case to test/stimin
@wpwrak wpwrak compiler: allow multiple stimuli to set the same variable 3d96b27
@wpwrak wpwrak 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.
@wpwrak wpwrak compiler: allow multiple control variables to use the same stimulus 0963d9c
@wpwrak wpwrak stimuli: stim_bind searched only the first device 9823551
@wpwrak wpwrak test/stimmulti: test that binding a variable twice also works across …
@wpwrak wpwrak More work on the MIDI documentation 212cb94
Commits on Feb 15, 2012
@wpwrak wpwrak First draft of MIDI documentation a8d591d
@wpwrak wpwrak T.fnp: improved structure of patch dd88600
@wpwrak wpwrak Merge branch 'direct-midi' b3311cb
@wpwrak wpwrak experimental/: removed leftover from development branch
T.fnp will come back in a different form at a later time.