Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #34581 > unrolled thread
| Started by | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| First post | 2018-01-18 02:50 -0800 |
| Last post | 2018-01-21 00:55 -0800 |
| Articles | 15 on this page of 35 — 5 participants |
Back to article view | Back to comp.lang.javascript
Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 02:50 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 03:03 -0800
Re: Get the object structure correct. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-01-18 14:39 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 16:38 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 16:56 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 17:19 -0800
Re: Get the object structure correct. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-01-18 17:33 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 19:54 -0800
Re: Get the object structure correct. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-01-19 04:55 +0100
Re: Get the object structure correct. "Mark-" <nospam@mapson.xyz> - 2018-01-19 04:03 +0000
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 20:06 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 20:30 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 20:49 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-19 00:12 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-19 02:01 -0800
Re: Get the object structure correct. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-01-25 07:49 +0100
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-30 01:06 -0800
Re: Get the object structure correct. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-01-30 11:01 +0100
Re: Get the object structure correct. "Mark-" <nospam@mapson.xyz> - 2018-01-30 13:37 +0000
Re: Get the object structure correct. John G Harris <niam@jghnorth.org.uk.invalid> - 2018-01-30 19:14 +0000
Re: Get the object structure correct. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-01-18 17:24 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 17:41 -0800
Re: Get the object structure correct. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-01-18 17:47 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 18:29 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 18:46 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 18:54 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-18 19:00 -0800
Re: Get the object structure correct. John G Harris <niam@jghnorth.org.uk.invalid> - 2018-01-19 11:20 +0000
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-19 11:48 -0800
Re: Get the object structure correct. John G Harris <niam@jghnorth.org.uk.invalid> - 2018-01-19 20:03 +0000
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-19 12:18 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-19 12:48 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-19 13:02 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-20 18:07 -0800
Re: Get the object structure correct. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-01-21 00:55 -0800
Page 2 of 2 — ← Prev page 1 [2]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2018-01-18 17:24 -0800 |
| Message-ID | <c298db52-df65-4df5-8e64-8e5653b82e9a@googlegroups.com> |
| In reply to | #34584 |
Jonas Thörnvall wrote: > Hello Michael thanks for your answer i do not see how that would make dataX a property of time? But i confess i have very bad understanding of objects, and maybe do not understand your code. What you need to do is first figure out what your data structures are. Once you do you can minimize the code you have to write. Think of every "noun" as a class you should make, and every "verb" as a method of those classes. Properties are the relationships between them. right now you're concepts are Track (which I defined earlier), and apparently Time. Can you make a list of more? Don't overthink it and stay focused. I guarantee many things will become obvious for you once you go through this exercise.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-18 17:41 -0800 |
| Message-ID | <09a62416-4a46-4d7a-b7a7-3ba64032315c@googlegroups.com> |
| In reply to | #34587 |
Den fredag 19 januari 2018 kl. 02:24:14 UTC+1 skrev Michael Haufe (TNO): > Jonas Thörnvall wrote: > > > Hello Michael thanks for your answer i do not see how that would make dataX a property of time? But i confess i have very bad understanding of objects, and maybe do not understand your code. > > What you need to do is first figure out what your data structures are. Once you do you can minimize the code you have to write. > > Think of every "noun" as a class you should make, and every "verb" as a method of those classes. > > Properties are the relationships between them. > > right now you're concepts are Track (which I defined earlier), and apparently Time. > > Can you make a list of more? > > Don't overthink it and stay focused. > > I guarantee many things will become obvious for you once you go through this exercise. Well i think i want the choice for the tracks to be played on different ports "each port can be an instrument" and also different midichannels and programs. So i keep those as arrays, portname is good if you store the structure and the port order change. To my surprise my guesswork of howto create the object worked, no protests. But it seem that time have to be a property of the message. So lets see if i can reach and set messages using track[x].midimessage[x].time=time; track[x].midimessage[x].data0=mididata0; track[x].midimessage[x].data1=mididata1; track[x].midimessage[x].data2=mididata2; But then i am lost on howto sort using time track[x].midimessage.time.sort(); That does not seem correct? This is what confuse me before i could store a time message in time but now it been downgraded to a property of message so how do i sort the array using the property.
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2018-01-18 17:47 -0800 |
| Message-ID | <71a036d3-e7f2-4a4d-be7f-2f744f0fdab1@googlegroups.com> |
| In reply to | #34589 |
Jonas Thörnvall wrote:
> This is what confuse me before i could store a time message in time but now it been downgraded to a property of message so how do i sort the array using the property.
<script>
someArray.sort(function(a,b) {
return a.propertyName - b.propertyName
})
</script>
See: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort>
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-18 18:29 -0800 |
| Message-ID | <92a4f724-d842-4f1f-8ef0-7625f9b754d2@googlegroups.com> |
| In reply to | #34590 |
Den fredag 19 januari 2018 kl. 02:47:14 UTC+1 skrev Michael Haufe (TNO):
> Jonas Thörnvall wrote:
>
> > This is what confuse me before i could store a time message in time but now it been downgraded to a property of message so how do i sort the array using the property.
>
> <script>
> someArray.sort(function(a,b) {
> return a.propertyName - b.propertyName
> })
> </script>
>
> See: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort>
After changing structure, i can no longer record/assign values to the new properties of midimessage array? Uncaught TypeError: Cannot set property 'time' of undefined
function makeTrack()
{
for (var m = 0; m < 101; m ++ )
{
track[m] ={
outport:[],
portname : [],
midichannel:[],
program:[],
midimessage:[{time:0,data0:0,data1:0,data2:0}]
};
}
defaultTrackValues();
return track;
}
function defaultTrackValues(){
for (var m = 1; m < 16; m ++ ){
track[m].outport[0]=document.getElementById("out_portsel").selectedIndex;
track[m].portname[0]=document.getElementById("out_portsel").value;
track[m].midichannel[0]=m;
track[m].program[0]=document.getElementById("prog_sel").value;
}
}
Here is where i record them.
function record(message){
clock=clock+rs;
midievent++;
track[tracknr].midimessage[x].time=clock;
track[tracknr].midimessage[x].data0= message.data[0];
track[tracknr].midimessage[x].data1= message.data[1];
track[tracknr].midimessage[x].data2= message.data[2];
x++;
console.log("Track="+tracknr);
}
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-18 18:46 -0800 |
| Message-ID | <f3d1f243-6562-4c44-94b3-dacbbcb8bad2@googlegroups.com> |
| In reply to | #34591 |
Den fredag 19 januari 2018 kl. 03:30:09 UTC+1 skrev Jonas Thörnvall:
> Den fredag 19 januari 2018 kl. 02:47:14 UTC+1 skrev Michael Haufe (TNO):
> > Jonas Thörnvall wrote:
> >
> > > This is what confuse me before i could store a time message in time but now it been downgraded to a property of message so how do i sort the array using the property.
> >
> > <script>
> > someArray.sort(function(a,b) {
> > return a.propertyName - b.propertyName
> > })
> > </script>
> >
> > See: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort>
>
> After changing structure, i can no longer record/assign values to the new properties of midimessage array? Uncaught TypeError: Cannot set property 'time' of undefined
>
> function makeTrack()
> {
> for (var m = 0; m < 101; m ++ )
> {
> track[m] ={
> outport:[],
> portname : [],
> midichannel:[],
> program:[],
> midimessage:[{time:0,data0:0,data1:0,data2:0}]
> };
> }
> defaultTrackValues();
> return track;
> }
> function defaultTrackValues(){
> for (var m = 1; m < 16; m ++ ){
> track[m].outport[0]=document.getElementById("out_portsel").selectedIndex;
> track[m].portname[0]=document.getElementById("out_portsel").value;
> track[m].midichannel[0]=m;
> track[m].program[0]=document.getElementById("prog_sel").value;
> }
> }
>
> Here is where i record them.
> function record(message){
> clock=clock+rs;
> midievent++;
> track[tracknr].midimessage[x].time=clock;
> track[tracknr].midimessage[x].data0= message.data[0];
> track[tracknr].midimessage[x].data1= message.data[1];
> track[tracknr].midimessage[x].data2= message.data[2];
> x++;
> console.log("Track="+tracknr);
> }
It probably relate to people.push(new Person("Jonas", "Thörnvall"))
new track[tracknr].midimessage(clock,message.data[0],message.data[1],message.data[2]);
How do i set and reach messages in my proposed structure.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-18 18:54 -0800 |
| Message-ID | <c4312ee5-144b-4a90-b6b5-58585733c9a5@googlegroups.com> |
| In reply to | #34592 |
Den fredag 19 januari 2018 kl. 03:46:30 UTC+1 skrev Jonas Thörnvall:
> Den fredag 19 januari 2018 kl. 03:30:09 UTC+1 skrev Jonas Thörnvall:
> > Den fredag 19 januari 2018 kl. 02:47:14 UTC+1 skrev Michael Haufe (TNO):
> > > Jonas Thörnvall wrote:
> > >
> > > > This is what confuse me before i could store a time message in time but now it been downgraded to a property of message so how do i sort the array using the property.
> > >
> > > <script>
> > > someArray.sort(function(a,b) {
> > > return a.propertyName - b.propertyName
> > > })
> > > </script>
> > >
> > > See: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort>
> >
> > After changing structure, i can no longer record/assign values to the new properties of midimessage array? Uncaught TypeError: Cannot set property 'time' of undefined
> >
> > function makeTrack()
> > {
> > for (var m = 0; m < 101; m ++ )
> > {
> > track[m] ={
> > outport:[],
> > portname : [],
> > midichannel:[],
> > program:[],
> > midimessage:[{time:0,data0:0,data1:0,data2:0}]
> > };
> > }
> > defaultTrackValues();
> > return track;
> > }
> > function defaultTrackValues(){
> > for (var m = 1; m < 16; m ++ ){
> > track[m].outport[0]=document.getElementById("out_portsel").selectedIndex;
> > track[m].portname[0]=document.getElementById("out_portsel").value;
> > track[m].midichannel[0]=m;
> > track[m].program[0]=document.getElementById("prog_sel").value;
> > }
> > }
> >
> > Here is where i record them.
> > function record(message){
> > clock=clock+rs;
> > midievent++;
> > track[tracknr].midimessage[x].time=clock;
> > track[tracknr].midimessage[x].data0= message.data[0];
> > track[tracknr].midimessage[x].data1= message.data[1];
> > track[tracknr].midimessage[x].data2= message.data[2];
> > x++;
> > console.log("Track="+tracknr);
> > }
>
> It probably relate to people.push(new Person("Jonas", "Thörnvall"))
> new track[tracknr].midimessage(clock,message.data[0],message.data[1],message.data[2]);
>
> How do i set and reach messages in my proposed structure.
Maybe i should just loop thru like i do for tracks create the messages but i must do it for each track?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-18 19:00 -0800 |
| Message-ID | <f9401e54-3538-4110-8b76-b536daf3c02e@googlegroups.com> |
| In reply to | #34593 |
Den fredag 19 januari 2018 kl. 03:54:32 UTC+1 skrev Jonas Thörnvall:
> Den fredag 19 januari 2018 kl. 03:46:30 UTC+1 skrev Jonas Thörnvall:
> > Den fredag 19 januari 2018 kl. 03:30:09 UTC+1 skrev Jonas Thörnvall:
> > > Den fredag 19 januari 2018 kl. 02:47:14 UTC+1 skrev Michael Haufe (TNO):
> > > > Jonas Thörnvall wrote:
> > > >
> > > > > This is what confuse me before i could store a time message in time but now it been downgraded to a property of message so how do i sort the array using the property.
> > > >
> > > > <script>
> > > > someArray.sort(function(a,b) {
> > > > return a.propertyName - b.propertyName
> > > > })
> > > > </script>
> > > >
> > > > See: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort>
> > >
> > > After changing structure, i can no longer record/assign values to the new properties of midimessage array? Uncaught TypeError: Cannot set property 'time' of undefined
> > >
> > > function makeTrack()
> > > {
> > > for (var m = 0; m < 101; m ++ )
> > > {
> > > track[m] ={
> > > outport:[],
> > > portname : [],
> > > midichannel:[],
> > > program:[],
> > > midimessage:[{time:0,data0:0,data1:0,data2:0}]
> > > };
> > > }
> > > defaultTrackValues();
> > > return track;
> > > }
> > > function defaultTrackValues(){
> > > for (var m = 1; m < 16; m ++ ){
> > > track[m].outport[0]=document.getElementById("out_portsel").selectedIndex;
> > > track[m].portname[0]=document.getElementById("out_portsel").value;
> > > track[m].midichannel[0]=m;
> > > track[m].program[0]=document.getElementById("prog_sel").value;
> > > }
> > > }
> > >
> > > Here is where i record them.
> > > function record(message){
> > > clock=clock+rs;
> > > midievent++;
> > > track[tracknr].midimessage[x].time=clock;
> > > track[tracknr].midimessage[x].data0= message.data[0];
> > > track[tracknr].midimessage[x].data1= message.data[1];
> > > track[tracknr].midimessage[x].data2= message.data[2];
> > > x++;
> > > console.log("Track="+tracknr);
> > > }
> >
> > It probably relate to people.push(new Person("Jonas", "Thörnvall"))
> > new track[tracknr].midimessage(clock,message.data[0],message.data[1],message.data[2]);
> >
> > How do i set and reach messages in my proposed structure.
>
> Maybe i should just loop thru like i do for tracks create the messages but i must do it for each track?
But it seem weird, if i create 10 000 messages for 100 tracks?
And make new message objects while you record seem crazy, it take time and create latency? If they just were dynamic? arrays, they would not take any place now i have to allocate 10000*3 byte on 100 tracks?
[toc] | [prev] | [next] | [standalone]
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2018-01-19 11:20 +0000 |
| Message-ID | <ruk36dpbocuddfhmrktasdcomm3ndqncf2@4ax.com> |
| In reply to | #34587 |
On Thu, 18 Jan 2018 17:24:06 -0800 (PST), "Michael Haufe (TNO)" <tno@thenewobjective.com> wrote: >Jonas Thörnvall wrote: > >> Hello Michael thanks for your answer i do not see how that would make dataX a property of time? But i confess i have very bad understanding of objects, and maybe do not understand your code. > >What you need to do is first figure out what your data structures are. Once you do you can minimize the code you have to write. > >Think of every "noun" as a class you should make, and every "verb" as a method of those classes. > >Properties are the relationships between them. > >right now you're concepts are Track (which I defined earlier), and apparently Time. > >Can you make a list of more? > >Don't overthink it and stay focused. > >I guarantee many things will become obvious for you once you go through this exercise. Has he done this? A little while ago he was cursing someone for writing code with no useful comments in it. Why? He doesn't. John
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-19 11:48 -0800 |
| Message-ID | <10b21a65-e197-4614-89a5-d1011692cb75@googlegroups.com> |
| In reply to | #34603 |
Den fredag 19 januari 2018 kl. 12:20:37 UTC+1 skrev John G Harris:
> On Thu, 18 Jan 2018 17:24:06 -0800 (PST), "Michael Haufe (TNO)"
> <tno@thenewobjective.com> wrote:
>
> >Jonas Thörnvall wrote:
> >
> >> Hello Michael thanks for your answer i do not see how that would make dataX a property of time? But i confess i have very bad understanding of objects, and maybe do not understand your code.
> >
> >What you need to do is first figure out what your data structures are. Once you do you can minimize the code you have to write.
> >
> >Think of every "noun" as a class you should make, and every "verb" as a method of those classes.
> >
> >Properties are the relationships between them.
> >
> >right now you're concepts are Track (which I defined earlier), and apparently Time.
> >
> >Can you make a list of more?
> >
> >Don't overthink it and stay focused.
> >
> >I guarantee many things will become obvious for you once you go through this exercise.
>
> Has he done this?
>
> A little while ago he was cursing someone for writing code with no
> useful comments in it. Why? He doesn't.
>
> John
Comments doesn't bother me i don't need them, meaningfull syntax on the other side and its opposite. What is the point to make excercises that do not apply to the problem at hand. I could make a constructor but it would not apply to my problem, because the object is layered. And maybe it is two objects in javascript a message and a track, i have no idea.
I just can state that i think i had a structure that may had worked but i had no idea how to put a message into it.
I do not even know if it has the correct format it is just guesswork on my part.
I still wait for someone to say either that the structure is wrong, or how i can put a midimessage into it. Because i tried and get midimessage not defined all variants that i guessed how to do it.
I do not think i need a class constructor, this would work just fine. But i do not know howto assign/create a new midimessage?
function newTrack()
{
track[m] ={
outport:[],
portname : [],
midichannel:[],
program:[],
midimessage:[{time:0,data0:0,data1:0,data2:0}]
};
return track;
}
[toc] | [prev] | [next] | [standalone]
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2018-01-19 20:03 +0000 |
| Message-ID | <rjj46d5pgr96aafue0t0aj1fg111l9pfou@4ax.com> |
| In reply to | #34604 |
On Fri, 19 Jan 2018 11:48:13 -0800 (PST), Jonas Thörnvall <jonas.thornvall@gmail.com> wrote: <snip> >I still wait for someone to say either that the structure is wrong, or how i can put a midimessage into it. <snip> How would we know when the code you copied has no useful comments and no documentation. John
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-19 12:18 -0800 |
| Message-ID | <47d9e43c-72e8-401c-a659-d2b99b64f1a5@googlegroups.com> |
| In reply to | #34606 |
Den fredag 19 januari 2018 kl. 21:03:27 UTC+1 skrev John G Harris: > On Fri, 19 Jan 2018 11:48:13 -0800 (PST), Jonas Thörnvall > <jonas.thornvall@gmail.com> wrote: > > <snip> > >I still wait for someone to say either that the structure is wrong, or how i can put a midimessage into it. > <snip> > > How would we know when the code you copied has no useful comments and > no documentation. > > John I can't see what there is to comment upon the code i wrote, the "code" structure make a new track. I know howto make a new track. So for the last time "what is the fucking syntax" to put a midimessage into it. ***IF THAT IS POSSIBLE*** Or what do you want me to comment on? It is a track and i can access the properties of it ***but not midimessage*** That i think i given properties of its own? You see I am not sure i did it correct because the syntax of javascript is somewhat horrible when it comes to multidimensinal **thingies** that have properties. I've tried to assign values to the time and data properties. But i get that the midimessage do not exist, ***BUT I DO NOT KNOW HOWTO CREATE THEM*** The answer to the question is probably a oneliner of javascripts horrible syntax that i just can't figure out. But i can't comment on the structure what do you want me to comment, is there anything to comment on it what?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-19 12:48 -0800 |
| Message-ID | <4be8a04c-5fbd-412f-9ce9-9f65a99acbcd@googlegroups.com> |
| In reply to | #34606 |
Den fredag 19 januari 2018 kl. 21:03:27 UTC+1 skrev John G Harris:
> On Fri, 19 Jan 2018 11:48:13 -0800 (PST), Jonas Thörnvall
> <jonas.thornvall@gmail.com> wrote:
>
> <snip>
> >I still wait for someone to say either that the structure is wrong, or how i can put a midimessage into it.
> <snip>
>
> How would we know when the code you copied has no useful comments and
> no documentation.
>
> John
Well i do not know what you want me to comment.
But i can show you howto create a track that is easy.
for (var m=0;m<16;m++){
newTrack(m);
}
And i can show you howto assign a value to one of the properties of track.
track[m].program[n]=128
You see that was easy.
Unless the property is midimessage, "that has properties of its own".
Now can anyone show me how to assign a value to time in midimessage.
I know it is undefined, "chrome tells me so", so i understand i must create just like i create tracks.
***BUT I DO NOT KNOW THE SYNTAX*** for howto do it.
It is a oneliner....
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-19 13:02 -0800 |
| Message-ID | <dca46e32-6689-4273-8ae8-252e8e7562cf@googlegroups.com> |
| In reply to | #34608 |
Den fredag 19 januari 2018 kl. 21:48:33 UTC+1 skrev Jonas Thörnvall:
> Den fredag 19 januari 2018 kl. 21:03:27 UTC+1 skrev John G Harris:
> > On Fri, 19 Jan 2018 11:48:13 -0800 (PST), Jonas Thörnvall
> > <jonas.thornvall@gmail.com> wrote:
> >
> > <snip>
> > >I still wait for someone to say either that the structure is wrong, or how i can put a midimessage into it.
> > <snip>
> >
> > How would we know when the code you copied has no useful comments and
> > no documentation.
> >
> > John
>
> Well i do not know what you want me to comment.
> But i can show you howto create a track that is easy.
> for (var m=0;m<16;m++){
> newTrack(m);
> }
>
> And i can show you howto assign a value to one of the properties of track.
> track[m].program[n]=128
> You see that was easy.
>
> Unless the property is midimessage, "that has properties of its own".
>
> Now can anyone show me how to assign a value to time in midimessage.
> I know it is undefined, "chrome tells me so", so i understand i must create just like i create tracks.
>
> ***BUT I DO NOT KNOW THE SYNTAX*** for howto do it.
> It is a oneliner....
Yeah i tried track[m].midimessage[n] it does not work for me,should it?
for (m=0;m<16;m++){
for(n=0;n<10000;n++) {
track[m].midimessage[n];
}
}
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-20 18:07 -0800 |
| Message-ID | <afcfe721-1c80-402b-a408-669208852500@googlegroups.com> |
| In reply to | #34609 |
Den fredag 19 januari 2018 kl. 22:02:33 UTC+1 skrev Jonas Thörnvall:
> Den fredag 19 januari 2018 kl. 21:48:33 UTC+1 skrev Jonas Thörnvall:
> > Den fredag 19 januari 2018 kl. 21:03:27 UTC+1 skrev John G Harris:
> > > On Fri, 19 Jan 2018 11:48:13 -0800 (PST), Jonas Thörnvall
> > > <jonas.thornvall@gmail.com> wrote:
> > >
> > > <snip>
> > > >I still wait for someone to say either that the structure is wrong, or how i can put a midimessage into it.
> > > <snip>
> > >
> > > How would we know when the code you copied has no useful comments and
> > > no documentation.
> > >
> > > John
> >
> > Well i do not know what you want me to comment.
> > But i can show you howto create a track that is easy.
> > for (var m=0;m<16;m++){
> > newTrack(m);
> > }
> >
> > And i can show you howto assign a value to one of the properties of track.
> > track[m].program[n]=128
> > You see that was easy.
> >
> > Unless the property is midimessage, "that has properties of its own".
> >
> > Now can anyone show me how to assign a value to time in midimessage.
> > I know it is undefined, "chrome tells me so", so i understand i must create just like i create tracks.
> >
> > ***BUT I DO NOT KNOW THE SYNTAX*** for howto do it.
> > It is a oneliner....
>
> Yeah i tried track[m].midimessage[n] it does not work for me,should it?
>
> for (m=0;m<16;m++){
> for(n=0;n<10000;n++) {
> track[m].midimessage[n];
> }
> }
Well it pass without error but the properties of midimessage[n] "time,data0,data1,data2" are still undefined?
And that seem weird to be because if those ***properties time,date were on the track level***, they would been created and accessible to assign values.
Ater i looped and created the tracks, i could do assignments.
for (m=0;m<16;m++){ track[m].midimessage[n]; }
I would have no problem to write
track[m].time=100.0003
track[m].data0=128;
But when the properties belong to midimessage.
for (m=0;m<16;m++){
for(n=0;n<10000;n++) {track[m].midimessage[n];}
}
I can't do
track[m].midimessage[n].time=100.0003
track[m].midimessage[n].data0=128;
So i probably do not understand the structure?
Why can i assign property time, cataX in this structure.
track[m] ={
outport:[],
portname : [],
midichannel:[],
program:[],
time:[],
data0:0,
data1:0,
data2:0
};
But not in the leveled structure
track[m] ={
outport:[],
portname : [],
midichannel:[],
program:[],
midimessage:[{time:0,data0:0,data1:0,data2:0}]
};
Please help me out with this.
Why can't I
track[m].midimessage[n].time=1000.1234
The midimessages are created using loop below, so why are time and the dataX still undefined and not possible to assign values after loop run?
for (m=0;m<16;m++){
for(n=0;n<10000;n++) {track[m].midimessage[n];}
}//This work, however the properties of midimessage are unreachable.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-01-21 00:55 -0800 |
| Message-ID | <fa2a5b73-a9e2-493a-a7ab-767a74cd4c36@googlegroups.com> |
| In reply to | #34611 |
Den söndag 21 januari 2018 kl. 03:07:45 UTC+1 skrev Jonas Thörnvall:
> Den fredag 19 januari 2018 kl. 22:02:33 UTC+1 skrev Jonas Thörnvall:
> > Den fredag 19 januari 2018 kl. 21:48:33 UTC+1 skrev Jonas Thörnvall:
> > > Den fredag 19 januari 2018 kl. 21:03:27 UTC+1 skrev John G Harris:
> > > > On Fri, 19 Jan 2018 11:48:13 -0800 (PST), Jonas Thörnvall
> > > > <jonas.thornvall@gmail.com> wrote:
> > > >
> > > > <snip>
> > > > >I still wait for someone to say either that the structure is wrong, or how i can put a midimessage into it.
> > > > <snip>
> > > >
> > > > How would we know when the code you copied has no useful comments and
> > > > no documentation.
> > > >
> > > > John
> > >
> > > Well i do not know what you want me to comment.
> > > But i can show you howto create a track that is easy.
> > > for (var m=0;m<16;m++){
> > > newTrack(m);
> > > }
> > >
> > > And i can show you howto assign a value to one of the properties of track.
> > > track[m].program[n]=128
> > > You see that was easy.
> > >
> > > Unless the property is midimessage, "that has properties of its own".
> > >
> > > Now can anyone show me how to assign a value to time in midimessage.
> > > I know it is undefined, "chrome tells me so", so i understand i must create just like i create tracks.
> > >
> > > ***BUT I DO NOT KNOW THE SYNTAX*** for howto do it.
> > > It is a oneliner....
> >
> > Yeah i tried track[m].midimessage[n] it does not work for me,should it?
> >
> > for (m=0;m<16;m++){
> > for(n=0;n<10000;n++) {
> > track[m].midimessage[n];
> > }
> > }
>
> Well it pass without error but the properties of midimessage[n] "time,data0,data1,data2" are still undefined?
>
> And that seem weird to be because if those ***properties time,date were on the track level***, they would been created and accessible to assign values.
> Ater i looped and created the tracks, i could do assignments.
>
> for (m=0;m<16;m++){ track[m].midimessage[n]; }
> I would have no problem to write
> track[m].time=100.0003
> track[m].data0=128;
>
> But when the properties belong to midimessage.
> for (m=0;m<16;m++){
> for(n=0;n<10000;n++) {track[m].midimessage[n];}
> }
>
> I can't do
> track[m].midimessage[n].time=100.0003
> track[m].midimessage[n].data0=128;
>
> So i probably do not understand the structure?
>
> Why can i assign property time, cataX in this structure.
> track[m] ={
> outport:[],
> portname : [],
> midichannel:[],
> program:[],
> time:[],
> data0:0,
> data1:0,
> data2:0
> };
>
> But not in the leveled structure
>
> track[m] ={
> outport:[],
> portname : [],
> midichannel:[],
> program:[],
> midimessage:[{time:0,data0:0,data1:0,data2:0}]
> };
>
> Please help me out with this.
> Why can't I
>
> track[m].midimessage[n].time=1000.1234
>
> The midimessages are created using loop below, so why are time and the dataX still undefined and not possible to assign values after loop run?
>
> for (m=0;m<16;m++){
> for(n=0;n<10000;n++) {track[m].midimessage[n];}
> }//This work, however the properties of midimessage are unreachable.
1. Do you understand this question/problem with midimessage and assign its properties?
2. Do you know the answer to it?
If i could find examples i surely would look them up. But i have not seen any properties of a "subarray" get values assigned.
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.javascript
csiph-web