Strum's Mental VCV Module Suite to v1?

could you perhaps post a link to an example?, because i have looked and don’t see any reference to a pointer to the module in the modules i have found that crash so far.

Here’s a random example, from mscHack’s Envy-9. I’ve stripped out a lot of code to leave just the lines that illustrate the suggested fix:

struct SEQ_Envelope_8_Widget : ModuleWidget 
{
	SEQ_Envelope_8_Widget( SEQ_Envelope_8 *module ) 
	{
		setModule(module);

		if( module )  // <--- This is the important piece.  Without it...
		{
			module->m_bInitialized = true;  // ...this will crash.
		}
	}
};

The problem that people are suggesting you have is that you’re not checking for the module pointer being valid before following it.

(Note that ModuleWidget has a member variable called module as well, so this code could equally be elsewhere in your ModuleWidget, not just in the constructor.)

well one of the modules i know for sure is crashing has nothing like module-> in it

i’m still working through the list to find out exactly which modules are causing the crashes.

14 done and seem to be working, load, don’t crash browser, and can make instances, 11 to go.

it’s 4 am here now so i’m going to call it a night and get back to it tomorrow.

2 Likes

Ok 21 of 26 modules loading and not crashing the browser.

4 out of the 5 remaining modules would seem to have some pointer to the module issue but I don’t see any explicit reference that looks like the way it has been described. I’ll have a look at some code in other modules and see if i can nut it out.

I have migrated all of the modules @chrtlnghmstr has done , i’ll work on adding his bug fixes and skin changes when i get the last few modules working.

If anyone is in a desperate hurry for the 21 working modules i can post a pre release windows binary for use in the meantime.

Could you share the source code of any of the modules that are crashing the browser?

I haven’t committed it to the repo yet but i can pastebin it if you want to take a look.

https://pastebin.com/T4nJD49b

the other modules use basically the same display widget used there.

I orginally got it from the ML modules set.

I’m guessing the crash is caused by this (and the other NumberDisplayWidget3 code) in your ModuleWidget:

 NumberDisplayWidget3 *display = new NumberDisplayWidget3();
    display->box.pos = Vec(5,50);
    display->box.size = Vec(50, 20);
    display->value = &module->count_limit;
    addChild(display);

There is no check if the module exists. I’d recommend

  1. add the MentalCounters module as a member variable of the NumberDisplayWidget3
  2. instantiate this member in the ModuleWidget code
  3. in the draw method of NumberDisplayWidget3, check for the existence of the module before attempting to read module->count_limit

The first module I made was basically a copy of your Patch Matrix, plus scenes. I started from your code, including the NumberDisplayWidget3 and I kept the name! Check out line 317 and beyond to see an example of what I’m suggesting:

Cheers, will take a look.

I think i see the problem, i was looking in the draw method not the widget constructor itself, derp.

Scenes for the switch matrix? great idea.

I’m working on another set of modules and it has a development of the switch matrix in it.
I’ve added a switch to each vertical channel that changes the mode so it can function as an or gate, a selector or a summing mixer, it superceeds the old switch matrix, adding scenes to that would be a useful feature.

I’ve looked at your code and see what you have changed and have added that to the code but I’m getting errors about it not finding the module
your instructions are in computer gobble-de-gook speak and i don’t understand what you mean them
sorry.

src/MentalCounters.cpp: In member function ‘virtual void NumberDisplayWidget3::draw(const rack::widget::Widget::DrawArgs&)’:
src/MentalCounters.cpp:140:8: error: ‘module’ was not declared in this scope; did you mean ‘modfl’?
140 | if(module) {
| ^~~~~~
| modfl
src/MentalCounters.cpp: In constructor ‘MentalCountersWidget::MentalCountersWidget(MentalCounters*)’:
src/MentalCounters.cpp:176:11: error: ‘struct NumberDisplayWidget3’ has no member named ‘module’
176 | display->module = module;
| ^~~~~~
src/MentalCounters.cpp:193:13: error: ‘struct NumberDisplayWidget3’ has no member named ‘module’
193 | display_2->module = module;

found it, missed the line to add the module to the display widget.

got it, thanks heaps for your help.

i think i even understand how it works

a miracle.

still a bit of work to do tidying up the code and adding stuff to the .json file but that shouldn’t take too long now i’ve got it working.

thanks again @computerscare

1 Like

Great to hear! Good luck with the rest of the modules, I’m looking forward to using them again. As I mentioned, I got my start developing for Rack by reading/understanding and modifying your code - I’m very glad that I could return the favor somewhat.

Thanks man, I’m flattered, glad to share, this is how we make a better world, by making things and sharing them freely without concern for financial gain.

That my code has been used and copied and added to is a real buzz for me, I really didn’t expect it would be so widely copied and used as a reference.

4 Likes

I was going to fix the following which I had introduced:

Clock Divider: Reset button not working.

A/B Switches: To keep backwards compatibility, the order of the “modes” of the 3-way switches should be:

  1. Select input port chooses which output
  2. Output locked to B
  3. Output locked to A

I had it select input / A / B which is wrong. It’s pretty obvious where to change it around in the switch case statement.

1 Like

i don’t think the 3 way switch is actually needed, if you can detect whether something is connected to the select input then you can just ignore the state of the switch when something is connected. I don’t think it was possible to detect whether an input was connected or not when i wrote it originally.

Ok, So I’ve committed the changes, still got a bit of tidying up to do but it’s pretty much working as is if anyone wants to test it.

1 Like

I’ve also made a new repo for a new module set i’m working on

1 Like

I’ll stop working on my fork given that @axelmann has moved his original modules to v1 now.

2 Likes

Are you just using the master branch for the updates?

RACK_DIR=/home/alex/.git_repos/Rack-SDK/ make
jq: error: Could not open file plugin.json: No such file or directory
jq: error: Could not open file plugin.json: No such file or directory
/home/alex/.git_repos/Rack-SDK//plugin.mk:9: *** SLUG could not be found in manifest. Stop.

Thanks, I’ll incorporate some of your changes and if you want to keep working on other modules I’m happy to merge that in if i like what you have done.

I like what you have done with the clock divider code, makes much more sense to do it that way. I’ll work that in.

I also like UI tidy up but I’d prefer the UI components were added in loops where possible rather than having long lists of them in the gui creation code.

can you send private messages on here? if not send me an email and we can work out a few things if want,

I had to change the name of the rack SDK folder to Rack annd the RACK_DIR in the makefile to …/… to get it to work, try that.