HISE Logo Forum
    • Categories
    • Register
    • Login

    Trouble with Array.contains()

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 36 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • VirtualVirginV
      VirtualVirgin
      last edited by

      Screenshot 2025-08-08 at 11.59.35 AM.png Screenshot 2025-08-08 at 12.00.30 PM.png

      in this function:

      inline function getAllNoteObjectsInTie(staffIndex, barNumber, noteObject)
      {
      	if (noteObject.type != "note" || !isTied(noteObject))
      		return;
      		
      	local objectIndex = findObjectIndexFromNOR(staffIndex, barNumber, noteObject);
      	local startAddress = findTieChainStart(objectIndex);
      	local intialNoteObject = scribeData[startAddress.staffIndex][startSddress.barNumber][startAddress.objectIndex];
      	local noteObjects = [];	
      	
      	noteObjects.push(intialNoteObject); // push the first noteObject in tieChain
      
      	local i = objectIndex +1;
      	
      	while (true)
      	{
      		local nextObj = findNextNoteObject(staffIndex, barNumber, i);
      		noteObjects.push(nextObj);
      		
      		Console.print("nextObj: " + trace(nextObj));
      		
      		if (nextObj.specialFlag.contains("tieEnd") || nextObj.type == undefined)
      			return noteObjects;		
      	}	
      	
      }
      

      Where the Console.print is clearly showing that

      nextObject.specialFlag does indeed contain "tieEnd":

      Interface: nextObj: {
        "noteObject": {
          "type": "note",
          "noteValue": "1/2",
          "x": "1/1",
          "y": [
            "D#6"
          ],
          "noteNumber": [
            75
          ],
          "direction": "down",
          "selected": [
            0
          ],
          "specialFlag": [
            null,
            "tieEnd"
          ],
          "attachments": {
            "stem": {
              "heightExtension": 0
            }
          }
        },
        "staffIndex": 0,
        "barNumber": 3,
        "objectIndex": 1
      }
      

      What might be causing the .contains not to work on an array?

      You can listen to my orchestral mockups here:
      https://www.virtualvirgin.net/

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @VirtualVirgin
        last edited by

        specialFlag is within noteObject, no?

        @VirtualVirgin said in Trouble with Array.contains():

        while (true)

        If your if statement is ever false you'll be trapped in this loop. Should you be incrementing i in this loop?

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        VirtualVirginV 1 Reply Last reply Reply Quote 1
        • VirtualVirginV
          VirtualVirgin @d.healey
          last edited by

          @d-healey Right on both counts of course!!

          You can listen to my orchestral mockups here:
          https://www.virtualvirgin.net/

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          21

          Online

          1.9k

          Users

          12.3k

          Topics

          107.0k

          Posts