HISE Logo Forum
    • Categories
    • Register
    • Login

    Rounding the sharpness of the display buffer graph

    Scheduled Pinned Locked Moved General Questions
    11 Posts 2 Posters 254 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.
    • orangeO
      orange
      last edited by

      I can get the graph below, but is there any chance we can round these sharp lines?

      Pnlll2.gif

      const var dp = Synth.getDisplayBufferSource("HardcodedMasterFX");
      const var gr = dp.getDisplayBuffer(0);
      
      gr.setRingBufferProperties({
      "BufferLength": 65536,
      "NumChannels": 1
      });
      
      const var Panel1 = Content.getComponent ("Panel1");
      const var a = Panel1.getLocalBounds(0);
      const var Cmpt = Engine.createTimerObject();
      
      Cmpt.setTimerCallback(function()
      {	
      	Panel1.setPaintRoutine(function(g)
      	{
      		g.setColour (this.get("bgColour"));
      		g.fillRect(a);
      		g.setColour(this.get("itemColour"));
      		var p = gr.createPath(a, [0,1,0,-1], 1.0);
      		g.fillPath(p, a);
      	});
      });
      
      Cmpt.startTimer(40);
      
      

      For example like this:

      Screen Shot 2024-11-15 at 11.54.29.png

      develop Branch / XCode 13.1
      macOS Monterey / M1 Max

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @orange
        last edited by

        @orange I've added a Path.roundCorners(var radius) some times ago

        Can't help pressing F5 in the forum...

        orangeO 1 Reply Last reply Reply Quote 2
        • orangeO
          orange @ustk
          last edited by

          @ustk said in Rounding the sharpness of the display buffer graph:

          @orange I've added a Path.roundCorners(var radius) some times ago

          That's great. I tried below method but this doesn't work.

          p1 = gr_peakreduct.createPath([a[0], a[1], a[2], a[3]], [0,1,0,-1], 1.0);
          
          p1r = p1.roundCorners(10);
          	
          g.fillPath(p1r, a);
          

          develop Branch / XCode 13.1
          macOS Monterey / M1 Max

          ustkU 2 Replies Last reply Reply Quote 0
          • ustkU
            ustk @orange
            last edited by ustk

            @orange Strange, that's the way I use it myself in many projects where it works...
            And 10 seem to be large enough... Still, have you tried to increase it?

            Can you put together a minimal snippet that shows the issue?

            Can't help pressing F5 in the forum...

            orangeO 1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @orange
              last edited by ustk

              @orange You can also try to reduce the width for which you create the path. Using a (so a[2]) means that the path will be create with a 1 pixel granularity regarding the size of the panel. Reducing that value will lead in a smoother path, that you can then draw in the full panel's size so in definitive, reduce the granularity. Then roundCorners should work.

              Can't help pressing F5 in the forum...

              1 Reply Last reply Reply Quote 0
              • orangeO
                orange @ustk
                last edited by

                @ustk said in Rounding the sharpness of the display buffer graph:

                Can you put together a minimal snippet that shows the issue?

                No luck, it gives "undefined parameter" error. This is the basic snippet.

                HiseSnippet 2602.3oc0Y0ubaaiDmz1vwVINMe0o2exwy8GJ8bTIojnjtN2D+chuDGqwxmamwSmLPjPRLlhfkDJ155z++dq58.bOD2iPdC5s.fTjTR1VQwMsmSFYicA18GVrefEpYH0lDEQCUTKbxv.hh58PsF5y5sSOrquxA6pntLZGG+9JaOL.GEQbTTUW7Ebdpqtjh3mO77swdXeaRJIEkSot1jW612kkRs4lux0yaerC4D29YlckMOvl5uC0iN.vwhHck.r843tj2f4SaAjxKwQ8TT+ZjYsFFVsM0MaztFoBwriAob6N0bLzKqWAaVurUGrkAtAf58bbYzvVLLiDontz1Tmgs5QuvWpfSciba6Q3CLTZAZVRdepmCeKxoprSOWOmlIFnHEEUTyTy0hRy0SPG553NhdpY6ABFZoqHqATcg7vawbvyHK7zy.uo.I0LPZIIjdHpkcna.KkCGO2EcfOiD1ACmSYghbtJKbvRncnvL7Yk5iOmreHLXzJJZoqugF7wS+1BhefyqHl16wgZNAuMffOOj3Lvlo82zDdOk5RX65FE3gGt8fNcHgsfiVPLquCsePn.TqChJUJcCyKkbRcBoUTfibqoTDgcrqeW4Dfsd.Ij4RhJ9SEVWR60D+trdq+W0rpVsr0FEV+MC5CGW99DuHfpQgeNdykhpl9duk6q+1iE5vk5CPKwJAfhuan9v.shqO4b46vLBCCq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9PwCDBn04tWAL9vymEyAHEZH6UjgQeJVDXyDPHNuxm1dbA7jIsFOHV.Pso1zsoWJDwiPsH+3.disiHO6anLPYMjL21wX+tj4a2rJpUO3VAdj4yC6tHYxpSbIW2VXIo.dTN82jeYe4yUljFNCiwk1u3vKnoVEU1pzG6OJyNRNk3QscYCmDIH0U.bjCEc9KauE74ee2RkJOnYx3FuZJi8oMmYT7Hj7q9Y1vv4bczjigum1L21Ny3SEXLGFtNGzGhheglVPaPhdktY+yoJnuBcz.Vv.1sj3dH5vl60h+UKDKvI7ZmwHvufKn87ctBwnu4r37uL5k713mLv4O9OQctxhqlfwVt79H1y+8PP.PgiwGghayMgZ9piGR8oIutWpA3XBKzsaWRt6rL0MTbK+Yxflz38HR+4MeMzgIN7PQiCyksv3i9qjdpmW+o3WnPieGUsOkysklsysq+1V2JeMCKNSeMC253c9+JG9rZ532Q8x++4jFx1FYapINt098+79ywWZwmCczGaGReqsrf.OgwJBJv91W7hDqhNjOVyXxRA8gVbdqscdQMwBMm2EVddWXk4cgUm2EZMuKr17tv527B4cfF+9c73DnS7l6Id3DUU48ZEgLJ+OVyXWs.
                

                develop Branch / XCode 13.1
                macOS Monterey / M1 Max

                ustkU 1 Reply Last reply Reply Quote 0
                • ustkU
                  ustk @orange
                  last edited by ustk

                  @orange Oh wait... Can you please make a search in the Hise folder for this function roundCorners?

                  I might just have it locally and didn't make a pull-request...

                  Can't help pressing F5 in the forum...

                  orangeO 1 Reply Last reply Reply Quote 0
                  • orangeO
                    orange @ustk
                    last edited by orange

                    @ustk

                    I've already checked that. It shows up in the API list.

                    Screen Shot 2024-11-15 at 22.46.12.png

                    develop Branch / XCode 13.1
                    macOS Monterey / M1 Max

                    ustkU 1 Reply Last reply Reply Quote 0
                    • ustkU
                      ustk @orange
                      last edited by ustk

                      @orange Oh yes

                      The function does not return a new path but modifies the existing one. so just drop the p1r

                      And to reduce the number of points:

                      p1 = gr_peakreduct.createPath([a[0], a[1], a[2]*0.2, a[3]], [0,1,0,-1], true); // a[2]*20%
                      

                      But although it works, it looks weird when I am testing it.
                      In my projects I tend to get the raw buffer and create the path from scratch myself instead of calling DisplayBuffer.createPath()

                      But since I use it essentially for spectrum curves, it might be an issue with the kind of signal you're using :man_shrugging:

                      Can't help pressing F5 in the forum...

                      orangeO 1 Reply Last reply Reply Quote 0
                      • orangeO
                        orange @ustk
                        last edited by

                        @ustk
                        I already modified the existent path, did you see the snippet?
                        I think this won’t work because of the same error.

                        develop Branch / XCode 13.1
                        macOS Monterey / M1 Max

                        ustkU 1 Reply Last reply Reply Quote 0
                        • ustkU
                          ustk @orange
                          last edited by

                          @orange Yes I did, but I don't see where this path has been modified, the width is still the one from the panel with no reduction

                          p1 = gr_peakreduct.createPath([a[0], a[1], a[2], a[3]], [0,1,0,-1], 1.0);
                          

                          [a[0], a[1], a[2], a[3]] this is equivalent to just write a

                          Can't help pressing F5 in the forum...

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

                          29

                          Online

                          1.7k

                          Users

                          11.7k

                          Topics

                          102.3k

                          Posts