• Function calls that behave different depending on else leg.

    From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@21:1/5 to All on Mon Oct 25 22:38:16 2021
    I have this function drawNotesCanvas that behave different depending on else leg although the same call to function as other leg?

    What i want todo is draw out all tracks if track is zero, track zero is the "downmix of all tracks", used during playup.

    But even if i hardcode channel and remove loop, it does not to what the other "single channel" else leg do. It has gotten me bewilderd for months "years".

    snippet
    ============
    if (activetrack==0){
    //for (var i=1;i<=maxtrack;i++){
    drawtrack=1; //1,2,3 or whatever channel do not do same as other leg
    notePlot();
    // }
    } else {
    drawtrack=activetrack;
    notePlot();
    }
    }

    fullcode
    ==================
    var graphNotePosX= [];
    var graphNotePosY= [];
    var graphNoteLength= [];
    var graphNoteHeight= [];
    var graphNoteEvent= [];
    var trColor=[];

    trColor[0]="yellow";
    trColor[1]="magenta";
    trColor[2]="lightgrey";
    trColor[3]="skyblue";
    trColor[4]="yellow";
    trColor[5]="fuchsia";
    trColor[6]="pink";
    trColor[7]="magenta";
    trColor[8]="orange";
    trColor[9]="cyan";
    trColor[10]="white";
    trColor[11]="lightgreen";
    trColor[12]="silver";
    trColor[13]="lightblue";
    trColor[14]="olive";
    trColor[15]="red";
    trColor[16]="aqua";

    // CLEAR NOTES ON CANVAS
    function delRenderedNotes() {
    ctm.fillStyle = "black";
    ctm.fillRect(46, 24, Mwidth, Mheight);
    }

    // FETCH VALUES WHERE TO DRAW IN VIEW MODE
    function drawNotesCanvas(){
    startPoint=0;
    endPoint=Mwidth;
    editSPos=document.getElementById("SB").value;
    editEPos=document.getElementById("EB").value;
    TimeSPos=document.getElementById("EditStart").value;
    TimeSPos=parseInt(TimeSPos);
    TimeEPos=document.getElementById("EditEnd").value;
    TimeEPos=parseInt(TimeEPos);
    if (activetrack==0){
    for (var i=1;i<=maxtrack;i++){
    drawtrack=i;
    notePlot();
    }
    } else {
    drawtrack=activetrack;
    notePlot();
    }
    }

    // DRAWOUT NOTES ON MAIN CANVAS WHEN PAGE VIEW CHANGE
    function notePlot(){
    //console.log("NOTEPLOT TRACK="+drawtrack+" midiMess length="+track[drawtrack].midiMess.length);
    var plotRightSide=0;var plotLeftSide=0;
    var x=0;var z=0;var i=0;
    nbrOfEV = track[drawtrack].midiMess.length;
    distanceTotal=Mwidth-keylength;
    TimeTotal=TimeEPos-TimeSPos;
    while (x<nbrOfEV-1){
    if (track[drawtrack].midiMess[x].time>TimeSPos && track[drawtrack].midiMess[x].time<TimeEPos && track[drawtrack].midiMess[x].data0==NOTE_ON){

    TimeOnLeft=track[drawtrack].midiMess[x].time-TimeSPos;
    TimePerc=TimeOnLeft/TimeTotal;
    plotLeftSide=TimePerc*distanceTotal;
    z=x+1;
    TimeOnRight=TimeTotal-(TimeEPos-track[drawtrack].midiMess[z].time);
    TimePerc=TimeOnRight/TimeTotal;
    plotRightSide=TimePerc*distanceTotal;
    recLength=plotRightSide-plotLeftSide;
    ctm.fillStyle = trColor[drawtrack];
    ctm.fillRect(50+plotLeftSide,(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8)),recLength,keyHeight-1);

    //Saving the values of note graphic to array to compare with mouse
    graphNotePosX[i]=50+plotLeftSide;
    graphNotePosY[i]=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNoteLength[i]=recLength;
    graphNoteHeight[i]=keyHeight-1;
    graphNoteEvent[i]=x;
    i++;
    }
    x++;
    }
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@21:1/5 to All on Mon Oct 25 23:31:13 2021
    tisdag 26 oktober 2021 kl. 08:24:13 UTC+2 skrev Jonas Thörnvall:
    tisdag 26 oktober 2021 kl. 07:38:21 UTC+2 skrev Jonas Thörnvall:
    I have this function drawNotesCanvas that behave different depending on else leg although the same call to function as other leg?

    What i want todo is draw out all tracks if track is zero, track zero is the "downmix of all tracks", used during playup.

    But even if i hardcode channel and remove loop, it does not to what the other "single channel" else leg do. It has gotten me bewilderd for months "years".

    snippet
    ============
    if (activetrack==0){
    //for (var i=1;i<=maxtrack;i++){
    drawtrack=1; //1,2,3 or whatever channel do not do same as other leg notePlot();
    // }
    } else {
    drawtrack=activetrack;
    notePlot();
    }
    }

    fullcode
    ==================
    var graphNotePosX= [];
    var graphNotePosY= [];
    var graphNoteLength= [];
    var graphNoteHeight= [];
    var graphNoteEvent= [];
    var trColor=[];

    trColor[0]="yellow";
    trColor[1]="magenta";
    trColor[2]="lightgrey";
    trColor[3]="skyblue";
    trColor[4]="yellow";
    trColor[5]="fuchsia";
    trColor[6]="pink";
    trColor[7]="magenta";
    trColor[8]="orange";
    trColor[9]="cyan";
    trColor[10]="white";
    trColor[11]="lightgreen";
    trColor[12]="silver";
    trColor[13]="lightblue";
    trColor[14]="olive";
    trColor[15]="red";
    trColor[16]="aqua";

    // CLEAR NOTES ON CANVAS
    function delRenderedNotes() {
    ctm.fillStyle = "black";
    ctm.fillRect(46, 24, Mwidth, Mheight);
    }

    // FETCH VALUES WHERE TO DRAW IN VIEW MODE
    function drawNotesCanvas(){
    startPoint=0;
    endPoint=Mwidth;
    editSPos=document.getElementById("SB").value; editEPos=document.getElementById("EB").value; TimeSPos=document.getElementById("EditStart").value; TimeSPos=parseInt(TimeSPos); TimeEPos=document.getElementById("EditEnd").value; TimeEPos=parseInt(TimeEPos);
    if (activetrack==0){
    for (var i=1;i<=maxtrack;i++){
    drawtrack=i;
    notePlot();
    }
    } else {
    drawtrack=activetrack;
    notePlot();
    }
    }

    // DRAWOUT NOTES ON MAIN CANVAS WHEN PAGE VIEW CHANGE
    function notePlot(){
    //console.log("NOTEPLOT TRACK="+drawtrack+" midiMess length="+track[drawtrack].midiMess.length);
    var plotRightSide=0;var plotLeftSide=0;
    var x=0;var z=0;var i=0;
    nbrOfEV = track[drawtrack].midiMess.length; distanceTotal=Mwidth-keylength;
    TimeTotal=TimeEPos-TimeSPos;
    while (x<nbrOfEV-1){
    if (track[drawtrack].midiMess[x].time>TimeSPos && track[drawtrack].midiMess[x].time<TimeEPos && track[drawtrack].midiMess[x].data0==NOTE_ON){

    TimeOnLeft=track[drawtrack].midiMess[x].time-TimeSPos; TimePerc=TimeOnLeft/TimeTotal;
    plotLeftSide=TimePerc*distanceTotal;
    z=x+1;
    TimeOnRight=TimeTotal-(TimeEPos-track[drawtrack].midiMess[z].time); TimePerc=TimeOnRight/TimeTotal;
    plotRightSide=TimePerc*distanceTotal; recLength=plotRightSide-plotLeftSide;
    ctm.fillStyle = trColor[drawtrack]; ctm.fillRect(50+plotLeftSide,(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8)),recLength,keyHeight-1);

    //Saving the values of note graphic to array to compare with mouse graphNotePosX[i]=50+plotLeftSide; graphNotePosY[i]=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNoteLength[i]=recLength;
    graphNoteHeight[i]=keyHeight-1;
    graphNoteEvent[i]=x;
    i++;
    }
    x++;
    }
    }
    By the way when i look at the code i wrote some/ a year ago i think there must be dark sorcery going on. It manages to draw out notelength just using the noteOn event, or maybe it doesn't....
    Well i adjusted it apparently i thought i could just look at next event "or was lazy"....
    function notePlot(){
    //console.log("NOTEPLOT TRACK="+drawtrack+" midiMess length="+track[drawtrack].midiMess.length);
    var plotRightSide=0;var plotLeftSide=0;
    var x=0;var z=0;var i=0;
    nbrOfEV = track[drawtrack].midiMess.length;
    distanceTotal=Mwidth-keylength;
    TimeTotal=TimeEPos-TimeSPos;
    while (x<nbrOfEV-1){
    if (track[drawtrack].midiMess[x].time>TimeSPos && track[drawtrack].midiMess[x].time<TimeEPos && track[drawtrack].midiMess[x].data0==NOTE_ON){

    TimeOnLeft=track[drawtrack].midiMess[x].time-TimeSPos; TimePerc=TimeOnLeft/TimeTotal;
    plotLeftSide=TimePerc*distanceTotal;
    ////////////////////////////////////
    //THIS CODE FIND THE NOTE OFF EVENT
    var q=x+1;
    findNote=track[drawtrack].midiMess[x].data1;
    while (track[drawtrack].midiMess[q].data1!=findNote) {
    q++;
    }
    /////////////////////////////////// TimeOnRight=TimeTotal-(TimeEPos-track[drawtrack].midiMess[q].time); TimePerc=TimeOnRight/TimeTotal;
    plotRightSide=TimePerc*distanceTotal;
    recLength=plotRightSide-plotLeftSide;
    ctm.fillStyle = trColor[drawtrack]; ctm.fillRect(50+plotLeftSide,(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8)),recLength,keyHeight-1);

    //Saving the values of note graphic to array to compare with mouse graphNotePosX[i]=50+plotLeftSide; graphNotePosY[i]=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNoteLength[i]=recLength;
    graphNoteHeight[i]=keyHeight-1;
    graphNoteEvent[i]=x;
    i++;
    }
    x++;
    }
    So i fixed "drawout" for note lengths "note off" but the multitrack draw at track zero, remain unsolved anyone got any idea?
    http://jtmidi.000webhostapp.com/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@21:1/5 to All on Mon Oct 25 23:24:08 2021
    tisdag 26 oktober 2021 kl. 07:38:21 UTC+2 skrev Jonas Thörnvall:
    I have this function drawNotesCanvas that behave different depending on else leg although the same call to function as other leg?

    What i want todo is draw out all tracks if track is zero, track zero is the "downmix of all tracks", used during playup.

    But even if i hardcode channel and remove loop, it does not to what the other "single channel" else leg do. It has gotten me bewilderd for months "years".

    snippet
    ============
    if (activetrack==0){
    //for (var i=1;i<=maxtrack;i++){
    drawtrack=1; //1,2,3 or whatever channel do not do same as other leg notePlot();
    // }
    } else {
    drawtrack=activetrack;
    notePlot();
    }
    }

    fullcode
    ==================
    var graphNotePosX= [];
    var graphNotePosY= [];
    var graphNoteLength= [];
    var graphNoteHeight= [];
    var graphNoteEvent= [];
    var trColor=[];

    trColor[0]="yellow";
    trColor[1]="magenta";
    trColor[2]="lightgrey";
    trColor[3]="skyblue";
    trColor[4]="yellow";
    trColor[5]="fuchsia";
    trColor[6]="pink";
    trColor[7]="magenta";
    trColor[8]="orange";
    trColor[9]="cyan";
    trColor[10]="white";
    trColor[11]="lightgreen";
    trColor[12]="silver";
    trColor[13]="lightblue";
    trColor[14]="olive";
    trColor[15]="red";
    trColor[16]="aqua";

    // CLEAR NOTES ON CANVAS
    function delRenderedNotes() {
    ctm.fillStyle = "black";
    ctm.fillRect(46, 24, Mwidth, Mheight);
    }

    // FETCH VALUES WHERE TO DRAW IN VIEW MODE
    function drawNotesCanvas(){
    startPoint=0;
    endPoint=Mwidth;
    editSPos=document.getElementById("SB").value; editEPos=document.getElementById("EB").value; TimeSPos=document.getElementById("EditStart").value; TimeSPos=parseInt(TimeSPos); TimeEPos=document.getElementById("EditEnd").value; TimeEPos=parseInt(TimeEPos);
    if (activetrack==0){
    for (var i=1;i<=maxtrack;i++){
    drawtrack=i;
    notePlot();
    }
    } else {
    drawtrack=activetrack;
    notePlot();
    }
    }

    // DRAWOUT NOTES ON MAIN CANVAS WHEN PAGE VIEW CHANGE
    function notePlot(){
    //console.log("NOTEPLOT TRACK="+drawtrack+" midiMess length="+track[drawtrack].midiMess.length);
    var plotRightSide=0;var plotLeftSide=0;
    var x=0;var z=0;var i=0;
    nbrOfEV = track[drawtrack].midiMess.length;
    distanceTotal=Mwidth-keylength;
    TimeTotal=TimeEPos-TimeSPos;
    while (x<nbrOfEV-1){
    if (track[drawtrack].midiMess[x].time>TimeSPos && track[drawtrack].midiMess[x].time<TimeEPos && track[drawtrack].midiMess[x].data0==NOTE_ON){

    TimeOnLeft=track[drawtrack].midiMess[x].time-TimeSPos; TimePerc=TimeOnLeft/TimeTotal;
    plotLeftSide=TimePerc*distanceTotal;
    z=x+1;
    TimeOnRight=TimeTotal-(TimeEPos-track[drawtrack].midiMess[z].time); TimePerc=TimeOnRight/TimeTotal;
    plotRightSide=TimePerc*distanceTotal;
    recLength=plotRightSide-plotLeftSide;
    ctm.fillStyle = trColor[drawtrack]; ctm.fillRect(50+plotLeftSide,(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8)),recLength,keyHeight-1);

    //Saving the values of note graphic to array to compare with mouse graphNotePosX[i]=50+plotLeftSide; graphNotePosY[i]=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNoteLength[i]=recLength;
    graphNoteHeight[i]=keyHeight-1;
    graphNoteEvent[i]=x;
    i++;
    }
    x++;
    }
    }
    By the way when i look at the code i wrote some/ a year ago i think there must be dark sorcery going on. It manages to draw out notelength just using the noteOn event, or maybe it doesn't....
    Well i adjusted it apparently i thought i could just look at next event "or was lazy"....
    function notePlot(){
    //console.log("NOTEPLOT TRACK="+drawtrack+" midiMess length="+track[drawtrack].midiMess.length);
    var plotRightSide=0;var plotLeftSide=0;
    var x=0;var z=0;var i=0;
    nbrOfEV = track[drawtrack].midiMess.length;
    distanceTotal=Mwidth-keylength;
    TimeTotal=TimeEPos-TimeSPos;
    while (x<nbrOfEV-1){
    if (track[drawtrack].midiMess[x].time>TimeSPos && track[drawtrack].midiMess[x].time<TimeEPos && track[drawtrack].midiMess[x].data0==NOTE_ON){

    TimeOnLeft=track[drawtrack].midiMess[x].time-TimeSPos;
    TimePerc=TimeOnLeft/TimeTotal;
    plotLeftSide=TimePerc*distanceTotal;
    ////////////////////////////////////
    //THIS CODE FIND THE NOTE OFF EVENT
    var q=x+1;
    findNote=track[drawtrack].midiMess[x].data1;
    while (track[drawtrack].midiMess[q].data1!=findNote) {
    q++;
    }
    ///////////////////////////////////
    TimeOnRight=TimeTotal-(TimeEPos-track[drawtrack].midiMess[q].time);
    TimePerc=TimeOnRight/TimeTotal;
    plotRightSide=TimePerc*distanceTotal;
    recLength=plotRightSide-plotLeftSide;
    ctm.fillStyle = trColor[drawtrack];
    ctm.fillRect(50+plotLeftSide,(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8)),recLength,keyHeight-1);

    //Saving the values of note graphic to array to compare with mouse
    graphNotePosX[i]=50+plotLeftSide;
    graphNotePosY[i]=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNoteLength[i]=recLength;
    graphNoteHeight[i]=keyHeight-1;
    graphNoteEvent[i]=x;
    i++;
    }
    x++;
    }

    So i fixed "drawout" for note lengths "note off" but the multitrack draw at track zero, remain unsolved anyone got any idea?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@21:1/5 to All on Tue Oct 26 15:50:50 2021
    tisdag 26 oktober 2021 kl. 08:31:18 UTC+2 skrev Jonas Thörnvall:
    tisdag 26 oktober 2021 kl. 08:24:13 UTC+2 skrev Jonas Thörnvall:
    tisdag 26 oktober 2021 kl. 07:38:21 UTC+2 skrev Jonas Thörnvall:
    I have this function drawNotesCanvas that behave different depending on else leg although the same call to function as other leg?

    What i want todo is draw out all tracks if track is zero, track zero is the "downmix of all tracks", used during playup.

    But even if i hardcode channel and remove loop, it does not to what the other "single channel" else leg do. It has gotten me bewilderd for months "years".

    snippet
    ============
    if (activetrack==0){
    //for (var i=1;i<=maxtrack;i++){
    drawtrack=1; //1,2,3 or whatever channel do not do same as other leg notePlot();
    // }
    } else {
    drawtrack=activetrack;
    notePlot();
    }
    }

    fullcode
    ==================
    var graphNotePosX= [];
    var graphNotePosY= [];
    var graphNoteLength= [];
    var graphNoteHeight= [];
    var graphNoteEvent= [];
    var trColor=[];

    trColor[0]="yellow";
    trColor[1]="magenta";
    trColor[2]="lightgrey";
    trColor[3]="skyblue";
    trColor[4]="yellow";
    trColor[5]="fuchsia";
    trColor[6]="pink";
    trColor[7]="magenta";
    trColor[8]="orange";
    trColor[9]="cyan";
    trColor[10]="white";
    trColor[11]="lightgreen";
    trColor[12]="silver";
    trColor[13]="lightblue";
    trColor[14]="olive";
    trColor[15]="red";
    trColor[16]="aqua";

    // CLEAR NOTES ON CANVAS
    function delRenderedNotes() {
    ctm.fillStyle = "black";
    ctm.fillRect(46, 24, Mwidth, Mheight);
    }

    // FETCH VALUES WHERE TO DRAW IN VIEW MODE
    function drawNotesCanvas(){
    startPoint=0;
    endPoint=Mwidth;
    editSPos=document.getElementById("SB").value; editEPos=document.getElementById("EB").value; TimeSPos=document.getElementById("EditStart").value; TimeSPos=parseInt(TimeSPos); TimeEPos=document.getElementById("EditEnd").value; TimeEPos=parseInt(TimeEPos);
    if (activetrack==0){
    for (var i=1;i<=maxtrack;i++){
    drawtrack=i;
    notePlot();
    }
    } else {
    drawtrack=activetrack;
    notePlot();
    }
    }

    // DRAWOUT NOTES ON MAIN CANVAS WHEN PAGE VIEW CHANGE
    function notePlot(){
    //console.log("NOTEPLOT TRACK="+drawtrack+" midiMess length="+track[drawtrack].midiMess.length);
    var plotRightSide=0;var plotLeftSide=0;
    var x=0;var z=0;var i=0;
    nbrOfEV = track[drawtrack].midiMess.length; distanceTotal=Mwidth-keylength;
    TimeTotal=TimeEPos-TimeSPos;
    while (x<nbrOfEV-1){
    if (track[drawtrack].midiMess[x].time>TimeSPos && track[drawtrack].midiMess[x].time<TimeEPos && track[drawtrack].midiMess[x].data0==NOTE_ON){

    TimeOnLeft=track[drawtrack].midiMess[x].time-TimeSPos; TimePerc=TimeOnLeft/TimeTotal;
    plotLeftSide=TimePerc*distanceTotal;
    z=x+1; TimeOnRight=TimeTotal-(TimeEPos-track[drawtrack].midiMess[z].time); TimePerc=TimeOnRight/TimeTotal;
    plotRightSide=TimePerc*distanceTotal; recLength=plotRightSide-plotLeftSide;
    ctm.fillStyle = trColor[drawtrack]; ctm.fillRect(50+plotLeftSide,(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8)),recLength,keyHeight-1);

    //Saving the values of note graphic to array to compare with mouse graphNotePosX[i]=50+plotLeftSide; graphNotePosY[i]=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNoteLength[i]=recLength;
    graphNoteHeight[i]=keyHeight-1;
    graphNoteEvent[i]=x;
    i++;
    }
    x++;
    }
    }
    By the way when i look at the code i wrote some/ a year ago i think there must be dark sorcery going on. It manages to draw out notelength just using the noteOn event, or maybe it doesn't....
    Well i adjusted it apparently i thought i could just look at next event "or was lazy"....
    function notePlot(){
    //console.log("NOTEPLOT TRACK="+drawtrack+" midiMess length="+track[drawtrack].midiMess.length);
    var plotRightSide=0;var plotLeftSide=0;
    var x=0;var z=0;var i=0;
    nbrOfEV = track[drawtrack].midiMess.length; distanceTotal=Mwidth-keylength;
    TimeTotal=TimeEPos-TimeSPos;
    while (x<nbrOfEV-1){
    if (track[drawtrack].midiMess[x].time>TimeSPos && track[drawtrack].midiMess[x].time<TimeEPos && track[drawtrack].midiMess[x].data0==NOTE_ON){

    TimeOnLeft=track[drawtrack].midiMess[x].time-TimeSPos; TimePerc=TimeOnLeft/TimeTotal;
    plotLeftSide=TimePerc*distanceTotal;
    ////////////////////////////////////
    //THIS CODE FIND THE NOTE OFF EVENT
    var q=x+1;
    findNote=track[drawtrack].midiMess[x].data1;
    while (track[drawtrack].midiMess[q].data1!=findNote) {
    q++;
    }
    /////////////////////////////////// TimeOnRight=TimeTotal-(TimeEPos-track[drawtrack].midiMess[q].time); TimePerc=TimeOnRight/TimeTotal;
    plotRightSide=TimePerc*distanceTotal; recLength=plotRightSide-plotLeftSide;
    ctm.fillStyle = trColor[drawtrack]; ctm.fillRect(50+plotLeftSide,(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8)),recLength,keyHeight-1);

    //Saving the values of note graphic to array to compare with mouse graphNotePosX[i]=50+plotLeftSide; graphNotePosY[i]=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNoteLength[i]=recLength;
    graphNoteHeight[i]=keyHeight-1;
    graphNoteEvent[i]=x;
    i++;
    }
    x++;
    }
    So i fixed "drawout" for note lengths "note off" but the multitrack draw at track zero, remain unsolved anyone got any idea?
    http://jtmidi.000webhostapp.com/
    To be honest i am probably just silly about estethics, having all tracks up is probably just confusing but i wanted sort of a graphical overview of full song all tracks in different color just when loaded.
    And i tried to figure out what goes wrong quiet a few times....

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From luserdroog@21:1/5 to jonas.t...@gmail.com on Wed Oct 27 14:12:04 2021
    On Tuesday, October 26, 2021 at 12:38:21 AM UTC-5, jonas.t...@gmail.com wrote:
    //Saving the values of note graphic to array to compare with mouse graphNotePosX[i]=50+plotLeftSide; graphNotePosY[i]=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNoteLength[i]=recLength;
    graphNoteHeight[i]=keyHeight-1;
    graphNoteEvent[i]=x;

    I (and others) have tried suggesting better abstraction to make your code more readable.
    I think this block might be a good isolated example to try again.

    This code just looks wrong. It's not the best use of data structure organization.
    The graph note should be an object. All the named parts should be properties of the object. And then since you need and array of them, make an array of them.

    Consider if the code were rewritten like this (with corresponding changes to the data structure):

    graphNote[i].PosX=50+plotLeftSide;
    graphNote[i].PosY=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNote[i].Length=recLength;
    graphNote[i].Height=keyHeight-1;
    graphNote[i].Event=x;

    If this is the initialization of a new object, that could be made clearer by combining all the lines
    into a single assignment of a new object.

    graphNote[i] = {
    PosX=50+plotLeftSide,
    PosY=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8)),
    Length=recLength,
    Height=keyHeight-1,
    Event=x,
    };

    Or, you could go still further and wrap it in a function with a descriptive name:

    save_new_graph_note( i, drawtrack, x );

    Abstraction lets you write less code overall, have less code to read and debug, isolate changes
    to small parts of the program, and improve organization and efficiency. As a bonus,
    it makes the code easier for others to understand if they want to offer help.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@21:1/5 to All on Mon Nov 1 02:19:29 2021
    onsdag 27 oktober 2021 kl. 23:12:09 UTC+2 skrev luser...@gmail.com:
    On Tuesday, October 26, 2021 at 12:38:21 AM UTC-5, jonas.t...@gmail.com wrote:
    //Saving the values of note graphic to array to compare with mouse graphNotePosX[i]=50+plotLeftSide; graphNotePosY[i]=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNoteLength[i]=recLength;
    graphNoteHeight[i]=keyHeight-1;
    graphNoteEvent[i]=x;
    I (and others) have tried suggesting better abstraction to make your code more readable.
    I think this block might be a good isolated example to try again.

    This code just looks wrong. It's not the best use of data structure organization.
    The graph note should be an object. All the named parts should be properties of
    the object. And then since you need and array of them, make an array of them.

    Consider if the code were rewritten like this (with corresponding changes to the data structure):

    graphNote[i].PosX=50+plotLeftSide; graphNote[i].PosY=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8));
    graphNote[i].Length=recLength;
    graphNote[i].Height=keyHeight-1;
    graphNote[i].Event=x;

    If this is the initialization of a new object, that could be made clearer by combining all the lines
    into a single assignment of a new object.

    graphNote[i] = {
    PosX=50+plotLeftSide, PosY=(PistartX+keyHeight*88)-(keyHeight*(track[drawtrack].midiMess[x].data1-8)),
    Length=recLength,
    Height=keyHeight-1,
    Event=x,
    };

    Or, you could go still further and wrap it in a function with a descriptive name:

    save_new_graph_note( i, drawtrack, x );

    Abstraction lets you write less code overall, have less code to read and debug, isolate changes
    to small parts of the program, and improve organization and efficiency. As a bonus,
    it makes the code easier for others to understand if they want to offer help.
    Yeah you are probably correct, but of course that is really just a region of "graphics" that is compared with mouse to be able to know if you clicked inside or outside object.
    But i agree it probably would look more tidy comparing mouse position with properties of "graphical note" properties "it is just for open editor and read in note"

    But that is not what goes wrong here for some reason the multi track leg do not behave like the single track leg, even if content the same "that is weird".
    So i can make a copy and hardcode a track of single leg solution but it will not load "draw" that track.

    Similar now when i run "all" tracks to draw in a loop only track one is drawn. I **probably** could draw just track ZERO and get all the mixed down tracks, but then they would all have same colour and that is no fun.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)