AAX crash with new bus system


#1

My plugin has 8 discrete in- and output channels using the new bus sytem, no sidechain. I get occasional crashes from users like this one:

    Product = Pro Tools
Version = 12.6.0

Operating system: Mac OS X
                  10.10.5 14F1808
CPU: amd64
     family 6 model 62 stepping 4
     12 CPUs

Crash reason:  EXC_BAD_ACCESS / KERN_INVALID_ADDRESS
Crash address: 0xffffffffc6979018

Thread 0 (crashed)
 0  Myplugin!AAXClasses::JuceAAX_Processor::rebuildChannelMapArrays() + 0x353
    rbx = 0x0000000000000008   r12 = 0x000000000002f93b
    r13 = 0x00007fff5309e220   r14 = 0x0000000000000000
    r15 = 0x00000001c6979018   rip = 0x00000001c5dcfa73
    rsp = 0x00007fff5309e160   rbp = 0x00007fff5309e270
    Found by: given as instruction pointer in context
 1  Myplugin!AAXClasses::JuceAAX_Processor::Create() + 0x23e
    rbx = 0x00007fba6a404430   r12 = 0x00007fba6a404458
    r13 = 0x00007fba6a404480   r14 = 0x00007fba6a404368
    r15 = 0x00007fba6a4041e0   rip = 0x00000001c5dc932f
    rsp = 0x00007fff5309e280   rbp = 0x00007fff5309e2b0
    Found by: call frame info
 2  AAXHost + 0x6b12b
    rbx = 0x00000001c5dc90f0   r12 = 0x000000000407a787
    r13 = 0x0000000125799998   r14 = 0x00007fba6a42db20
    r15 = 0x000060800082a6a0   rip = 0x000000012552c12c
    rsp = 0x00007fff5309e2c0   rbp = 0x00007fff5309e480
    Found by: call frame info
 3  AAXHost + 0x19be1
    rip = 0x00000001254dabe2   rsp = 0x00007fff5309e2d0
    rbp = 0x00007fff5309e480
    Found by: stack scanning
 4  Myplugin!AAXClasses::JuceAAX_GUI::Create() + 0xef
    rip = 0x00000001c5dc90f0   rsp = 0x00007fff5309e2f0
    rbp = 0x00007fff5309e480
    Found by: stack scanning
 5  AAXHost + 0x5f3da
    rip = 0x00000001255203db   rsp = 0x00007fff5309e360
    rbp = 0x00007fff5309e480
    Found by: stack scanning
 6  AAXHost + 0x6059d
    rip = 0x000000012552159e   rsp = 0x00007fff5309e378
    rbp = 0x00007fff5309e480
    Found by: stack scanning
 7  AAXHost + 0x7a2e7
    rip = 0x000000012553b2e8   rsp = 0x00007fff5309e390
    rbp = 0x00007fff5309e480
    Found by: stack scanning
 8  AAXHost + 0x7a1e7
    rip = 0x000000012553b1e8   rsp = 0x00007fff5309e398
    rbp = 0x00007fff5309e480
    Found by: stack scanning
 9  AAXHost + 0x16712
    rip = 0x00000001254d7713   rsp = 0x00007fff5309e3a0
    rbp = 0x00007fff5309e480
    Found by: stack scanning
10  AAXHost + 0x69cea
    rip = 0x000000012552aceb   rsp = 0x00007fff5309e3e0
    rbp = 0x00007fff5309e480
    Found by: stack scanning
11  AAXHost + 0x694ee
    rip = 0x000000012552a4ef   rsp = 0x00007fff5309e3f0
    rbp = 0x00007fff5309e480
    Found by: stack scanning
12  AAXHost + 0x69acf
    rip = 0x000000012552aad0   rsp = 0x00007fff5309e400
    rbp = 0x00007fff5309e480
    Found by: stack scanning
13  AAXHost + 0x6d1ae
    rip = 0x000000012552e1af   rsp = 0x00007fff5309e410
    rbp = 0x00007fff5309e480
    Found by: stack scanning
14  AAXHost + 0x69ca3
    rip = 0x000000012552aca4   rsp = 0x00007fff5309e420
    rbp = 0x00007fff5309e480
    Found by: stack scanning
15  libc++.1.dylib + 0x40591
    rip = 0x00007fff87193592   rsp = 0x00007fff5309e430
    rbp = 0x00007fff5309e480
    Found by: stack scanning
16  AAXHost + 0x2d8997
    rip = 0x0000000125799998   rsp = 0x00007fff5309e448
    rbp = 0x00007fff5309e480
    Found by: stack scanning
17  AAXHost + 0x2d877f
    rip = 0x0000000125799780   rsp = 0x00007fff5309e450
    rbp = 0x00007fff5309e480
    Found by: stack scanning
18  AAXHost + 0x6af28
    rip = 0x000000012552bf29   rsp = 0x00007fff5309e458
    rbp = 0x00007fff5309e480
    Found by: stack scanning
19  AAXHost + 0x66ed6
    rip = 0x0000000125527ed7   rsp = 0x00007fff5309e490
    rbp = 0x00007fff5309e690
    Found by: stack scanning

No call to any Myplugin code in any of the other threads, so I assume it’ not a memory issue in my code that only shows up at that point. In rebuildChannelMapArrays() there’s a reference to the audio processor: AudioProcessor& audioProcessor = getPluginInstance();. Could this be uninitialised at that point for some reason?


#2

Well ProTools does not support discrete channels. You should be hitting an assertion (“You don’t have any supported layouts”) when running your plug-in in debug mode. ProTools only supports named channels such as mono, stereo, 5.1 Surround, 7.1 Surround etc. If your plug-in doesn’t care about the layout but really just wants 8 channels then you may want to try the following:

AAXAudioProcessor ()
     : AudioProcessor (BusesProperties().withInput  ("Input",  AudioChannelSet::namedChannelSet (8), true)
                                        .withOutput ("Output", AudioChannelSet::namedChannelSet (8), true))
{}

bool isBusesLayoutSupported (const BusesLayout& layouts) const override
{
    return (layouts.getMainInputChannels() == 8 && layouts.getMainOutputChannels() == 8);
}

The above just checks if the layout on the track that you load your plug-in has 8 channels. This is different to comparing the layout with AudioChannelSet::discreteChannels (8): the latter will only load if the track specifically has a discrete layout - which ProTools does not support anyway.