Expander not working on first launch

I’m implementing a module expander for my Computerscare Custom Blank module, and it’s going fine EXCEPT the expander connection doesn’t work when I first load a patch. It works fine if I move the expander or module away from each other, and then “re-connect”. Here is the relevant code in each module’s process methods:

ComputerscareBlank.cpp

if (rightExpander.module && rightExpander.module->model == modelComputerscareBlankExpander) {
			// Get message from right expander
			float *message = (float*) rightExpander.module->leftExpander.producerMessage;
			// Write message
			/*for (int i = 0; i < 8; i++) {
				message[i] = inputs[i].getVoltage() / 10.f;
			}*/
			if (stepCounter == 90) {


			}
			message[0] = (currentFrame == 0) ? 10.f : 0.f;
			// Flip messages at the end of the timestep
			rightExpander.module->leftExpander.messageFlipRequested = true;
		}

And the expander: ComputerscareBlankExpander.cpp

ComputerscareBlankExpander() {

		config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);

		leftExpander.producerMessage = leftMessages[0];
		leftExpander.consumerMessage = leftMessages[1];
	}

	void process(const ProcessArgs &args) override {
		if (leftExpander.module && leftExpander.module->model == modelComputerscareBlank) {
			// Get consumer message
			float *message = (float*) leftExpander.consumerMessage;
			isConnected = true;

			//eocMessageReadTrigger.process(message[0]);
			if (eocMessageReadTrigger.process(message[0])) {
				eocPulse.trigger(1e-3);
			}
			outputs[EOC_OUTPUT].setVoltage(eocPulse.process(args.sampleTime) ? 10.f : 0.f);

			leftExpander.module->rightExpander.messageFlipRequested = true;
		}
		else {
		//	isConnected = false;
			// No mother module is connected.
		}
	}

Thanks in advance for any assistance!

Is the blank module resizable?

I was just wondering if it is resizing after loading. So perhaps the order of events is:

  • load with default size and not actually touching expander module
  • vcvrack searches for expanders and doesnt flag non-touching module
  • module starts and sets its size.
2 Likes

Ah yes, you’re absolutely right! Thank you so much! The resize-ability of this module is quite important, so I’m hoping I can get this to work as a left expander, or by some other magic since according to Andrew resizing will not be officially supported. Thanks again!

You could manually search for and update your expanders after you have loaded from json, or after you resized.

1 Like