SubmarineFree icon indicating copy to clipboard operation
SubmarineFree copied to clipboard

LA-216 display options

Open dbgrande opened this issue 3 years ago • 2 comments

LA-216 is a nice addition to your collection of modules.

Besides the default to overlay both inputs of each channel (left), here are a couple of other possibilities for you to consider:

  • Interleave the first 8 channels of both inputs (middle).

  • Offset the first 8 channels of input 2 (right).

la-216

dbgrande avatar Dec 09 '21 21:12 dbgrande

FYI, here are the code changes I did to implement the above:

--- LA2.cpp.orig	2021-12-03 18:13:09.018692897 -0700
+++ LA2.cpp	2021-12-11 13:32:06.617302802 -0700
@@ -17,6 +17,7 @@
 		PARAM_RESET,
 		PARAM_PRE,
 		PARAM_COLORS,
+		PARAM_DMODE,
 		NUM_PARAMS
 	};
 	enum InputIds {
@@ -61,6 +62,7 @@
 		configParam(PARAM_INDEX_2, 0.0f, 1.0f, 1.0f, "Right Index Position", "%", 0.0f, 100.0f, 0.0f);
 		configParam(PARAM_PRE, 0.0f, 32.0f, 0.0f, "Pre-trigger Buffer Size", " Points");
 		configSwitch(PARAM_COLORS, 0, 1, 0, "Match cable colors", { "Off", "On" });
+		configSwitch(PARAM_DMODE, 0, 2, 0, "Display mode", { "Overlay 16", "Interleave 8", "Offset 8" });
 		configInput(INPUT_1, "Signal 1");
 		configInput(INPUT_2, "Signal 2");
 		configInput(INPUT_EXT, "External Trigger");
@@ -327,11 +329,15 @@
 				return;
 			}
 			if (layer == 1) {
+				int dmode = clamp(module->params[LA_216::PARAM_DMODE].getValue(), 0.0f, 2.0f);
+				const int dchans[3] = { 16, 8, 8 };
+				const int dstep[3] = { 22, 44, 22 };
+				const int doffset[3] = { 0, 22, 176 };
 				for (int i = 0; i < 2; i++) {
 					if (module->inputs[LA_216::INPUT_1 + i].isConnected()) {
 						NVGcolor col = getColor(i);
-						for (int c = 0; c < module->inputs[LA_216::INPUT_1 + i].getChannels(); c++) {
-							drawTrace(args.vg, module->buffer[i * 16 + c], 21.5f + 22 * c, col); 
+						for (int c = 0; c < std::min(dchans[dmode], module->inputs[LA_216::INPUT_1 + i].getChannels()); c++) {
+							drawTrace(args.vg, module->buffer[i * 16 + c], 21.5f + c * dstep[dmode] + i * doffset[dmode], col);
 						}
 					}
 				}
@@ -434,6 +440,7 @@
 		addParam(createParamCentered<SmallKnob<LightKnob>>(Vec(18.5, 337), module, LA_216::PARAM_INDEX_1));
 		addParam(createParamCentered<SmallKnob<LightKnob>>(Vec(46.5, 337), module, LA_216::PARAM_INDEX_2));
 		addParam(createParamCentered<SnapKnob<SmallKnob<LightKnob>>>(Vec(48.5, 163), module, LA_216::PARAM_PRE));
+		addParam(createParamCentered<SubSwitch3>(Vec(54, 115.5), module, LA_216::PARAM_DMODE));
 	}
 	void appendContextMenu(Menu *menu) override {
 		SchemeModuleWidget::appendContextMenu(menu);

dbgrande avatar Dec 11 '21 21:12 dbgrande

Oh, it's a nice one! But this change hasn't made it to the official Library release, has it?

firolightfog avatar Nov 25 '22 04:11 firolightfog