mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
use control instead of controller in midi.message.create
This commit is contained in:
@@ -206,19 +206,19 @@ func newMidiControlChangeCreate(config config.ProcessorConfig) (Processor, error
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
controller, ok := params["controller"]
|
control, ok := params["control"]
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("midi.message.create ControlChange requires a controller parameter")
|
return nil, errors.New("midi.message.create ControlChange requires a control parameter")
|
||||||
}
|
}
|
||||||
|
|
||||||
controllerString, ok := controller.(string)
|
controlString, ok := control.(string)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("midi.message.create ControlChange controller must be a string")
|
return nil, errors.New("midi.message.create ControlChange control must be a string")
|
||||||
}
|
}
|
||||||
|
|
||||||
controllerTemplate, err := template.New("controller").Parse(controllerString)
|
controlTemplate, err := template.New("control").Parse(controlString)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -253,14 +253,14 @@ func newMidiControlChangeCreate(config config.ProcessorConfig) (Processor, error
|
|||||||
|
|
||||||
channelValue, err := strconv.ParseUint(channelBuffer.String(), 10, 8)
|
channelValue, err := strconv.ParseUint(channelBuffer.String(), 10, 8)
|
||||||
|
|
||||||
var controllerBuffer bytes.Buffer
|
var controlBuffer bytes.Buffer
|
||||||
err = controllerTemplate.Execute(&controllerBuffer, payload)
|
err = controlTemplate.Execute(&controlBuffer, payload)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
controllerValue, err := strconv.ParseUint(controllerBuffer.String(), 10, 8)
|
controlValue, err := strconv.ParseUint(controlBuffer.String(), 10, 8)
|
||||||
|
|
||||||
var valueBuffer bytes.Buffer
|
var valueBuffer bytes.Buffer
|
||||||
err = valueTemplate.Execute(&valueBuffer, payload)
|
err = valueTemplate.Execute(&valueBuffer, payload)
|
||||||
@@ -271,7 +271,7 @@ func newMidiControlChangeCreate(config config.ProcessorConfig) (Processor, error
|
|||||||
|
|
||||||
valueValue, err := strconv.ParseUint(valueBuffer.String(), 10, 8)
|
valueValue, err := strconv.ParseUint(valueBuffer.String(), 10, 8)
|
||||||
|
|
||||||
payloadMessage := midi.ControlChange(uint8(channelValue), uint8(controllerValue), uint8(valueValue))
|
payloadMessage := midi.ControlChange(uint8(channelValue), uint8(controlValue), uint8(valueValue))
|
||||||
return payloadMessage, nil
|
return payloadMessage, nil
|
||||||
}}, nil
|
}}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -361,14 +361,14 @@
|
|||||||
"channel": {
|
"channel": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"controller": {
|
"control": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["type", "channel", "controller", "value"],
|
"required": ["type", "channel", "control", "value"],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user