HISE Logo Forum
    • Categories
    • Register
    • Login

    ExternalData and ReadLock

    Scheduled Pinned Locked Moved Solved Scripting
    snexexternaldatadatareadlock
    5 Posts 2 Posters 170 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.
    • ustkU
      ustk
      last edited by ustk

      Does it make sense to ReadLock data the way I do when you have more than one ExternalData?

      	void setExternalData(const ExternalData& ed, int index)
      	{
      		data = ed; // so data changes for each external table, right?
      		tableIdx = index;
      		
      		ed.referBlockTo(tableValues[tableIdx], 0);
      	}
      
      	float getSample(float input)
      	{
      		DataReadLock sl(data); // then, does this make sense???
      		
      		// and now, is data safe when reading any table? idx 0 here but could 17 or whatever...
      		auto interpolatedValue = tableValues[0][valueInterpolator];
      		return input * interpolatedValue;
      	}
      

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

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

        @ustk yup looks good, you can improve the performance by moving the lock acquisition outside the per sample call (so it is called once for each block).

        ustkU 3 Replies Last reply Reply Quote 1
        • ustkU
          ustk @Christoph Hart
          last edited by

          @Christoph-Hart Great! all I needed!

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

          1 Reply Last reply Reply Quote 0
          • ustkU ustk has marked this topic as solved on
          • ustkU
            ustk @Christoph Hart
            last edited by ustk

            @Christoph-Hart But I still don't understand data = ed
            It is to me like data is alternately one table at a time (and even only the last one) or I don't understand what ed is... Does it holds all externals at once?

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

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

              @Christoph-Hart And I get an error here

              	template <typename T> void process(T& data)
              	{
              		DataReadLock sl(data); // Can't find constructor that matches init values { $p0 }
              		
              		for(auto ch: data)
              		{
              			for(auto& s: data.toChannelData(ch))
              			{
              				s = getSample(s);
              			}
              		}
              	}
              

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

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

              43

              Online

              1.7k

              Users

              11.7k

              Topics

              101.8k

              Posts