fix channel resizing in HISE broke my routing
-
@d-healey all seems ok here. What has broken in yours specifically?
-
@DanH I'll make an example project shortly. Are you using a send container and send effects?
-
@d-healey Yes, just one send effect into one send container. Plus I'm using 6 channels elsewhere.
-
@Christoph-Hart @DanH I managed to recreate it in a minimal snippet
Notice on the master out there is nothing coming through on channels 1/2 (but there should be). If you bypass or remove the second container then it works. In commits prior to the one I linked to above it works with that container present and unbypassed.
HiseSnippet 1158.3oc6Y0raaaDDdokXpkSpaSQPQNxC8fCPZfjcZR.5AIaI4.g5eDDch6sf0jirVXxcYIWpTkh9fja80n2x0dquC8Tt42f1YIorHkoDjUkchMrNX3clc39syOeyPv19BKHHP3SzJcv.OfncOcyAbYu58nLNoUCh1WqG.b6NhPIie7VgGS1ZfGMH.rIZZEdoZWZkJRh9cZ0snNTtELRDg7ZAyB1g4xjij1t1Owbb1lZCGvbSs6mVqkkfWW3HBQDUPuLwiZcB8XXOpZaKoSztSSalT3aJoRHfnUbKg8.ydh2xi2+qYArib.0hJDS7AEKdagisBwJoj58XN1sGdyCHDsun8H+PgX+vCz2kYyNSdZ+gRgwHKR6OzVJK7JjAdURCuxofWNPRKEjJFCo6qaZ4y7jiznvyc0awkfeWJ51SCk38Rz9fdcAtAt7ItzSfs8wEmYvZOqb4Gaf+4Q+X2PtkjI3FB9dBIrOesGsxusRoU98ULFWU2t4pScL9BGGvOW0pHs+zLbMdn6Qf+iM5ScBgy1Hd8y5S0mrOMcH2J9VmZiBdKNStuGvmTh.IwUg+2qZ0fJop.QhLbedfujoffVCnOlUGGVJo2.BNQJ7v75yEyvrEgcnCUlMERU2jn.8AYhapfCOfIGjttZgkWMqP795sYRqd4iwkxAinm5x.iIUieodytcAK4H.VTe6e9xozK8wu7DHEuWTQEtB7qrHHD8lYBQsBWFDf5e1Q.daszMgZoLswtS74urtINPAdhpid0nEFwHZZkRO7CHd4bvAa+D.oJcH0TOgVba3WyDkKLyWgJW3NwSHLGcU9zjJlLe1tToOC8C56E5ZhbFVPhWS02TaIUGt30kUqUfPg4nE+K9KQYE0ZsDkUFpLcpzpw9g6pahTfQbiQtfuMZswgz9fwKAjbT4glVT8uW7Dj6aIwi+.eJOvSDj4AaBtrCDbkmdjvWEfCEA+RGUHKs75BpetpNs513kLWaLoxP+nX+lthPtLSI8TItqLmD2Euk39+IqTogXzj454.M48AGbRuHL9M3nccogNxgRylKuqfK75I3LqzA5N.VCd7wfeZrm6EZSoDe8lQRdPsNfCPSmz9c01AS1n9neBlSewBhd6g5wv0PU.Zb8sgaga1CudUzH3JtYyLLD95WKFBe+9feeF71a4zucX7apbCmut8qhlK9rR0zyJOuuD8oUyq98zp4W+hceuP0ue1MKVwYKhOc3c0UCekB2EPu9ENd+T+h1IiztZxHsc.ruyQIA2XQFwxxV10QHbMYuaXkye792+wpMntdHkQhnZarw+T8PPtCZsyns8WUa3OXLYer5gLa70BSI.ekI3cPpIYQo+4h6E0GmdqTtzaEGidSQZMQ5sgJqLlx0GRTpTt9XJ2PstPhxMlzPSyF5tXjuWePGYZnS6bnykZ4KdiU72IPksubjDLSfG8ggJouqZsQERz2N.sSu7SJSbQJ12XYop69drlMeaVeNrYi4vlmNG17CygMOaNr44ygMuXp1n5tsYnT3FyIiBZ2L5Cpno0jSw54HFGx+AxUL64
-
It works here. Are you using a Faust-enabled Hise version?
-
@orange I'm not using a faust version. Which commit are you using?
-
@d-healey said in fix channel resizing in HISE broke my routing:
@orange I'm not using a faust version. Which commit are you using?
I built Hise 3 days ago, but I am not sure if after this commit or not.
I asked Faust because all of my old projects are crashing when Faust is enabled. But they work without Faust without any issues. I can't open my projects!
-
@orange Please test with the commit I linked to if you have time (813c0a7ddd15242aecc0e85466522b8c8d7ae2be)
-
@d-healey Ok I'll test with that commit.
-
@d-healey Does the same as you described here :(
-
@d-healey Like yours here.
-
Thanks for confirming. I just tested further and the send effects have nothing to do with it. I've simplified the snippet
HiseSnippet 934.3oc6X80aSbDDe2XuU3.EUpPU8w6AdHHQQ1I7mJ0GHIN1HKHIV4BT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BMXFSU7FpZv10IGzhT7RLP+XMuaSRBxwdoP3JN+BRYq1m0WBe1XI74dKgO2eI74AKgOObI74WWnOtwaaka0IkjUTQ+NEuYGJsihi88EbDxGAq8fmJB
-
@Christoph-Hart Bump bump, this is a pretty big bug for anyone using more than one stereo out and more than one container.
-
the source code changed from:
#if FORCE_INPUT_CHANNELS
internalBuffer.makeCopyOf(buffer);
#endif
to:
#if FORCE_INPUT_CHANNELS
if(internalBuffer.getNumChannels() == buffer.getNumChannels())
internalBuffer.makeCopyOf(buffer);
#endif
Now when I add a 2nd container to the project, I don't get any sound from the output of HISE. I have to disable the 2nd container for it to work again. Do you know why?The code you provided has been modified to check the number of channels in the internalBuffer and in the input buffer before making a copy. It compares the number of channels in the internalBuffer and the input buffer and only makes a copy if the number of channels are the same. It seems that the issue you are experiencing is caused by the 2nd container having a different number of channels than the internalBuffer. In this case, the script doesn't make a copy of the buffer and the audio engine processes the buffer with the incorrect number of channels. The audio engine then doesn't produce any sound or produce sound that is not expected. You can fix this by checking the number of channels of the input buffer and the internalBuffer before making a copy. If the number of channels are not the same, you can use buffer.setSize() to change the number of channels to match the internalBuffer before making a copy.
can you show me how to adjust this code to check the number of channels of the input buffer and the internalBuffer before making a copy?
You can check the number of channels of the input buffer and the internalBuffer before making a copy using an if statement like this: if (FORCE_INPUT_CHANNELS) { if (buffer.getNumChannels() == internalBuffer.getNumChannels()) internalBuffer.makeCopyOf(buffer); } This way, if the number of channels in the input buffer and the internalBuffer match, the internalBuffer will make a copy of the input buffer. If the number of channels don't match, the internalBuffer will not make a copy, avoiding the problem you're facing. Please also note that, if you are sure about the number of channels of your audio file, you can always set the number of channels for the internalBuffer before making a copy of the input buffer, like this : if (FORCE_INPUT_CHANNELS) { internalBuffer.setSize(buffer.getNumChannels(), buffer.getNumSamples()); internalBuffer.makeCopyOf(buffer); }
In my current setup, I have 4 channels on my hise project. after updating the code to your suggestion, I'm seeing signal on the output of bus 3 even when nothing is playing
It seems like the problem might be that you are not handling the case where buffer.getNumChannels() is different than internalBuffer.getNumChannels(). In that case, the internalBuffer should be resized to match the number of channels of the input buffer, otherwise the makeCopyOf() function will copy the data into the wrong places. You can try this modification: if (FORCE_INPUT_CHANNELS) { if (buffer.getNumChannels() != internalBuffer.getNumChannels()) internalBuffer.setSize(buffer.getNumChannels(), buffer.getNumSamples()); internalBuffer.makeCopyOf(buffer); } This will check if the number of channels of buffer and internalBuffer match before making a copy, and if they don't match, it will resize internalBuffer to the number of channels of buffer before making the copy. This way the code should handle the case when the number of channels of buffer and internalBuffer don't match, and match the number of channels of input buffer before making the copy. Also, you should move the internalBuffer.setSize(buffer.getNumChannels(), buffer.getNumSamples()); out of the if statement, so in case force_input_channels is not defined it will set the size of internal buffer to the size of input buffer.
is this the right way to do your suggestion:
if (buffer.getNumChannels() == internalBuffer.getNumChannels())
internalBuffer.makeCopyOf(buffer);
else if (buffer.getNumChannels() != internalBuffer.getNumChannels())
internalBuffer.setSize(buffer.getNumChannels(), buffer.getNumSamples());
internalBuffer.makeCopyOf(buffer);Yes, that would be the correct way to implement my suggestion. It checks if the number of channels of the input buffer and internalBuffer match before making a copy, and if not, it resizes the internalBuffer to match the number of channels of the input buffer before making a copy. It's important to keep in mind that, if the input buffer has different number of channel than the internalBuffer, you should also make sure to clear the internalBuffer before making the copy, otherwise the previous content of the internal buffer would still be present and you will get unwanted signal in your output.
So... In short, I changed the code in hi_dsp/modules/ModulatorSynthChain.cpp , Line 252 from:
#if FORCE_INPUT_CHANNELS if(internalBuffer.getNumChannels() == buffer.getNumChannels()) internalBuffer.makeCopyOf(buffer); #endif
to:
#if FORCE_INPUT_CHANNELS if (buffer.getNumChannels() == internalBuffer.getNumChannels()) { internalBuffer.makeCopyOf(buffer); } else if (buffer.getNumChannels() != internalBuffer.getNumChannels()) { internalBuffer.setSize(buffer.getNumChannels(), buffer.getNumSamples()); internalBuffer.makeCopyOf(buffer); } #endif
@Christoph-Hart Is this the right way to do this? or do we need a "Human equivalent" solution?
EDIT:
simplifiedif (buffer.getNumChannels() != internalBuffer.getNumChannels()) internalBuffer.setSize(buffer.getNumChannels(), buffer.getNumSamples()); internalBuffer.makeCopyOf(buffer);
... and it works.... mostly. A couple of the routing meters show junk, but audio seems to work.
-
@Dan-Korneff Nah, we must not resize the buffers in the processing callback (in the other case it works because it just shrinks the array length without reallocating.
But I think I've fixed it. I also spent a new preprocessor macro
HISE_BACKEND_AS_FX
which will use the same processing style as a compiled FX plugin (so it will not render child synths and only the master FX chain). -
@Christoph-Hart does this also fixes my issue here?
https://forum.hise.audio/topic/7069/audio-inputs-aren-t-working-anymore -
-