Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #36407
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2019-04-24 13:50 -0700 |
| References | <5a2b4e29-7d14-4cd3-8759-a77083b987cb@googlegroups.com> <2841cetqa4cnmscb37qsmndks4jbl1o8an@4ax.com> <f09bd0c2-216f-41ee-a224-ce54ab446757@googlegroups.com> |
| Message-ID | <efe24121-eddf-4a5d-909c-da9566a8ae75@googlegroups.com> (permalink) |
| Subject | Re: Javascript "object creation" and object oriented programming |
| From | jonas.thornvall@gmail.com |
Den onsdag 24 april 2019 kl. 20:11:47 UTC+2 skrev jonas.t...@gmail.com:
> Den onsdag 24 april 2019 kl. 18:39:23 UTC+2 skrev John G Harris:
> > On Tue, 23 Apr 2019 23:50:46 -0700 (PDT), jonas.thornvall@gmail.com
> > wrote:
> >
> > <snip>
> > >Let us say i have a synth object, each synth have bank index and the banks have names, each bank have instrument index and the instruments have names.
> >
> > Please stop sayint it's a bank index. It's a lot less confusing to say
> > it clearly : it's a list or sequence of banks.
> >
> > The same goes for the other things you've called an index.
> >
> >
> > >Now each instruments have notes with index and the notes have names. Maybe my attempt below is correct but it just feel so wrong? It somehow miss the depth aspect of multidimensional arrays?
> > <snip>
> >
> > So, what you've described can be summarised as :
> >
> > A synth object is
> > a list of banks
> >
> > A bank is
> > a name, and
> > a list of instruments
> >
> > An instrument is
> > a name, and
> > a list of notes
> >
> > A note is
> > a name
> >
> >
> > You can now see that you have four kinds of object. Each has two
> > properties :
> >
> > name, possibly null
> > list, possibly null
> >
> > A non-null name will be a string.
> > A non-null list will be an array.
> >
> >
> > John
>
> Here is my track object. As you can see it is easy to read out name port midichannel events, well one could quiestion why one would have all of them as arrays, but maybe there is bankchange or midichannelchange or programchange on the track.
>
> But one thing is clear midi events midiMess[] is an array of sequential events that i push in "3 data bytes and a time".
>
> Would not this kind of structure but with more levels of nesting be suitable, because for me this type of structure make sense. The objects separated would be confusing for me, how do i read in and out notes for example, i just would not know howto even start approach howto read in and out something from such a hierarchy.
>
> function newTrack(m) {
> track[m] = {
> outport: [],
> portname: [],
> bank:[],
> midichannel: [],
> program: [],
> trackname:"" ,
> midiMess: [],
> //CONFIGURATION OF midiMess:[{time:0,data0:0,data1:0,data2:0}]
> };
> return track;
> }
Here is how i would work store data into my favoured structure of "made up" object
But how do i implement it, i do not understand the object syntax well enough to create it.
synth[i].synthname="Roland D50";
synth[i].bank[x].bankname="Base & Drum";
synth[i].bank[x].instrument[y].instname="Trombone";
synth[i].bank[x].instrument[y].note[z].notename="HiHat";
I am totally clueless how to implement this object though, but the way it accept data make sense to me?
Because such an object is possible to create or?
Syntax to create the object above please??????????????
function newCollection(m) {
synth[m] = {
synthname : "",
bank[]={
bankname : "",
instr[]={
instname :"",
note[]={
notenname : "",
}
}
}
};
return extSynth;
}
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-23 23:50 -0700
Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 01:02 -0700
Re: Javascript "object creation" and object oriented programming "R.Wieser" <address@not.available> - 2019-04-24 12:34 +0200
Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 05:41 -0700
Re: Javascript "object creation" and object oriented programming "R.Wieser" <address@not.available> - 2019-04-24 18:06 +0200
Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 06:24 -0700
Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 07:00 -0700
Re: Javascript "object creation" and object oriented programming John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-24 17:39 +0100
Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 11:01 -0700
Re: Javascript "object creation" and object oriented programming John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-25 18:08 +0100
Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-25 10:14 -0700
Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 11:11 -0700
Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 13:50 -0700
Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-25 01:01 -0700
Re: Javascript "object creation" and object oriented programming John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-25 18:12 +0100
csiph-web