Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping v1 #87

Closed
wants to merge 134 commits into from
Closed

Mapping v1 #87

wants to merge 134 commits into from

Conversation

harryhaaren
Copy link
Member

A staging PR, to discuss the mapping strategy between Ctlra and any host. The "mappa" infrastructure is used to provide complex multi-layered mappings between the generic Ctlra events and the software-application.

A "target" is a value in the application that can be updated/changed by Ctlra.
A "source" is a value in the application that can be read by Ctlra for feedback to hardware devices.

The APIs are currently prototype and POC only, these will change, please don't expect API stability at this point.

This commit adds a sample application that implements an
initial draft of the mappa API. In particular the abstraction
between the application and the mappa software is being kept
as simple as possible - even still it will probably change
a few times - so do not start using this API just yet!

This commit closes #80 initial mapping design.

Signed-off-by: Harry van Haaren <[email protected]>
Testing with valgrind to fix leaks + access issues, #81

Signed-off-by: Harry van Haaren <[email protected]>
See details in #81

Signed-off-by: Harry van Haaren <[email protected]>
This enables the app to add and remove multiple targets.
Internally they're stored for book-keeping, but not
event-lookup is implemented yet. See #81

Signed-off-by: Harry van Haaren <[email protected]>
This commit is a significant step towards POC of using Ctlra
look-up-table for event mapping. The software target events
are stored in a linear array sorted by type, so the lookup of
the target is just an array access. The function pointer is
called if one is set.

This almost completes #81.

Signed-off-by: Harry van Haaren <[email protected]>
Error check to avoid segfault on NULL m or lut,
refactor to make it easier to store a list of lut's

Signed-off-by: Harry van Haaren <[email protected]>
this allows multiple lut layers to be present in a single
device. It also gives a good abstraction for using the
userdata pointer for the ctlra dev callbacks, and a place
to store state like current-layer for a device.

Signed-off-by: Harry van Haaren <[email protected]>
Segfaulting due to incorrect linked-lists / target setup

Signed-off-by: Harry van Haaren <[email protected]>
Signed-off-by: Harry van Haaren <[email protected]>
Enable other types of ctlra inputs than slider, exposing it to
the external API. Need to think about if this is the right solution
to the interface for mapping

Signed-off-by: Harry van Haaren <[email protected]>
This allows the lut switch to target a specific
integer lut for each device.

Signed-off-by: Harry van Haaren <[email protected]>
This commit enables layer switching by using an internal
mappa callback function that takes a dev_t *. This allows
the mappa instance to changes its active_lut, which causes
different actions to be triggered by each input event.

This closes #81.

Signed-off-by: Harry van Haaren <[email protected]>
This tests the cross-fader being bound to something else
on layer 2 - to ensure that the functionality gets transposed
correctly.

Signed-off-by: Harry van Haaren <[email protected]>
This commit checks the ids of controls being bound,
failing with -EINVAL if the target is out of bounds
for the hardware device being mapped.

Signed-off-by: Harry van Haaren <[email protected]>
This commit strenghtens the error checking on events as compared
to the events that are advertised by the device's metadata. If
the event id is beyond the advertised range, it is ignored and
a print issued to notify - this is due to invalid event/metadata
pairing in the device code.

Signed-off-by: Harry van Haaren <[email protected]>
This commit is the first version of the feedback prototype.
It uses the token concept, along with a unique name per source
of feedback.

Signed-off-by: Harry van Haaren <[email protected]>
Signed-off-by: Harry van Haaren <[email protected]>
Mostly working - need to dig into last few pointer issues

Signed-off-by: Harry van Haaren <[email protected]>
This commit fixes the array issues mentioned in the previous
commit, and adds a new source callback function in the app.
The value returned by the two functions is now different, and
a simple "musher" allows mapping a float value to 0-6 lights.

Signed-off-by: Harry van Haaren <[email protected]>
General cleanup of prints and noisy code, added error check
for dev if there's no device available.

Signed-off-by: Harry van Haaren <[email protected]>
This commit refactors main to have a seperate function for
binding - this needs to be abstracted out of the app and into
the mappa library at some point.

Some valgrind mem leaks on close fixed by cleaning up sources.

Signed-off-by: Harry van Haaren <[email protected]>
This commit adds the tailq infrastructure to support multiple
devices. This allows more than one ctlra instance to be mapped.

Signed-off-by: Harry van Haaren <[email protected]>
The missing return was causing invalid reads in valgrind.

Signed-off-by: Harry van Haaren <[email protected]>
This commit adds a bunch of destroy() functions, which
free the linked-lists of targets, lut, devices etc.

Signed-off-by: Harry van Haaren <[email protected]>
This approach uses a "token" that the application can
give to each callback - think function parameters. This
is in addition to the function pointer itself.

Signed-off-by: Harry van Haaren <[email protected]>
This enables the token style variable size method.

Signed-off-by: Harry van Haaren <[email protected]>
This should enable hotplug of devices at runtime, transparently
to any application.

Signed-off-by: Harry van Haaren <[email protected]>
The mappings now work as the device itself is found.

Signed-off-by: Harry van Haaren <[email protected]>
This commit enables scripts to use a button to reload the
script itself. This vastly improves iteration time to testing
changes, and abstracts the reloading process away from the
application.

Signed-off-by: Harry van Haaren <[email protected]>
This paves the way to build AVTKA based UIs in future, and
have the mappa library draw them.
Increase the waiting time, and timeout iterations before
giving up on closing the device. This reduces the issues
of screen artifacts remaining when software disconnects.

Signed-off-by: Harry van Haaren <[email protected]>
Needs some overhaul to make it a single linear space, and
not per-event-type?

Signed-off-by: Harry van Haaren <[email protected]>
This approach requires a "sources" array for each LUT/device
to contain the maximum size for any light_id of the device.
A source_t represents the source of that particular value to
display, and callbacks are triggered when we need to update.

This approach requires that Ctlra drivers expose the max
number of endpoints that can be valid-ly called on the device.
Aka, a device with 1000 leds will return 1000. This info is
not yet available in Ctlra for each device, but will be required
to properly support this feature.

Signed-off-by: Harry van Haaren <[email protected]>
This adds 64 targets and 64 sources, and a more complex
but messy testing method. Cleanup of this example app
is needed.

Signed-off-by: Harry van Haaren <[email protected]>
This commit switches off lights if no source is mapped.
Although this makes layer "switch" etc easier, and reduces
the chance of "stale" lights remaining on the device as
the source has been unmapped.

Signed-off-by: Harry van Haaren <[email protected]>
Signed-off-by: Harry van Haaren <[email protected]>
This commit adds AVTKA functionality to the existing Mappa
screen callbacks, allowing a UI to be easily built-up from
individual UI components. The particular components can then
be mapped to mappa_source_t instances, providing the required
mapping of values->screens, without any programming.

Signed-off-by: Harry van Haaren <[email protected]>
This commit implements the very crude basics of mapping from
application source_t to an AVTKA provided UI. The names are
hard-coded, and the LUTs are not in use to remap based on
multiplexed settings, however the dev has a source_t * that
it can retrieve a value from directly - POC working.

Signed-off-by: Harry van Haaren <[email protected]>
This change allows the screen UIs to be set by each LUT,
giving the user the flexibility to have a button activate
a layer, and hence also change the display.

The combination of one LUT having the input/lights/screen
is a good one, to allow easier UX of developing/testing mappings.

Signed-off-by: Harry van Haaren <[email protected]>
Improved error checking on the input side. Also make sure that the registered *decoder* is used for decoding received MIDI messages, rather than the *encoder* which is already used in MIDI output, which might cause races when both MIDI input and output happens simultaneously.
…. Also simplify the horribly convoluted masking of button values.
… following the mad layout in the actual data from the device.
@harryhaaren
Copy link
Member Author

Just a status update, while I think Mappa is still a good idea (tm) in theory, it is unlikely that this exact implementation is going to be merged into the Ctlra codebase, as (despite multiple attempts) it just didn't get the tracktion in other projects external to Ctlra/OpenAV.

No hard feelings here, but felt it worth saying before closing this PR. Its a good concept, but the implementation & uptake in the community need to be there for it to be worth Ctlra taking on all of this Mappa code.

Ctlra Mapping Prototype automation moved this from Wip PRs to Done Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants