Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Changing Channel Counts
Avatar
DrWig
Member
Members
March 9, 2020 - 7:08 pm
Member Since: September 15, 2015
Forum Posts: 16
sp_UserOfflineSmall Offline

I'm looking at porting my Ambisonic plug-ins to ASPiK.  Looking at the plugin kernel -> pluginstructures.h, I can add kCF values for Ambisonics and add the channel count to the getChannelCountForChannelIOConfig type functions.  However, these seem to have no effect on the compiled plugin, and (for VST3, anyway), it seems like the project has the plug-ins hardcoded to be 2 channel in, 2 channel out.  I can fix this by editing the VSTPlugin.cpp

and changing the Initialize function to contain (for example)

            addAudioInput(STR16("Mono Input"), SpeakerArr::kMono);

            addAudioOutput(STR16("Amb Output"), SpeakerArr::kAmbi1stOrderACN);

Is this how it's supposed to work?  It doesn't seem like the kCF constants do what they're supposed to do.....am I missing something?

cheers

Bruce

Avatar
DrWig
Member
Members
March 9, 2020 - 8:07 pm
Member Since: September 15, 2015
Forum Posts: 16
sp_UserOfflineSmall Offline

After a bit more investigation, it does work, but it's not possible to set different input and output channel number combinations (i.e. mono in, 1st order Amb out).  Also, adding new arrangements is a little involved.  It would likely be easier is the number of channels in and out could just be specified.

Currently, to add Ambisonics as a format I had to add:

in pluginstructures.h

enum channelFormat
{
...
   
//Add Ambisonic Channel Counts
    kCFAmb1o,
    kCFAmb2o,
    kCFAmb3o,
}

uint32_t getDefaultChannelIOConfigForChannelCount(uint32_t channelCount) //Don't think this was actually necessary!
{
        switch(channelCount)
        {
            case 4:
                return kCFAmb1o; // or kCFLCR
            case 9:
                return kCFAmb2o; // or kCF9p0
            case 16:
                return kCFAmb3o;
        }
}

uint32_t getChannelCountForChannelIOConfig(uint32_t format)
{
        switch(format)
        {
             case kCFQuad:
             case kCFLCRS:
             case kCFAmb1o:
                      return 4;

            case kCF8p1:
             case kCF9p0:
            case kCFAmb2o:
                return 9;

            case kCFAmb3o:
                return 16;
         }
}

In VSTCore -> channelformats.h

uint32_t getChannelFormatForSpkrArrangement(SpeakerArrangement arr)
{
    switch(arr)
    {
        case SpeakerArr::kAmbi1stOrderACN: {
            return kCFAmb1o; } 

        case SpeakerArr::kAmbi2cdOrderACN: {
            return kCFAmb2o; }        

        case SpeakerArr::kAmbi3rdOrderACN: {
            return kCFAmb3o; }
     }
}

In plugincore.cpp

constructor:

addSupportedIOCombination({ kCFAmb1o, kCFAmb1o });

Putting in kCFMono,kCFAmb1o (which is what I really want) doesn't seem to work in Reaper, and it just ends up being a stereo in, stereo out plugin.  I'd much rather say that there is no speaker arrangement and give channel counts (especially as I want to write plug-ins for speaker arrangements that aren't standard).....is that possible?

cheers

Bruce

 

 

Avatar
DrWig
Member
Members
March 10, 2020 - 6:20 am
Member Since: September 15, 2015
Forum Posts: 16
sp_UserOfflineSmall Offline

Or is all this really a product of VST3 when compared to VST2, which was more naive when it comes to channel counts and supported formats..........

cheers

Bruce

Avatar
DrWig
Member
Members
March 10, 2020 - 1:22 pm
Member Since: September 15, 2015
Forum Posts: 16
sp_UserOfflineSmall Offline

ok.  That all works fine - it was me not used to the channel speaker arrangement stuff.  Adding those 'k' values for Ambisonics all seems to work, so if I tell my plugin it supports 1st, 2nd and 3rd order Ambisonics, the channelIO updates automatically depending on the channel count of the Reaper track!  

Image Enlarger

cheers

Bruce

Avatar
DrWig
Member
Members
March 11, 2020 - 3:54 pm
Member Since: September 15, 2015
Forum Posts: 16
sp_UserOfflineSmall Offline

Forgot to mention that I also had to edit (in case anyone else wants to add different channel counts......).  

channelformats.h

const unsigned int NUM_SUPPORTED_CHANNEL_FORMATS = 18;

...

...

SpeakerArrangement speakerArrangements[NUM_SUPPORTED_CHANNEL_FORMATS] =

{SpeakerArr::kEmpty, SpeakerArr::kMono, SpeakerArr::kStereo, SpeakerArr::k30Cine,

    SpeakerArr::k31Cine, SpeakerArr::k40Music, SpeakerArr::k50, SpeakerArr::k51,

    SpeakerArr::k60Music, SpeakerArr::k61Music, SpeakerArr::k70Cine, SpeakerArr::k70Music,

    SpeakerArr::k71Cine, SpeakerArr::k71Music, SpeakerArr::k71Proximity,

    SpeakerArr::kAmbi1stOrderACN,SpeakerArr::kAmbi2cdOrderACN,SpeakerArr::kAmbi3rdOrderACN};

Avatar
DrWig
Member
Members
March 11, 2020 - 4:38 pm
Member Since: September 15, 2015
Forum Posts: 16
sp_UserOfflineSmall Offline

Now I just need to work out how I just specify channel counts to go above 3rd order.........

Avatar
DrWig
Member
Members
March 12, 2020 - 10:43 am
Member Since: September 15, 2015
Forum Posts: 16
sp_UserOfflineSmall Offline

Also, I must change the code in vst3plugin.cpp in order for some hosts (Plogue Bidule, for example) to know what channel counts I want, rather than what I support if offered.  Otherwise, it'll just show stereo in and stereo out, even though I haven't even stated I support that in plugincore.cpp

Initialize function in vst3plugin.cpp

        else // FX
        {
            //addAudioInput(STR16("Stereo Input"), SpeakerArr::kStereo);
            //addAudioOutput(STR16("Stereo Output"), SpeakerArr::kStereo);
            //Need to add this for hosts that want to know what channels we support
            //as a maximum (Plogue Bidule, for example)
            addAudioInput(STR16("Mono Input"), SpeakerArr::kMono);
            addAudioOutput(STR16("Amb Output"), SpeakerArr::kAmbi3rdOrderACN);
        }

Avatar
W Pirkle
Admin
March 13, 2020 - 10:01 am
Member Since: January 29, 2017
Forum Posts: 573
sp_UserOfflineSmall Offline

Yes - glad you've drilled down there. You can setup any kind of channel count, but you do need to provide the constant (k) and modify the code that translates your custom setup into a channel count in and out. The reason for this actually goes back to AU, which does not have the same robust channel setup as AAX or VST3. AU only knows about input and output counts, but not specific arrangements for speakers. 

VST3 has the most options possible, with AAX second (it seems to have better Ambisonics support, but I have not used that myself). AU is the limiting factor.

The reason I chose the set of channel configurations that you've been looking at (and editing) is that it is the set that overlaps AU, VST3 and AAX seamlessly, meaning that these built in setups all work across the 3 APIs. 

Will

Avatar
DrWig
Member
Members
March 13, 2020 - 12:22 pm
Member Since: September 15, 2015
Forum Posts: 16
sp_UserOfflineSmall Offline

I'm starting to think that VST3 is an issue in that you don't specify channel counts.  See a brief discussion here:
https://sdk.steinberg.net/viewtopic.php?t=549

and a bit more here : https://github.com/steinbergmedia/vst3sdk/issues/28

Specifying speaker layouts (IMO) is a really problematic restriction API wise (I'm addressing VST3, not ASPiK, here!)

The best Ambisonics support was VST2, where you could just specify numChannels in and out.....much better....and particularly logical as Ambisonic channels aren't even speakers!  This speaker arrangement business is just a bit messy!

I'll see what happens when I specify my own, arbitrary channel count but, I suspect without a matching VST3 speaker arrangement for it to specify, it won't work.......

cheers

Bruce

Avatar
W Pirkle
Admin
March 13, 2020 - 3:04 pm
Member Since: January 29, 2017
Forum Posts: 573
sp_UserOfflineSmall Offline

Yes, you must have a matching VST3 speaker arrangement for that to work.

And, also yes the fact that many speaker arrangements may have the same channel counts is an issue as well. Another problem I've seen is the DAW itself and whether it will support channel counts that do not match the capabilities of the existing hardware. Reaper is an exception as it will expose all the channels that the VST3 speaker arrangement dictates then will send whatever channels it can to the hardware.

Let us know about your progress here - I've had numerous graduate students ask about multi-channel in RackAFX, and I send them to ASPiK instead to try with one of the existing APIs.

Will

Forum Timezone: America/New_York

Most Users Ever Online: 152

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Chaes: 51

Skyler: 48

Derek: 46

Frodson: 45

Peter: 43

TheSmile: 43

clau_ste: 39

jim: 34

JimmyM: 33

Gwen: 32

Member Stats:

Guest Posters: 1

Members: 696

Moderators: 1

Admins: 5

Forum Stats:

Groups: 13

Forums: 41

Topics: 757

Posts: 2894

Newest Members:

Jas, Rowan, sojourn, fabhenr, rg1, Niklas, Wutru, Tim Campbell, Danny Jonel, Valentin

Moderators: W Pirkle: 573

Administrators: Tom: 74, JD Young: 80, Will Pirkle: 0, W Pirkle: 573, VariableCook: 3