COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 06-19-2016, 12:56 PM   #1
Tired_Joe
Human being with feelings
 
Join Date: Apr 2015
Posts: 55
Default isInChannelConnected() with Mono Tracks and Sidechain

Hello
I have some problems with the
Code:
isInChannelConnected()
function in combination with sidechains.

I need to know if the track in the DAW is mono or stereo.

I need these IO settings:
Code:
#define PLUG_CHANNEL_IO "2-1 4-2"   // For mono in + sc mono in -> mono out  and stereo in + sc stereo in -> Stereo out
#define PLUG_SC_CHANS 2
My problem is, with Cubase Mono tracks "isInChannelConnected()" dosent´t work well. If I call "isInChannelConnected()" for every channel (4 input channels for stereo), everything is "true" on a mono track!
With "#define PLUG_SC_CHANS 0" it works as espected. But I need the sidechains


I tried a lot of different combinations and this "hack" http://forum.cockos.com/showthread.p...annelConnected
But nothing helps.

For my plugin its important to have a 100% mono signalpath, because the i.e. left signal of a Stereo Sidechain has -3dB of the mono signal, because of the pan law.

My quick solution is to compile 2 plugins. 1 for Mono, 1 for Stereo but it´s nicer to have only one Plugin
Tired_Joe is offline   Reply With Quote
Old 06-20-2016, 02:19 PM   #2
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 331
Default

Is this an AU? The Plug implementation of AU is definitely broken in this regard. AAX works correctly, and I don't know about VST.
earlevel is offline   Reply With Quote
Old 06-20-2016, 11:40 PM   #3
Tired_Joe
Human being with feelings
 
Join Date: Apr 2015
Posts: 55
Default

Oh Sorry I want to use VST3.

If I set the channel io to "2-1 4-2"
The plugin creates automatically the max ins and outs (4-2) even on a mono track.

Is there a way to get informations about the track channel, not the plugin i/o? Maybe
Tired_Joe is offline   Reply With Quote
Old 09-28-2017, 04:18 AM   #4
Andi!
Human being with feelings
 
Andi!'s Avatar
 
Join Date: Nov 2015
Location: Germany
Posts: 82
Default

I can confirm that the VST3 implementation in IPlugVST3.cpp has a bug. In "process" with side chaining always the number of inputs will be assign that is defined in resource.h
If 4 are defined (2 in, 2 sc) and for mono the real number is lower (1 in, 1 sc), the coding is assigning 4 channels to the memory anyway resulting in freezes and crashes at least in Studio one and 32 bit versions. 64 bit versions could also crash or show the input signal instead the sc signal or weird random data.

The problems are these two lines, reporting too many channels to the cast in AttachInputBuffers:
https://github.com/olilarkin/wdl-ol/...gVST3.cpp#L476

Did anybody find a fix for it ? Otherwise I try it on myself.
Andi! is offline   Reply With Quote
Old 09-28-2017, 08:15 AM   #5
Youlean
Human being with feelings
 
Youlean's Avatar
 
Join Date: May 2015
Location: Serbia
Posts: 654
Default

Quote:
Originally Posted by Andi! View Post
I can confirm that the VST3 implementation in IPlugVST3.cpp has a bug. In "process" with side chaining always the number of inputs will be assign that is defined in resource.h
If 4 are defined (2 in, 2 sc) and for mono the real number is lower (1 in, 1 sc), the coding is assigning 4 channels to the memory anyway resulting in freezes and crashes at least in Studio one and 32 bit versions. 64 bit versions could also crash or show the input signal instead the sc signal or weird random data.

The problems are these two lines, reporting too many channels to the cast in AttachInputBuffers:
https://github.com/olilarkin/wdl-ol/...gVST3.cpp#L476

Did anybody find a fix for it ? Otherwise I try it on myself.
I think I have fixed that in my branch...
__________________
Website | Facebook Page | IPlug-Youlean
Youlean is offline   Reply With Quote
Old 09-28-2017, 11:55 AM   #6
Andi!
Human being with feelings
 
Andi!'s Avatar
 
Join Date: Nov 2015
Location: Germany
Posts: 82
Default

I didn't find any change in your branch at this location, I've implemented a correction in IPlugVST3.cpp on myself. Studio one doesn't crash anymore now and correctly connects mono & stereo channels (also when mono is side chained into stereo).
Reaper is now reacting when changing the routing for the side chain channels and it seems to work ! :-) Any comments ?

This is the implementation for kSample32-if, the same for kSample64 (with 32 replaced with 64):
PHP Code:
    if (data.numInputs)
    {
      if (
mScChans)
      {
        
int ninsum data.inputs[0].numChannels// At least the count of input channels
        
if (ninsum NInChannels()) ninsum NInChannels(); // Just to be sure
        
if (ninsum data.outputs[0].numChannelsninsum data.outputs[0].numChannels// E.g. studio one reports for mono tracks 2 ins and 1 out !
        
int mins ninsum// Real ins without sc

        
if (getAudioInput(1)->isActive())
        {
            
ninsum += data.inputs[1].numChannels;
            
mSidechainActive true;
        }
        else 
// Plug-in supports SC but it is not connected
        
{
          if (
mSidechainActive)
          {
            
ZeroScratchBuffers();
            
mSidechainActive false;
          } 
        }
        if (
ninsum NInChannels()) ninsum NInChannels(); // Sum higher than allowed resource.h count ? Cut...
        
SetInputChannelConnections(0ninsumtrue); // Connect the real number of channels...
        
SetInputChannelConnections(ninsumNInChannels() - ninsumfalse); // ... and disconnect others

        
AttachInputBuffers(0minsdata.inputs[0].channelBuffers32data.numSamples);
        if (
mSidechainActiveAttachInputBuffers(minsdata.inputs[1].numChannelsdata.inputs[1].channelBuffers32data.numSamples);
      }
      else
      {
        
SetInputChannelConnections(0data.inputs[0].numChannelstrue); // old solution is ok here
        
SetInputChannelConnections(data.inputs[0].numChannelsNInChannels() - data.inputs[0].numChannelsfalse);
        
AttachInputBuffers(0NInChannels(), data.inputs[0].channelBuffers32data.numSamples);
      }
    } 
Andi! is offline   Reply With Quote
Old 11-21-2017, 01:58 AM   #7
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 331
Default

Quote:
Originally Posted by Andi! View Post
Reaper is now reacting when changing the routing for the side chain channels and it seems to work ! :-) Any comments ?
Hi Andi—just getting to this, and gave it a quick try before calling it a night. My VST3 plugin works, as before, and now doesn't crash when I remove the plugin, but does crash when I then save the project. I'll have to look closer when I have time.

PS—After sending that and heading off to bed...I'd say you change fixed it, and there is another issue I have with both VST and VST3, only on Studio One. Youlean suggested the serialize state function, and that sounds likely.

Last edited by earlevel; 11-21-2017 at 10:53 AM.
earlevel is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:08 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.