HISE Logo Forum
    • Categories
    • Register
    • Login

    Debugging with Reaper

    Scheduled Pinned Locked Moved Bug Reports
    43 Posts 7 Posters 4.5k 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.healeyD
      d.healey
      last edited by

      Does it happen with the standalone version or just the plugin?

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

      Dan KorneffD 1 Reply Last reply Reply Quote 0
      • Dan KorneffD
        Dan Korneff @d.healey
        last edited by

        @d-healey I haven't tested standalone yet. I'm only getting reports from Reaper users about this one.
        Just to be sure, I should probably fire up Cubase and PT to check. 😼

        Dan Korneff - Producer / Mixer / Audio Nerd

        1 Reply Last reply Reply Quote 0
        • Dan KorneffD
          Dan Korneff
          last edited by

          The big issue I'm trying to track down is a Runtime error.. but I can't make it happen on my rig.

          runtime.jpg

          Dan Korneff - Producer / Mixer / Audio Nerd

          1 Reply Last reply Reply Quote 0
          • Dan KorneffD
            Dan Korneff
            last edited by

            In Cubase, I get some additional breakpoints:

            jassert (isPositiveAndBelow (sampleIndex, size));
            
                /** Returns a writeable pointer to one of the buffer's channels.
                    For speed, this doesn't check whether the channel number or index are out of range,
                    so be careful when using it!
                    Note that if you're not planning on writing to the data, you should
                    use getReadPointer instead.
                */
                Type* getWritePointer (int channelNumber, int sampleIndex) noexcept
                {
                    jassert (isPositiveAndBelow (channelNumber, numChannels));
                    jassert (isPositiveAndBelow (sampleIndex, size));
                    isClear = false;
                    return channels[channelNumber] + sampleIndex;
                }
            

            details

            -		this	0x000000002e92f110 {numChannels=2 size=0 allocatedBytes=0 ...}	juce::AudioBuffer<float> *
            
            		allocatedBytes	0	unsigned __int64
            +		channels	0x000000002e92f130 {0x000000005844f0f0 {-4.85710463e-17}}	float * *
            +		allocatedData	{data=0x0000000000000000 <NULL> }	juce::HeapBlock<char,1>
            +		preallocatedChannelSpace	0x000000002e92f130 {0x000000005844f0f0 {-4.85710463e-17}, 0x000000005844f8f0 {-4.85710463e-17}, 0x0000000000000000 {...}, ...}	float *[32]
            		isClear	false	bool
            		leakDetector1130	{...}	juce::LeakedObjectDetector<juce::AudioBuffer<float> >
            
            

            and

            jassert(sizeMatches && channelMatches);
            
            struct PointerWatcher
            {
            #if JUCE_DEBUG
            	PointerWatcher(ProcessData& data) :
            		dataToWatch(data),
            		c(data.numChannels),
            		size(data.size)
            	{
            		memcpy(reinterpret_cast<void*>(d), data.data, data.numChannels * sizeof(float*));
            	}
            
            	~PointerWatcher()
            	{
            		bool sizeMatches = dataToWatch.size = size;
            		bool channelMatches = dataToWatch.numChannels = c;
            
            		// You've managed to change the channel amount or block size during processing
            		jassert(sizeMatches && channelMatches);
            
            		for (int i = 0; i < c; i++)
            		{
            			if (dataToWatch.data[i] != d[i])
            			{
            				// You've managed to change the pointers during processing.
            				jassertfalse;
            			}
            		}
            	}
            

            Is it an issue with setting the channel amount at initialization?

            Dan Korneff - Producer / Mixer / Audio Nerd

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

              Test it with standalone before anything else. Using a DAW may complicate the issue if the problem has nothing to do with the DAW, and using two DAWs could be even less helpful. If there is no problem with the standalone then we look at the plugin.

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

              1 Reply Last reply Reply Quote 0
              • Dan KorneffD
                Dan Korneff
                last edited by

                Here's what I'm seeing on a standalone:

                Initialising Standalone Wrapper
                Creating Device Manager
                Create Main Processor
                Loading embedded image data
                Loading embedded impulse responses
                Loading embedded other data
                Creating Frontend Processor
                Create Shared Cache Pool for AudioFilePool
                Create Shared Cache Pool for ImagePool
                Create Shared Cache Pool for SampleMapPool
                Create Shared Cache Pool for MidiFilePool
                Initialising MainController
                Checking license
                Load images
                Load embedded audio files
                Load samplemaps
                Load Midi Files
                Restoring main container
                Compiling all scripts
                JUCE Assertion failure in juce_smoothedvalue.h:248
                Test_Debug x64.exe has triggered a breakpoint.
                
                JUCE Assertion failure in juce_audiosamplebuffer.h:347
                Test_Debug x64.exe has triggered a breakpoint.
                
                Adding plugin parameters
                Restoring global settings
                Setting disk mode
                Samples are validated. Skipping reference check
                Loading samples
                Initialise Audio Driver...
                Audio Driver Default Initialisation
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\dsound.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\MMDevAPI.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\devobj.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\wdmaud.drv'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\ksuser.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\avrt.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\AudioSes.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\msacm32.drv'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\msacm32.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\midimap.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\ResourcePolicyClient.dll'. Symbols loaded.
                Error initialising with default settings: The input and output devices don't share a common sample rate!
                OK
                Creating Interface
                Creating Root Panel
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\d2d1.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\DWrite.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\d3d10warp.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\mscms.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\userenv.dll'. Symbols loaded.
                'Test_Debug x64.exe' (Win32): Loaded 'C:\Windows\System32\coloradapterclient.dll'. Symbols loaded.
                JUCE Assertion failure in juce_smoothedvalue.h:248
                Test_Debug x64.exe has triggered a breakpoint.
                
                Resizing interface
                Change scale factor
                The thread 0x4174 has exited with code 0 (0x0).
                The thread 0x4fe0 has exited with code 0 (0x0).
                The thread 0x4f5c has exited with code 0 (0x0).
                The thread 0x271c has exited with code 0 (0x0).
                

                It couldn't initialize the audio driver, but I'm not sure if that's an issue or not. It did, however, have the same 2 SampleRate breakpoints as exibited in the plugin version.

                JUCE Assertion failure in juce_smoothedvalue.h:248
                JUCE Assertion failure in juce_audiosamplebuffer.h:347
                

                Dan Korneff - Producer / Mixer / Audio Nerd

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

                  I don't know if this is part of the issue
                  Error initialising with default settings: The input and output devices don't share a common sample rate!

                  Is it a control on your interface that is triggering the failure in juce_smoothedvalue?

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

                  Dan KorneffD 1 Reply Last reply Reply Quote 0
                  • Dan KorneffD
                    Dan Korneff @d.healey
                    last edited by

                    @d-healey said in Debugging with Reaper:

                    Is it a control on your interface that is triggering the failure in juce_smoothedvalue?

                    I'm dissecting the code now.

                    Dan Korneff - Producer / Mixer / Audio Nerd

                    1 Reply Last reply Reply Quote 0
                    • Dan KorneffD
                      Dan Korneff
                      last edited by Dan Korneff

                      Making some progress. I've found the cause of the following breakpoint

                      bool LockHelpers::noMessageThreadBeyondInitialisation(const MainController* mc)
                      {
                      	bool ok = !isMessageThreadBeyondInitialisation(mc);
                      
                      	// If you hit this assertion, it means you have called a function
                      	// from the message thread that you are not supposed to do
                      	jassert(ok);
                      
                      	return ok;
                      
                      }
                      

                      Here's a minimized snippet of the problem code:

                      HiseSnippet 1034.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mymnqmqeHQHn7zMQg.u5Q5CteGoqpG.urf4NtTlvjkkAujTktVSGxakyTLwzyHpDFLkuy4yhFAubhOsawtE3t0C0BO41dZacC6HpHHy3efmBvVZaqBvVU.OXgsF7fJfGZBdXEv1lfsq.djI3QU.O1D73JfO0Dbow+QE1++.8VGnQD+D468yaF0RAOLyCzRJxdq253yz1NsPYSMPdXu88PQvag9dees.02ChaqOmC1fbNbCxo8FjyQaPNGuA47zMHmm8YyQ+O.7pYJYT9OdANF1OaTvxpuf.BUYZxn+Ef8sq2H
                      

                      The code uses a scriptFX module to collect the Host sample rate and passes that to a global variable. I'm using a deferred callback to set the text of a label to the global variable.

                      Here's a thread where we originally discussed this method:
                      https://forum.hise.audio/topic/2054/convolution-gain-louder-at-higher-sample-rates/18

                      Dan Korneff - Producer / Mixer / Audio Nerd

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

                        Does the problem occur if you don't defer the callback?

                        Oh never mind, I just looked at the thread you linked to. Christoph suggested deferring the on init callback. Have you tried that?

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

                        Dan KorneffD 1 Reply Last reply Reply Quote 0
                        • Dan KorneffD
                          Dan Korneff @d.healey
                          last edited by

                          @d-healey said in Debugging with Reaper:

                          Christoph suggested deferring the on init callback. Have you tried that?

                          I believe that's what I'm doing. onInit looks like this:

                          Content.makeFrontInterface(200, 100);
                          
                          global HostSampleRate;
                          const var SampleRateLabel = Content.getComponent("SampleRateLabel");
                          
                          
                          //Defer SampleRate Timer
                          const var DeferTimerStart = Engine.createTimerObject();
                          DeferTimerStart.startTimer(100);
                          var dt = 0;
                          
                          DeferTimerStart.setTimerCallback(function()
                          {
                          	dt = dt+1;
                          	if (dt == 5)
                              {
                                  SampleRateLabel.set("text","Sample Rate: " + HostSampleRate);
                                  DeferTimerStart.stopTimer();
                              }
                          });
                          

                          Dan Korneff - Producer / Mixer / Audio Nerd

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

                            Synth.deferCallbacks(true); is what you need. It will defer all callbacks in that script (which is what you generally want in an interface script).

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

                            1 Reply Last reply Reply Quote 0
                            • Dan KorneffD
                              Dan Korneff
                              last edited by

                              just posting some notes here for when I forget what I did 2 weeks ago 🙃

                              Separate MIDI processing logic from Interface scripts
                              Although both things can be achieved with the same module (the Script Processor), it can be considered as good practice to keep these two things separated. The reason is (apart from the usual encapsulation benefits) a huge performance increase if you defer the interface script.
                              
                              Deferring a script means running all callbacks that are triggered by MIDI messages or the timer on the message thread instead of the audio thread. It comes with some trade-offs (you can't change the midi message with a deferred callback or rely on the accuracy of the timer), but since it is not running on the audio thread, you can do (almost) whatever you want in any of the callbacks without having to risk a drop out (in the worst case, the interface will get laggy).
                              
                              Deferring a script is simple: just call
                              
                              Synth.deferCallbacks(true);
                              and from then, the callbacks will stay away from the audio thread.
                              
                              These are some things that heavily rely on the deferred callback feature:
                              
                              setting text values of labels according to MIDI input
                              using the timer for animation purposes
                              heavy calculations from MIDI input
                              

                              Dan Korneff - Producer / Mixer / Audio Nerd

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

                                It's also covered here in the docs:

                                Link Preview Image
                                HISE | Audio Modules | Script Processor

                                MIDI Processor that allows scripting.

                                favicon

                                (docs.hise.audio)

                                1 Reply Last reply Reply Quote 1
                                • Dan KorneffD
                                  Dan Korneff
                                  last edited by

                                  @d-healey Synth.deferCallbacks(true); worked like a charm!

                                  Next up: While playing audio in a loop, I'm getting a breakpoint at:

                                  JUCE Assertion failure in customdatacontainers.h:933
                                  
                                  	/** Adds an element to the queue. If it fails because the queue is full, it throws an assertion and return false. */
                                  	bool push(const ElementType& newElement)
                                  	{
                                  		const bool ok = queue.try_enqueue(std::move(newElement));
                                  		jassert_skip_unit_test(ok);
                                  		return ok;
                                  	}
                                  

                                  Dan Korneff - Producer / Mixer / Audio Nerd

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

                                    Looks like something to do with arrays perhaps...?

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

                                    Dan KorneffD 1 Reply Last reply Reply Quote 0
                                    • Dan KorneffD
                                      Dan Korneff
                                      last edited by Dan Korneff

                                      I forgot to mention... Standalone loads properly after deferring the callback. I have now moved on to vst3/Reaper testing

                                      @Christoph-Hart It throws this error continuously while audio is playing.

                                      Dan Korneff - Producer / Mixer / Audio Nerd

                                      1 Reply Last reply Reply Quote 0
                                      • Dan KorneffD
                                        Dan Korneff @d.healey
                                        last edited by

                                        @d-healey The main header reads:

                                        /** A wrapper around moodycamels ReaderWriterQueue with more JUCE like interface and some assertions. */
                                        

                                        I'm thinking it's not array data.

                                        Dan Korneff - Producer / Mixer / Audio Nerd

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

                                          @dustbro First time I've heard of moodycamels! Something to do with this I think - https://moodycamel.com/blog/2014/a-fast-general-purpose-lock-free-queue-for-c++

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

                                          1 Reply Last reply Reply Quote 1
                                          • Dan KorneffD
                                            Dan Korneff
                                            last edited by

                                            it must have something to do with the message thread and the audio thread.

                                            Dan Korneff - Producer / Mixer / Audio Nerd

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

                                            22

                                            Online

                                            1.8k

                                            Users

                                            12.0k

                                            Topics

                                            104.5k

                                            Posts