dbagchee/helix-preset-viewer

Format Parameter Values to Represent Helix Iinterface Settings

Opened this issue · 3 comments

  • Calculate Percentages
  • Boolean to On/Off
  • Etc

Could this be computed when we load the array from file?

Yes I think we will want to have a few utility functions to do the value conversion and then process the file just before the preset variable gets updated with the uploaded data:

loadPreset(file) { var preset = null; var reader = new FileReader(); var vm = this; reader.onload = (e) => { preset = JSON.parse(e.target.result); console.log(preset); vm.preset = preset; /*run value conversion/processing before this line*/ }; reader.readAsText(file); }

I think we might want to utilize hxLabels to assist with this. As I was flipping around I noticed the Volume block has parameter "VolumeTaper" and is Boolean. This is the curve parameter and false=linear, true=logarithmic. The only way we could get close is to maybe build these special cases into arrays with labels, & actions. For instance:

Raw Parameter = { Label, Type, Replacement1, Replacement2, etc }

To see this better, here are some examples:

/* Boolean Type - Replacement1 = false, Replacement2 = true */
"VolumeTaper" = { "Volume Taper Curve", "Boolean", "Linear", "Logarithmic" }    

/* Percent Type - Just multiplies by 100 and adds the unit % */
"Mix" = { "Mix", "%" }

/* x10 Type - Just multiplies by 10 */
"Level" = { "Level", "x10" } 

Yes I think extending the hxLabels object makes sense - I think though - that means we will have to update all labels to move the name into it's own field and then allow us to add additional attributes as needed:

"VolumeTaper" = {
"label": "Volume Taper Curve",
"type": "boolean",
"true": "Logarithmic",
"false": "Linear"
}

And then have utilities that check the data type (boolean, decimal, etc) and pull the additional attributes as needed.