public void SetVariables(string _name, ControlType _controlType, AddressType _addressType, ValueRange _range, DefaultValueType _defaultValueType,
                             MIDIChannel _channel, CurveType _curveType, int _ccNumber, float _smoothTime)
    {
        //add channel if not set to all channels
        address = "/vkb_midi/" + (_channel == MIDIChannel.All ? "" : (int)_channel + "/");

        //sets address based on address type
        SetAddress(_addressType, _ccNumber);

        //assign min and max values from value range
        SetRange(_range);

        //sets default value to value type
        SetDefault(_defaultValueType);

        channel           = _channel;
        name              = _name;
        controlObjectName = _name + " " + _controlType;
        controlType       = _controlType;
        range             = _range;
        defaultType       = _defaultValueType;
        smoothTime        = _smoothTime;
        curveType         = _curveType;
        addressType       = _addressType;
    }
示例#2
0
    void SetControllerValuesToFields()
    {
        ControlType      controlType      = (ControlType)controlTypeDropdown.value;
        AddressType      addressType      = (AddressType)addressTypeDropdown.value;
        DefaultValueType defaultValueType = (DefaultValueType)defaultValueDropdown.value;
        CurveType        curveType        = (CurveType)curveTypeDropdown.value;
        MIDIChannel      midiChannel      = (MIDIChannel)(midiChannelDropdown.value - 1); //-1 becaise all channels is -1 in the enum, channel 1 is 0 in the enum, etc
        ValueRange       valueRange       = (ValueRange)(valueRangeDropdown.value);

        float  smoothTime     = smoothnessField.value;
        string controllerName = nameField.text;

        int result;
        int ccNumber = int.TryParse(ccChannelField.text, out result) ? result : -1; //this number should be validated by text field, so it should always be ok if text field is set up properly

        controllerConfig.SetVariables(controllerName, controlType, addressType, valueRange, defaultValueType, midiChannel, curveType, ccNumber, smoothTime);

        manager.RespawnController(controllerConfig);
    }
 public ControllerSettings(string _name, ControlType _controlType, AddressType _addressType, ValueRange _range, DefaultValueType _defaultValueType,
                           MIDIChannel _channel, CurveType _curveType, int _ccNumber = -1, float _smoothTime = 0.1f)
 {
     SetVariables(_name, _controlType, _addressType, _range, _defaultValueType, _channel, _curveType, _ccNumber, _smoothTime);
     id = ControlsManager.GetUniqueID();
 }