leomccormack / SPARTA

A collection of spatial audio related VST/LV2 plug-ins developed using JUCE and the Spatial_Audio_Framework
http://leomccormack.github.io/sparta-site/
GNU General Public License v3.0
570 stars 44 forks source link

AmbiDEC 1.7 crashes in MaxMSP #93

Open mdedwards opened 3 weeks ago

mdedwards commented 3 weeks ago

Hello, 1.6 runs fine but AmbiDEC 1.7 crashes in MaxMSP on MacOS 14.6.1. Report below. Best, Michael

Thread 150 Crashed:: com.apple.audio.IOThread.client 0 libsystem_platform.dylib 0x18148a230 _platform_memmove + 144 1 sparta_ambiDEC 0x35a15f784 void JuceVSTWrapper::internalProcessReplacing(float, float, int, JuceVSTWrapper::VstTempBuffers&) + 380 2 Max 0x104af92a4 void juce::VSTPluginInstance::processAudio(juce::AudioBuffer&, juce::MidiBuffer&, juce::AudioBuffer&, juce::HeapBlock<float, false>&, bool) + 1644 3 Max 0x104552970 jpluginwrapper_perform(_jpluginwrapper, float*, long, long, void, void) + 316 4 vst~ 0x140a5b474 vst_perform64 + 968 5 MaxAudioAPIImpl 0x10dcb8f38 dspchain_tick + 336 6 MaxAudioAPIImpl 0x10dca3bdc plugrunner_tick + 204 7 MaxAudioAPIImpl 0x10dc991a0 plugrunner_process + 208 8 MaxAudioAPIImpl 0x10dc97ca0 patchernode_process + 408 9 MaxAudioAPIImpl 0x10dc9416c mixerengine_process_fun + 76 10 Max 0x1047f4310 linklist_funall_imp + 376 11 MaxAudioAPIImpl 0x10dc93a2c mixerengine_processiovector + 924 12 MaxAudioAPIImpl 0x10dcb4fa4 ad_process + 228 13 ad_coreaudio 0x10d7aad48 adcoreaudio_callback + 516 14 Max 0x104a67990 juce::CoreAudioClasses::CoreAudioInternal::audioCallback(AudioTimeStamp const, AudioTimeStamp const, AudioBufferList const, AudioBufferList) + 748 15 Max 0x104a67664 juce::CoreAudioClasses::CoreAudioInternal::audioIOProc(unsigned int, AudioTimeStamp const, AudioBufferList const, AudioTimeStamp const, AudioBufferList, AudioTimeStamp const, void) + 28 16 CoreAudio 0x183ccc6e8 HALC_ProxyIOContext::IOWorkLoop() + 9508 17 CoreAudio 0x183cc9a8c invocation function for block in HALC_ProxyIOContext::HALC_ProxyIOContext(unsigned int, unsigned int) + 108 18 CoreAudio 0x183e4f850 HALC_IOThread::Entry(void) + 88 19 libsystem_pthread.dylib 0x181459f94 _pthread_start + 136 20 libsystem_pthread.dylib 0x181454d34 thread_start + 8

Thread 151:: CVDisplayLink

leomccormack commented 2 weeks ago

This is due to bumping the maximum number of channels from 64 to 128 (going from version 1.6.2 to 1.7.0)

The crash happens on this line, when the channel index (i) is >=64 https://github.com/juce-framework/JUCE/blob/5179f4e720d8406ebd1b5401c86aea8da6cc83c9/modules/juce_audio_plugin_client/juce_audio_plugin_client_VST2.cpp#L432

Essentially, Max is first querying the plugin how many channels it supports, and AmbiDEC is reporting: "I support up to 128 channels". Max is then telling the plugin that there will indeed be 128 buffers at run-time. However, at run-time, it then provides only 64 buffers, which causes the crash.

I don't like to pass the blame... but I'm fairly certain this is a Max problem. Either it should be reporting to the plugin that there are actually only <=64 channel buffers (AmbiDEC will then just cap out at 64), or it should actually provide all <=128 buffers.

Note that REAPER (<=128channels), Plogue Bidule (<=64channels) and even Nuendo (<=2channels) all work fine with the latest 128ch supporting AmbiDEC (they just have different maximum channel caps).

Max probably just has a hard coded "64" somewhere. Or it is otherwise not checking if it actually supports the number of channels that the plugin supports, before passing pointers to an insufficient number of buffers and telling the plugin that there are indeed 64+ buffers when there are not.

mdedwards commented 2 weeks ago

Great information, thanks Leo. I’ll post a bug report to cycling 74 at the first opportunity. Best, Michael