From the original SynthMaker forum (2004–2014), with its members’ names and dates.
Panoply ·
Okay.
So, my background is really C++, Pascal, Java, that sort of thing.
I've got an idea for something I'd like to carry out in SM, but I'm not sure its possible, but would like peoples thoughts on this before I think about other ways I might want to acheive it.
I'm sure that those of us with a bit of experience in OOP languages will straight away see the similarities in a synth and an OOPL.
Classes, which hold variables and member functions, and possibly related classes too.
So synth which holds osc, filter classes, each of which holds variables (pitch, cutoff) and member functions (filter routine). Etc etc etc.
Now. A very useful technique that I like to employ is to instantiate arrays of classes. Thats easy enough to do, with explicit declaration, I suppose, but what about this sort of situation:
Class MyClass[i]
where we have an indefinite array of classes that are defined by some other functionality within the code which determines the value of i
Is this possible?
Is this even understandable 😉?
oddson ·
I'm not entirely sure I understand what you're after but SynthMaker is decidedly not object oriented in terms of instantiation. It has a few features that appear object-like but it lacks more than it has.
Panoply ·
Hmmm.
Yes.
It isn't a very clear concept.
Lets take for example the multistage envelope. This is a base class for the example. The points in the envelope could be defined as another class each instance of which contains the same information.
Obvioiusly, I'm not looking at what is, but what could be
So in terms of C++ code we'd be looking at, to try and illustrate very clearly the sort of thing I'm talking about
class Point : public Envelope
{
public:
int position;
float amplitude;
float pointValue()
{
return (stuff;)
}
};
int noOfPoints(int stuff)
{
//do stuff here - you get the idea
return i;
}
int main ()
{
i = noOfPoints(int stuff)
Point points[i];
for (int j=0;j<i;j++)
{
points[j].position = //result of whatever here;
points[j].amplitude = //result of whatever here;
}
}
}
anyhow, this is first thing in the morning code, and I've got a horrible cold, the point is this - sometimes its impossible to know how many points you might need to deal with. If you were analyzing a piece of audio for potential hitpoints for example.
And in these circumstances, the ability to work with variable arrays is very very useful, because you otherwise have to instantiate an excessive amount - which a) eats memory, b) may not be enough anyway, c) is t.e.d.i.o.u.s.
I'd given up on this actually being possible, but I looked in the Multi-Envelope generator and couldn't see an explicit way of dealing with the 16 steps - which made me wonder whether it was done in some way dynamically. I couldn't see were it kept its brain. Maybe I was being blind.
Obviously, I'm not trying to do this in a code module, but withing the SM structures of modules and wires themselves.
electrogear ·
Classes are great in Javascript. I know very little about SM code, but I don't think classes could be implemented here, they would need to be written into the compiler code and there's no mention of classes in the manual.
Mike
EDIT: Oops sorry I should have read your post properly. I can't imagine how you would implement a class not using code...?
Panoply ·
yeah.
arrays of variables, yes.
arrays of functions, no.
no functions, no classes (in realistic, this is a useful ability terms).
That, is a shame.
I'm gonna have to either go C++, or come up with some different ideas, different ways fo doing it.
Wrote something here? To have a post removed or your name hidden, write to [email protected].