helgoboss / helgobox

Helgobox: ReaLearn & Playtime
https://www.helgoboss.org/projects/helgobox
GNU General Public License v3.0
205 stars 20 forks source link

Make "Make relative" compatible with discrete targets #645

Open helgoboss opened 2 years ago

helgoboss commented 2 years ago

Context: https://forum.cockos.com/showpost.php?p=2591069&postcount=2420

Setup:

{
    kind = "MainCompartment",
    value = {
        mappings = {
            {
                id = "hVhs8aqlyhOs07K89g5W1",
                name = "Track +/-",
                source = {
                    kind = "MidiControlChangeValue",
                    channel = 0,
                    controller_number = 48,
                    fourteen_bit = false,
                },
                glue = {
                    absolute_mode = "MakeRelative",
                    step_size_interval = {0.01, 0.05},
                },
                target = {
                    kind = "CycleThroughTracks",
                },
            },
        },
    },
}

The problem here is that tracks are skipped. Probably because we have continuous increments but this target is discrete.

Quick solutions:

helgoboss commented 2 years ago

Ah, the reason is that the target "Project: Navigate within tracks" takes absolute values. The "Glue" section calculates the new absolute value based on the total number of tracks and the incoming increment. This behaviour makes sense for discrete increments applied to discrete/continuous targets and continuous increments applied to continuous targets but not really for continuous increments applied to discrete targets. I think the "Glue" section should handle this and quantize continuous increments as +1/-1 if the target is discrete. A speed setting could be added as well in this case.

helgoboss commented 2 years ago

Oh, but actually the existing behaviour was intended: main/lib/helgoboss-learn/src/mode/mode_struct.rs:6060 says:

        /// Yes, we want to ignore the target's atomic step size! We want a full control sweep to
        /// always result in a full target sweep!
        #[test]
        fn continuous_to_discrete_shifted() {
helgoboss commented 2 years ago

We can't simply change this, also because there are plug-ins out there which expose continuous parameters as discrete parameters with a very large value count (hello NI). The "full control sweep" = "full target sweep" would not work anymore then. So either we ...

vonglan commented 2 years ago

This depends on the target, so I think the middle option (additional "make relative" mode) seems wrong. Also when you think of the SY mapping concept. The Controller Compartment sends either relative, or absolute, or "make relative". It is the NI-Plugin related main mapping that knows about the peculiarities of its parameter values.