Re: initializing classes

[email protected]
Newsgroups gmane.comp.audio.supercollider.user
Message-ID <[email protected]>
Thanks for the two solutions!

A follow-up question - I guess everybody does it a bit differently, but : 

I´d like to sort my object-templates in Classes - so Gliss would call a glissando Class, Cluster would call a cluster Class and so on. 
Then I´m planing a hierarchy of those classes with subclasses so the whole system is more manageable, but I’ll get quite a lot of different Classes. 

Is this a common / useful approach? 

Untill now I had one huge Class and all objects were functions, but this gets quite messy 






> Am 23.03.2021 um 00:15 schrieb [email protected]:
> 
> On Tue, Mar 23, 2021 at 3:24 AM <[email protected]> wrote:
>> This way it works, but then I have to initialize ALL variables, otherwise they are nil
>> 
>> MyClass : MySuperClass{
>> var <>midinote = #[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
>> var <>dur = 1;
>> var <>legato=#[1, 0.1, 1];
>> 
>> *new { |midinote, dur, legato|
>> ^super.newCopyArgs(midinote,dur, legato)
>> }
>> }
> 
> Many classes do this by providing defaults to the *new arguments:
> 
>    *new { |midinote = #[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], dur =
> 1, legato = #[1, 0.1, 1]|
>        ^super.newCopyArgs(midinote,dur, legato)
>    }
> 
> hjh
> 
> _______________________________________________
> sc-users mailing list
> 
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.