HISE Logo Forum
    • Categories
    • Register
    • Login

    How do i get current project time?

    Scheduled Pinned Locked Moved General Questions
    20 Posts 3 Posters 491 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.
    • D
      dev2222
      last edited by

      Content.makeFrontInterface(383, 326);
      const var t = Content.getComponent("Table1");
      
      function updateTableValue() {
          const var currentTime = //get current time
          const var BPM = Engine.getHostBpm();
          const var secondsPerBar = 60 / BPM * 4;
          const var currentBars = currentTime / secondsPerBar;
          const var fractionalPart = currentBars - Math.floor(currentBars);
          t.setTableValue(0, Math.round(fractionalPart * 10) / 10);
          print("Current Bar Fraction: " + (Math.round(fractionalPart * 10) / 10));
      }
      
      function onTimer() {
          updateTableValue();
      }
      
      Engine.addTimerCallback(onTimer);
      

      I need to get project time to determine the 1bar

      d.healeyD D 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @dev2222
        last edited by d.healey

        @dev2222 said in How do i get current project time?:

        I need to get project time to determine the 1bar

        Use inline functions, not functions. Use local variables within inline functions.

        You can use Engine.getUptime() but you might be better off using the transport handler (depending on your use case).

        Engine.addTimerCallback isn't a thing. Neither is print - where are you getting this?

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

        1 Reply Last reply Reply Quote 0
        • D
          dev2222 @dev2222
          last edited by

          @dev2222 the things i wrote doesnt exist, they are made up so iil finish them later, and thanks for answer :)

          Christoph HartC 1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @dev2222
            last edited by

            That‘s your friend:

            Link Preview Image
            HISE | Docs

            favicon

            (docs.hise.dev)

            D 1 Reply Last reply Reply Quote 0
            • D
              dev2222 @Christoph Hart
              last edited by

              @Christoph-Hart hey i think there is little missunderstanding
              i need it get the current postion in one bar
              2d8f64d7-81a4-44c5-ae50-4098535d3322-obrazek.png

              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @dev2222
                last edited by

                @dev2222 use the grid callback. If you want a continous signal that scans through the table you will need to go scriptnode with a clock_ramp node.

                D 1 Reply Last reply Reply Quote 0
                • D
                  dev2222 @Christoph Hart
                  last edited by

                  @Christoph-Hart can you please help me with these 2? now main thing for me is to get the table1 show the 1bar position.
                  thanks

                  D 1 Reply Last reply Reply Quote 0
                  • D
                    dev2222 @dev2222
                    last edited by

                    @dev2222 the thing is i cant find anyhing related to grid callback

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

                      @dev2222 https://docs.hise.audio/scripting/scripting-api/transporthandler/index.html

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

                      D 1 Reply Last reply Reply Quote 0
                      • D
                        dev2222 @d.healey
                        last edited by

                        @d-healey

                        Content.makeFrontInterface(383, 326);
                        const var t = Content.getComponent("Table1");
                        const var transportHandler = Engine.createTransportHandler();
                        
                        inline function updateTableValue(gridIndex, timestamp, firstGridInPlayback) {
                            local BPM = Engine.getHostBpm();
                            local secondsPerBar = 60 / BPM * 4;
                            local currentBars = (gridIndex * secondsPerBar) / 8;  // Assuming 8 divisions in the grid
                            local fractionalPart = currentBars - Math.floor(currentBars);
                            t.setTableValue(0, Math.round(fractionalPart * 10) / 10);
                            Console.print("Current Bar Fraction: " + (Math.round(fractionalPart * 10) / 10));
                        }
                        
                        inline function onGridChange(gridIndex, timestamp, firstGridInPlayback) {
                            updateTableValue(gridIndex, timestamp, firstGridInPlayback);
                        }
                        
                        transportHandler.setOnGridChange(function(gridIndex, timestamp, firstGridInPlayback) {
                            onGridChange(gridIndex, timestamp, firstGridInPlayback);
                        });
                        
                        transportHandler.setEnableGrid(true, 8); // 8 divisions per bar
                        

                        i dont understand this, sometime it says 3 argumentss expected and now argument amount mismatch: 1, Expected: 2? i have no idea how to do this

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

                          @dev2222 I've not used the transport handler before so I can't help much with it. The argument amount mismatch will vary depending on the function.

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

                          D 1 Reply Last reply Reply Quote 0
                          • D
                            dev2222 @d.healey
                            last edited by

                            @d-healey is there any other way how to do the thing i need?

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

                              @dev2222 As Christoph said, the transport handler is the way to do this. But as a beginner you're going into something that isn't necessarily beginner level, so you might want to start with a simpler project.

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

                              D 1 Reply Last reply Reply Quote 0
                              • D
                                dev2222 @d.healey
                                last edited by

                                @d-healey i really need this to be fixed, i could pay

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

                                  @Lindon might be available to work with you.

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

                                  D 1 Reply Last reply Reply Quote 0
                                  • D
                                    dev2222 @d.healey
                                    last edited by

                                    Okay thanks, iil wait for his answer here

                                    Christoph HartC 1 Reply Last reply Reply Quote 0
                                    • Christoph HartC
                                      Christoph Hart @dev2222
                                      last edited by

                                      @dev2222 Not sure what you want to do with the table, but this snippet will show the position in the bar in the table scan position:

                                      HiseSnippet 1226.3ocuWE0SibCD1aBFNRgphz8CHOxIgPIWudsR8gCBPZiZCDcatnqOgLdcRrhW6U65EHspu2G6uo9K59GzN1dS1cIQARDEPBV6Y7Ledl4alc6EqnrjDULxa29SiXHu8v9Sk5wmMlvknNmi79ZbWRhlEW2sUqoQjjDV.xyq5OY1va2sP1e9xGZQDDIkkuEBMPworekGx04616jegKDsIAr97vBZ+tS5PUxyTBUJfmp3FnHBcBYD6RhQsJXj21WDv0pXeMQ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djfCNYA6iV+KO3r0B.6iOMHnuxmORlWj8hhf8veJBd8EVWS07yA.PqYNnF71sf.9srkTBTfisCVaeWnRzq8vgv+O1IYSY9OjEkMLb1SEYMFC8nrlxnlJXj3khZmj0.0UJg5RDUummJEXT1JHpNCrBh5CgEpkRMIjXm.tQuZ7Kx75PBMVcM08JHlf4qr6.UIR6GhtK7Ewv55K4E+CgOT7ZJsroV3fucSO32toG7ca5A+tM8fueSO32uoG7Gd7CZ9N9SS0pP2qUArfdW3nsdWHMbaKqC8eT5tLdM
                                      
                                      D 2 Replies Last reply Reply Quote 1
                                      • D
                                        dev2222 @Christoph Hart
                                        last edited by

                                        @Christoph-Hart oh god thanks so much! exectly what i need!!! 😁

                                        1 Reply Last reply Reply Quote 0
                                        • D
                                          dev2222 @Christoph Hart
                                          last edited by

                                          @Christoph-Hart do you know how i can implement the shape of the tables constrols gain in scriptnode without code?

                                          Christoph HartC 1 Reply Last reply Reply Quote 0
                                          • Christoph HartC
                                            Christoph Hart @dev2222
                                            last edited by

                                            @dev2222 sure, just put a peak node behind it and use it to modulate a multiplication node. If you want to reduce the zipper effect, put a smoothed_parameter node between them:

                                            HiseSnippet 1782.3oc2X8zTabCEWKFAAGnsoSl1dnG7gdfzjgACjPxzCw72TlFCdXMzzSLhc0h0vtRa2UFvsSmoG6sdN25WidqS+DzOJ4aP6SR6ZqEaLwNIzlZF.qmdRue5o26mdRMRDdzzTQBxobyNwTjyrX2NbYqMZQXbzNahb9.bcRpjlTwHZ8NwjzTpOxwozyTBblYRj9yqd55jPB2i1SDBcnf4QeNKhI6IsQsugEFtMwm1jEYo8J01wSv2PDJZC3oDdQTLw6TxIzcIJ0l.i9ZRZKjyWhWbkpAAOYUxpdzkVwe0GszpT+ioKErbf2iW02e4fpA9K8jG+PjyTa4yjhDWIQRSQNSttvuiaKw4biANjkxNNjpZTE4BV1HdaQnuZIpjh1nEKzuQtiJEgbvM541JYba2EWm4y5Jum66izcTo2HrcfNSTDdkJ.up1vaQK3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biuxVpxcNMtIEN2G02TiFtse0S621KNh1dVb81gRVbHCLReyOZzW7fwFI.LGdMe+lBW1I7dwc2nHXV7AwPsez5p.72F..Mh6AkgqC.cvNiNfP.qztowRcUfEx3lEGA+eASOiZxV9LVjZ3x4TYECj+M6bH0zds4P1qgovwTxkHnusgzP2Q+jxYi3ZXiuVhBcg3bpm47TM+qpz26hSiDBYKp+Qwc2n6BdkFSiMaJuqYZr8RCDUE7Yet9vAnDoEFfl86DG3D9Fc.2TX67k4vOGNmhjTYeEs8H3+w3n1gWgCu.ObIq7voGeh.n1rgvCalf9l50ZKEPVl4ZCCiP32d4K+89Ikq8qWlPPq2UCjOD6p2sfBS0uNi0z8yvuqW6FfUbF7VbU1t+vnDuTXqYyrPbZYC8jRd+QkF8ulvvIJjYWHlv4esXhW8zqHl3xXDstPbZDQWy+X8n.12i7CLcdarKjroehPc83ehtckukbFsxynP4hpaAWcHuR3e859Jgwu1uR3ddRv7MSH7zXQZQmKMh0TvUqwdBOHktcB862WQRXKeCAIYfc8pmtMrHG3XbIx1IZ1l76.Yce9RC6wGuxaJV7oMrze.2zdx+y8RjuG7DNEdehYxwnKScD6V7yngPhgFieLjIDPfZTykVLvttfKxuQbuc88ov04O4DZwz4AsfVSJIvc85J4t01mFRI1QveQMyYa5y6FOeQ0Q9giG390mgMvshJarx6uO8Vo+W+za2HuozMgMhHdIhixpyTEmdKsDXcy0GeOCttpckA7V5Q.K2QddEmp9F3Ri6.WdbG3Ji6.e33NvGMtCb0wcfO95Gn5PnrBXTolPgRM1xbwDm7p9fLBz+fJJ6Y4
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            48

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.8k

                                            Posts