A Simple Procedure to Create a Singleton Max Object with MIN


    Oct 13 2021 | 4:10 pm
    Just sharing this with the forum in case it's useful to others. I needed to ensure there would only ever be one instance of my object in the entire patch. Below is the solution I came up with. It seems to work pretty well. This seems to be a good example of what s_thing is for in the t_symbol.
    I used the following for the constructor for my MaxObject.
    MyMaxObject() { //Make a singleton c74::max::t_symbol* Exists = c74::max::gensym("ObjectInstance"); if (Exists->s_thing) { cout << "Class already exists" << endl; return; } Exists->s_thing = maxobj(); }