HISE Logo Forum
    • Categories
    • Register
    • Login

    UI Thread vs Audio Thread (c++ nodes)

    Scheduled Pinned Locked Moved Solved C++ Development
    3 Posts 2 Posters 128 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.
    • griffinboyG
      griffinboy
      last edited by griffinboy

      Is it possible / straightforward to use the Hise threading system inside of a c++ node?

      I have a node that occasionally does heavy offline computations which will potentially choke the audio thread / eat up all the CPU headroom. I'm talking about stuff such as doing fft on a long audio file, or generating mipmaps for wavetables. It would be nice to run these on a less critical thread.

      I suppose a workaround would be to do any heavy calculations in small blocks,
      tackling a single block per iteration. But that seems a little wasteful.

      Alternatively:

      juce::ThreadPool ?
      

      What would you recommend @Christoph-Hart ?
      : )

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

        I don't think you can safely hook into the threading model of HISE with its dedicated loading / scripting threads as they don't work across DLL boundaries, but you can always spawn your own thread if you want to perform heavyweight tasks.

        I would just use the juce::Thread class to spawn a thread that performs the operation. Just make sure you are synchronizing the data access correctly so you don't end up with race conditions.

        griffinboyG 1 Reply Last reply Reply Quote 1
        • griffinboyG
          griffinboy @Christoph Hart
          last edited by

          @Christoph-Hart

          Thanks I'll look into it!

          1 Reply Last reply Reply Quote 0
          • griffinboyG griffinboy marked this topic as a question on
          • griffinboyG griffinboy has marked this topic as solved on
          • First post
            Last post

          25

          Online

          1.7k

          Users

          11.8k

          Topics

          102.8k

          Posts