Browse Source

Use prefixes for enum names instead of suffixes in helper script.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
687bb7f35f
1 changed files with 20 additions and 20 deletions
  1. +20
    -20
      helper.py

+ 20
- 20
helper.py View File

@@ -354,9 +354,9 @@ struct {identifier} : Module {{"""
enum ParamIds {""" enum ParamIds {"""
for c in components['params']: for c in components['params']:
source += f""" source += f"""
{c['name']}_PARAM,"""
PARAM_{c['name']},"""
source += """ source += """
NUM_PARAMS
PARAMS_LEN
};""" };"""


# Inputs # Inputs
@@ -364,9 +364,9 @@ struct {identifier} : Module {{"""
enum InputIds {""" enum InputIds {"""
for c in components['inputs']: for c in components['inputs']:
source += f""" source += f"""
{c['name']}_INPUT,"""
INPUT_{c['name']},"""
source += """ source += """
NUM_INPUTS
INPUTS_LEN
};""" };"""


# Outputs # Outputs
@@ -374,9 +374,9 @@ struct {identifier} : Module {{"""
enum OutputIds {""" enum OutputIds {"""
for c in components['outputs']: for c in components['outputs']:
source += f""" source += f"""
{c['name']}_OUTPUT,"""
OUTPUT_{c['name']},"""
source += """ source += """
NUM_OUTPUTS
OUTPUTS_LEN
};""" };"""


# Lights # Lights
@@ -384,28 +384,28 @@ struct {identifier} : Module {{"""
enum LightIds {""" enum LightIds {"""
for c in components['lights']: for c in components['lights']:
source += f""" source += f"""
{c['name']}_LIGHT,"""
LIGHT_{c['name']},"""
source += """ source += """
NUM_LIGHTS
LIGHTS_LEN
};""" };"""




source += f""" source += f"""


{identifier}() {{ {identifier}() {{
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);"""
config(PARAMS_LEN, INPUTS_LEN, OUTPUTS_LEN, LIGHTS_LEN);"""


for c in components['params']: for c in components['params']:
source += f""" source += f"""
configParam({c['name']}_PARAM, 0.f, 1.f, 0.f, "");"""
configParam(PARAM_{c['name']}, 0.f, 1.f, 0.f, "");"""


for c in components['inputs']: for c in components['inputs']:
source += f""" source += f"""
configInput({c['name']}_INPUT, "");"""
configInput(INPUT_{c['name']}, "");"""


for c in components['outputs']: for c in components['outputs']:
source += f""" source += f"""
configOutput({c['name']}_OUTPUT, "");"""
configOutput(OUTPUT_{c['name']}, "");"""


source += """ source += """
} }
@@ -434,10 +434,10 @@ struct {identifier}Widget : ModuleWidget {{
for c in components['params']: for c in components['params']:
if 'x' in c: if 'x' in c:
source += f""" source += f"""
addParam(createParam<RoundBlackKnob>(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::{c['name']}_PARAM));"""
addParam(createParam<RoundBlackKnob>(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::PARAM_{c['name']}));"""
else: else:
source += f""" source += f"""
addParam(createParamCentered<RoundBlackKnob>(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::{c['name']}_PARAM));"""
addParam(createParamCentered<RoundBlackKnob>(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::PARAM_{c['name']}));"""


# Inputs # Inputs
if len(components['inputs']) > 0: if len(components['inputs']) > 0:
@@ -445,10 +445,10 @@ struct {identifier}Widget : ModuleWidget {{
for c in components['inputs']: for c in components['inputs']:
if 'x' in c: if 'x' in c:
source += f""" source += f"""
addInput(createInput<PJ301MPort>(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::{c['name']}_INPUT));"""
addInput(createInput<PJ301MPort>(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::INPUT_{c['name']}));"""
else: else:
source += f""" source += f"""
addInput(createInputCentered<PJ301MPort>(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::{c['name']}_INPUT));"""
addInput(createInputCentered<PJ301MPort>(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::INPUT_{c['name']}));"""


# Outputs # Outputs
if len(components['outputs']) > 0: if len(components['outputs']) > 0:
@@ -456,10 +456,10 @@ struct {identifier}Widget : ModuleWidget {{
for c in components['outputs']: for c in components['outputs']:
if 'x' in c: if 'x' in c:
source += f""" source += f"""
addOutput(createOutput<PJ301MPort>(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::{c['name']}_OUTPUT));"""
addOutput(createOutput<PJ301MPort>(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::OUTPUT_{c['name']}));"""
else: else:
source += f""" source += f"""
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::{c['name']}_OUTPUT));"""
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::OUTPUT_{c['name']}));"""


# Lights # Lights
if len(components['lights']) > 0: if len(components['lights']) > 0:
@@ -467,10 +467,10 @@ struct {identifier}Widget : ModuleWidget {{
for c in components['lights']: for c in components['lights']:
if 'x' in c: if 'x' in c:
source += f""" source += f"""
addChild(createLight<MediumLight<RedLight>>(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::{c['name']}_LIGHT));"""
addChild(createLight<MediumLight<RedLight>>(mm2px(Vec({c['x']}, {c['y']})), module, {identifier}::LIGHT_{c['name']}));"""
else: else:
source += f""" source += f"""
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::{c['name']}_LIGHT));"""
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec({c['cx']}, {c['cy']})), module, {identifier}::LIGHT_{c['name']}));"""


# Widgets # Widgets
if len(components['widgets']) > 0: if len(components['widgets']) > 0:


Loading…
Cancel
Save