Timer – Sleep, Pause, Wait

Home Forums General Programming Timer – Sleep, Pause, Wait

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #14436
    lfo2vco
    Participant
      • Topics: 26
      • Replies: 162
      • Total: 188
      • ★★

      Hi,

      I am wondering if anyone has created a wait function using the timer class? I have been scouring the net looking up examples of Lua sleep functions, but I get the impression these are problematic. I certainly have not been able to adapt anything so far.

      Just thinking I may be hitting my head against a brick wall regarding this one.

      Here is some noise I organised into an acceptable format:
      https://soundcloud.com/lfo2vco/a-dark-crystal

      #14465
      atom
      Keymaster
        • Topics: 159
        • Replies: 2945
        • Total: 3104
        • ★★★★★

        I can try to implement something like that and add that to the Lua API. Can you explain the situation you want to use that in ? In general you should never use a method like that, this is what most of people will tell you, i’m now one of those people but maybe we can work around the problem you have.

        #14476
        lfo2vco
        Participant
          • Topics: 26
          • Replies: 162
          • Total: 188
          • ★★

          Hi Atom, many thanks for responding.

          OK the situation is this: My panel has a feature to save the modulator settings to disk as a .syx file. On loading this file back into the panel the modulator values are reset from the data. As each modulator is set it sends its corresponding sysex message to the synth.
          However the resulting sound seems incomplete. This process generates a large amount of small sysex messages in a very short amount of time and probably swamps the synths processor.
          So one line of thought was to introduce a small ‘pause’ between each modulator being set, to give time for each resulting sysex message to get through.

          I understand that using ‘sleep’ is a big programming NO (I probably should not have refered to it in the title). I was thinking more along the lines of a ‘busy wait’ and wondered if anyone had used the ‘timer class‘ for something like this. I realise that timer intended for animation and that it requires a callback to work, so this is probably a very long shot. But hey if you don’t ask…

          Here is some noise I organised into an acceptable format:
          https://soundcloud.com/lfo2vco/a-dark-crystal

          #14478
          atom
          Keymaster
            • Topics: 159
            • Replies: 2945
            • Total: 3104
            • ★★★★★

            There are at least 2 ways out here

            1) there is a special delay setting for a panel that sets a time parameter for all MIDI messages, this parameter causes the messages to be dealyed before sending by that amount of time

            2) you should set the modulator values without sending MIDI, and then at the end (when all values are in place) trigger sending a snapshot to the device.

            #14480
            lfo2vco
            Participant
              • Topics: 26
              • Replies: 162
              • Total: 188
              • ★★

              Hi Atom, option 2 is the method I am currently employing, and it works well.

              I am also considering putting the disk data into a memory block, then sending it as a tone edit buffer dump to the synth. I figure I can then request the synth sends the dump back to the panel… that way the methods I have already in place for a patch change will process the dump and set the modulators.

              UPDATE: The above method works and uses less code, so that will do nicely. : )

              • This reply was modified 10 years, 5 months ago by lfo2vco.

              Here is some noise I organised into an acceptable format:
              https://soundcloud.com/lfo2vco/a-dark-crystal

            Viewing 5 posts - 1 through 5 (of 5 total)
            • The forum ‘Programming’ is closed to new topics and replies.
            There is currently 0 users and 64 guests online
            No users are currently active
            Forum Statistics
            Threads: 2,495, Posts: 17,374, Members: 77,605
            Most users ever online was 12 on January 22, 2019 3:47 pm
            Ctrlr