HISE Logo Forum
    • Categories
    • Register
    • Login

    Problem with looppoints

    Scheduled Pinned Locked Moved General Questions
    25 Posts 2 Posters 1.0k 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.
    • T
      tiesvdam @tiesvdam
      last edited by

      @tiesvdam this is the code i made

      //AudioWave LAF
      const var SampleStart = Sampler1.SampleStart;
      const var SampleEnd = Sampler1.SampleEnd;
      const var laf = Engine.createGlobalScriptLookAndFeel();
      laf.registerFunction("drawThumbnailRange", function(g, obj) {
          g.fillAll(0);
          
          // Start point (using existing position property)
          var startX = obj.position * obj.area[2];
          g.setColour(0xFFFF5400);
          g.drawLine(startX, startX, 0, obj.area[3], 10.0);
          g.setColour(0xFFFFFFFF);
          g.drawLine(startX, startX, 0, obj.area[3], 1.5);
          g.setColour(0xffFFFFFF);
          g.setFont("regular", 12.0);
          g.drawAlignedText("Start Pt", [startX + 5, 5, 50, 20], "left");
          
          // End point (using new endPosition property)
          var endX = obj.endPosition * obj.area[2];
          g.setColour(0xFFFF5400);
          g.drawLine(endX, endX, 0, obj.area[3], 10.0);
          g.setColour(0xFFFFFFFF);
          g.drawLine(endX, endX, 0, obj.area[3], 1.5);
          g.setColour(0xffFFFFFF);
          g.setFont("regular", 12.0);
          g.drawAlignedText("End Pt", [endX - 55, 5, 50, 20], "right");
      });
      
      
      
      // Variables to store loop points
      const var loopPoints = {
          start: 0.0,
          end: 1.0,
          enabled: false,
          settingStart: true, // Flag to toggle between setting start and end points
          endPoint: 1.0 // Adding the EndPoint property to the object
      };
      
      
      
      
      laf.registerFunction("drawThumbnailRange", function(g, obj) {
          g.fillAll(0);
          
          // Draw playhead position
          var x = obj.position * obj.area[2];
          
          g.setColour(0xFFFF5400);
          g.drawLine(x, x, 0, obj.area[3], 10.0);
          
          g.setColour(0xFFFFFFFF);
          g.drawLine(x, x, 0, obj.area[3], 1.5);
          
          // Draw start point marker
              var startPointX = loopPoints.start * obj.area[2];
              g.setColour(0xFFFF5400);
              g.drawLine(startPointX, startPointX, 0, obj.area[3], 10.0);
              g.setColour(0xFFFFFFFF);
              g.drawLine(startPointX, startPointX, 0, obj.area[3], 1.5);
              g.setFont("regular", 12);
              g.setColour(Colours.white);
              g.drawAlignedText("Start", [startPointX - 0, 5, 40, 20], "centred");  // Tekst voor startpunt
          
          // Draw end point marker
          var endPointX = loopPoints.endPoint * obj.area[2];
          g.setColour(0xFFFF5400);
          g.drawLine(endPointX, endPointX, 0, obj.area[3], 10.0);
          g.setColour(0xFFFFFFFF);
          g.drawLine(endPointX, endPointX, 0, obj.area[3], 1.5);
          g.setFont("regular", 12);
          g.setColour(Colours.white);
          g.drawAlignedText("End", [endPointX - 40, 5, 40, 20], "centred");
      
      
          // Draw loop start and end markers if loop is enabled
          if (loopPoints.enabled) {
              var loopStartX = loopPoints.start * obj.area[2];
              var loopEndX = loopPoints.end * obj.area[2];
              
              // Draw loop region background
              g.setColour(Colours.withAlpha(0xFFFF5400, 0.15));
              g.fillRect([loopStartX, 0, loopEndX - loopStartX, obj.area[3]]);
              
              // Draw loop start marker
              g.setColour(0xFF8d478d);
              g.drawLine(loopStartX, loopStartX, 0, obj.area[3], 2.0);
              
              // Draw loop end marker
              g.setColour(0xFF8d478d);
              g.drawLine(loopEndX, loopEndX, 0, obj.area[3], 2.0);
              
              // Draw loop region border
              g.setColour(Colours.withAlpha(0xFFFF5400, 0.5));
              g.drawRect([loopStartX, 0, loopEndX - loopStartX, obj.area[3]], 1);
              
      
          }
      });
      
      laf.registerFunction("drawThumbnailPath", function(g, obj) {
          g.fillAll(obj.bgColour);
          
          var a = obj.area;
          g.setGradientFill([0xFFFF5400, a[0], a[1], 0xFF8d478d, a[2], a[3]]);
          g.drawPath(obj.path, obj.area,1.5);
          g.fillPath(obj.path, obj.area);
      });
      
      
      
      
      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @tiesvdam
        last edited by

        @tiesvdam said in Problem with looppoints:

        @d-healey Sorry what do you mean by a minimal example?

        a HISE snippet that contains only what's needed to demonstrate the issue

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

        T 1 Reply Last reply Reply Quote 0
        • T
          tiesvdam @d.healey
          last edited by

          @d-healey I think you need all i send in the snippet, because I think the problem is with the start/endmarker that I draw here

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

            @tiesvdam Make a new project, add in whatever is needed to demonstrate the issue - and no more than that. Then either send me the project folder (if I need some external files you are using) or post a snippet here - Export >> Export as HISE Snippet.

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

            T 1 Reply Last reply Reply Quote 0
            • T
              tiesvdam @d.healey
              last edited by

              @d-healey Ahh i understand. Than you need a project folder of mine. I use some png so the file is 25mb. Can I send it to you mail?

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

                @tiesvdam are the images required to demonstrate the issue?

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

                T 1 Reply Last reply Reply Quote 0
                • T
                  tiesvdam @d.healey
                  last edited by

                  @d-healey Trokeys kopie.zip

                  I fixed it, sorry. struggeling with files and that kind of things!

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

                    @tiesvdam Please make a separate minimal project that contains only what is needed to demonstrate the problem.

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

                    T 1 Reply Last reply Reply Quote 0
                    • T
                      tiesvdam @d.healey
                      last edited by

                      @d-healey This is what you need, it connected to a sampler. More minimal is not possible because it will not work

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        tiesvdam @tiesvdam
                        last edited by

                        @tiesvdam I deleted everything that is not required

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

                          @tiesvdam It contains quite a few things that aren't required, such as adsr, eq, fonts, preset browser, etc.

                          Make a new project, that contains just the absolute minimum to demonstrate the issue, it's much easier to find the cause of a problem, and the solution, when there is not extra stuff in the way.

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

                          T 1 Reply Last reply Reply Quote 0
                          • T
                            tiesvdam @d.healey
                            last edited by

                            @d-healey Trokeys kopie 2.zip

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

                              @tiesvdam

                              • You have two drawThumbnailRange functions.
                              • You should probably use local laf instead of global for this.

                              The laf function will trigger for all set ranges, so that includes the start/end position, and the loop ranges (and possibly sample start and release trigger, haven't tested). The solution is to ignore any ranges with an index greater than 0.

                              Here is a simplified snippet.

                              HiseSnippet 2718.3oc6Z07aaibEmRxLarZ17w1OPOrnfHnKfyVuxjTePIDzMxV1JVXksEjbxFff.2wjijlZRNLjTNVcwh9EJP+WXQuzS8VAVfdoGC5sBza8efdom5k8RO29F9g3PYkDaUEUi1UvvhyWu4898l489MCUGWpN1yi5JjI+gicvBYtgXuw19CaLDQrEZsMTu3gtzSvi8TE1ZrCxyCaHjIStGxZOypqHD74qdvVHSjsNNoJAgGSI531DKheRscp+IDSylHC7gDKtdWpdKcpcCpIcDnK4DkEbP5mfFf2Gw5VVQgcQdCEx7ghUL5ipXnUVVAWrpglphV4ZkzpHK22nph1wZGWDYfpnIKj4Z6XP7ot87Q9XOgLqrE0XbugzWXGNAOl3QN1DyJnHzCl4vpaRMMXlHqVgFCIlFchAIOAgLhcRfrbgP12RbOhAYR8IP2sCZPJYD7.XlroUuboTOEd0SlS8lgJkgSkVITktiXOcWhieRKL84aH1x1G61GA9IdUIruBY+6hhMnPOr8KXgNA2zEJLYDqoHWUdcI.nu28ymGbVd9RmhbkLQ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lpWW5HeH.a7AqEgk+8nib0w7mAmc8+QkkYkC1UfsMBJ7ufOQMpDefcViJwMJnGKJvdhdNLLZNbbL7LYMmldr2n98YpDD3UvKv4YwNXrXHcyjK59Hgot2BQQkBvIrI5chdo5L.R79b2LAxxBE2udPD9P9y4DYu3fvoBxR1kxtXiUDqHKzl9I3wQOuKI441zGyzYFztKI3QPlpZwJTzo3m7hB1UbCHdjq2FCc1H5UAswda1Z+MNr6Aa0ZiNsezCgBc28fs2YiSU2HvDOph7QFisQVDckibcUJ7BzoBaOxwjnCt9fe+FnvytZvdwEEKWpTEUA1AdLI9CiyEFbkCQ00FaOf8tTXctRwxpBgBnaf3VUrTUYY4BLai57jfUiAilULbuC3U6+w4hFUTUWm8tQpJWVHUh4LYCKZvFyGTekX+HfxS.WENvUgCbUVNfqBO3pNef6Df7Rhvy.MT4PCUNzPc4fFp7nQw4EMz.8RtzB.MJxgFE4PihKGznHOZTZ9PC1KXrRM4xUla33VSfiRbvQIN3nzxANJwCGkma3njZ4RxUmmnQSEWYRzn1OJm.WflhOXlAZJygdk4PuxKGzqLO5UYtQOspJZUjW.6spvAGU3fiJKG3nBObnMuvgpRwpJJKh.uZbvgFGbnsbfCMd3n5bCGkpAsrHh7VkCNpxAGUWNvQUd3n1bCGUKKWUoxB.NpwAG03fiZWV3n0bAG0Rw.TddwihpxZre8J+GiGZbLh03XDqIuTvCszLhUla7HvpW.AS03HwpwQhUSY4fGoHwpnN23QMkZU0t7QSWFGgbYLGVHcW5Q5g2DD6vpWOnFvGYG3bVUbOVYoY7aIzhXPNRWOsnN2.Um2AVbdGXo4cfkm2AVYdGn17Nvpu4Axt2vMG4SsBu2cAg85rS3MPjIgTYNg+Mfi+MpW
                              

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

                              T 2 Replies Last reply Reply Quote 0
                              • T
                                tiesvdam @d.healey
                                last edited by

                                @d-healey Thanks i will try it out! Thank you

                                1 Reply Last reply Reply Quote 0
                                • T
                                  tiesvdam @d.healey
                                  last edited by

                                  @d-healey Perfect, its not glitching anymore. But the sound does not loop yet. I would like that when it is played it plays in the area you selected with the end and start point

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

                                    @tiesvdam You need to modify it so that it edits the loop points instead of the sample start / end - or when you edit the sample start / end you set the loop points to match.

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

                                    T 2 Replies Last reply Reply Quote 0
                                    • T
                                      tiesvdam @d.healey
                                      last edited by

                                      @d-healey no idea how to do this but will try my best. Thanks for the info

                                      1 Reply Last reply Reply Quote 0
                                      • T
                                        tiesvdam @d.healey
                                        last edited by

                                        @d-healey How do you address the loop points? I want that when the sample start is determined, so also adjust the loop points

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

                                          @tiesvdam This post has some documentation about editing and accessing sample properties - it's a little out of date so if something doesn't quite work you might need to check in the docs - https://forum.hise.audio/topic/64/fun-with-regex

                                          Also take a look at the custom sample import project - https://github.com/christophhart/hise_tutorial/tree/master/CustomSampleImport

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

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

                                          13

                                          Online

                                          1.7k

                                          Users

                                          11.9k

                                          Topics

                                          103.6k

                                          Posts