Plugin UIs struggling in Logic's "Dual Mono" mode - SOLVED

I have discovered that some of my plugins struggle to open when used in Logic’s “Dual Mono” mode. The UI takes several seconds to open and then sometimes lags for several seconds to re-open when switching between Left and Right instances. The plugin window remains black until the UI finally loads however if I mouse click in that black window sometimes the UI loads immediately. Other times the plugin windows switch immediately. So it’s erratic/unstable.

Several times while testing Logic crashed while switching from Left/Right. Logic’s error report showed it crashed at command “SetScreenScale” which is not something I mess with (I’m using default iPlug2 code).

I haven’t been able to find the cause of this UI issue. Everything works fine in stereo or mono mode/tracks - just not “Dual Mono” mode where it crashes. Has anyone else has come across this - and if so what can cause it? I’m using NanoVG and open GL2 (which has been working fine everywhere else).

Crash log from Logic:

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000300
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [4439]

VM Regions Near 0x300:

__TEXT 10012e000-10210e000 [ 31.9M] r-x/r-x SM=COW /Applications/Logic Pro X.app/Contents/MacOS/Logic Pro X

Application Specific Information:
Squire | 9822ba165c8200ad3eea20c1d3f8a51ff3c7a5c38397f17d396e73f464c81ef7 | 806d9dba1244a1cd17220443b7331b0ef1566c44 | 2021-12-06_16:29:51

Performing @selector(handleButtonAction:) from sender MASegmentedControl 0x7f8e2343c300

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 0x0000000124b28b55 iplug::igraphics::IGraphics::SetScreenScale(float) + 69

Error logged in Xcode upon crash:

Performing @selector(handleButtonAction:) from sender MASegmentedControl 0x7f90a4ca1e00

Pure virtual function called!

(lldb)

I just tried the “DSEQ3” plugin from @TBProAudio and it behaves the same way as my plugins in Dual Mono mode in Logic. When switching between L/R sometimes the UI refreshes almost instantly while other times it takes 10+ seconds or never redraws until the mouse is clicked or moved. After switching back and forth several times it also crashed - but with a different logged error:

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000020
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [2573]

VM Regions Near 0x20:

__TEXT 103296000-105276000 [ 31.9M] r-x/r-x SM=COW /Applications/Logic Pro X.app/Contents/MacOS/Logic Pro X

Application Specific Information:
Squire | 9822ba165c8200ad3eea20c1d3f8a51ff3c7a5c38397f17d396e73f464c81ef7 | 806d9dba1244a1cd17220443b7331b0ef1566c44 | 2021-12-06_16:29:51

Performing @selector(handleButtonAction:) from sender MASegmentedControl 0x7ff8011ceba0

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff205914af objc_release + 31
1 libobjc.A.dylib 0x00007fff205af20f AutoreleasePoolPage::releaseUntil(objc_object**) + 167
2 libobjc.A.dylib 0x00007fff20591e30 objc_autoreleasePoolPop + 161
3 com.apple.music.apps.MAAudioUnitSupport 0x000000010670b1e7 0x1066f6000 + 86503
4 com.apple.music.apps.MAAudioEngine 0x0000000108a9b8a6 CMDAudioUnit::MakeEditorView(long, TGroupID) + 294
5 com.apple.music.apps.MAAudioEngine 0x00000001089067bd MDMultiMonoPlug::MakeEditorView(long, TGroupID) + 509

Just tested Dual Mono mode in Logic under Catalina. Works as expected, no crash.

Which OS, Intel or Arm, and Logic version are you using?

And what steps do you take?

Thank you :slight_smile:

1 Like

Intel on Mojave, Big Sur and Monterey. Latest Logic version for each OS.

Load plugin as “Dual Mono” on a stereo track. Switch back and forth between Left instance and Right instance. Plugin UI redraws quickly sometimes - and very slowly (many seconds) other times, like it’s struggling. My plugin behaves the same way.

I continued to toggle back and forth and DSEQ3 eventually crashed Logic - same thing my plugin does. Crash logs shown above.

OK, same spec here, no crash.

Seems to be GPU related. Maybe you post your GPU specs?

Stock 21.5" Intel iMac:

Intel Iris Pro Graphics 6200:

  Chipset Model:	Intel Iris Pro Graphics 6200
  Type:	GPU
  Bus:	Built-In
  VRAM (Dynamic, Max):	1536 MB
  Vendor:	Intel
  Device ID:	0x1622
  Revision ID:	0x000a
  Metal Family:	Supported, Metal GPUFamily macOS 1

I have tested other brands of plugins and they do not have this problem. I also tested Channel Strip MK3 from @HoRNet (another iPlug developer) and it is rock solid - switches from Left to Right UIs instantly. Perhaps he can share what the problem might be - if he came across and solved this? Even my most basic plugins do this so I don’t think it’s something in my code.

It helped me, and maybe it will help you.

Would you be able to demonstrate a piece of code?:

#define PLUG_CHANNEL_IO

#define PLUG_CHANNEL_IO “1-1 1.1-1 2-2 2.1-2 2.2-2”

I haven’t seen this problem when using the host-based controls editor only the UI editor - so I don’t think the problem is in the I/O - it’s in the graphics somewhere. Also only a problem in Logic. Works fine in all other DAWs (and Logic except for Dual Mono mode).

Please use SKIA Graphics + Metal on MAC and SKIA + OpenGL2 on WIN

I had “it doesn’t work” complaints from users of older Macs that do not support metal. If that’s what’s causing this then I don’t know what to do about it. GL2 has worked everywhere else I’ve tested it, even on OS Monterey.

Which minimum macOS version do you support?

10.11 per iPlug2 documentation and default compiler settings

I use a lot of bitmaps in my plugin UIs and found out very early on that - for some reason - NanoVG produces much sharper graphics than SKIA which looks blurry when compared side-by-side.

So, I had reasons for choosing NanoVG and OpenGL2. Maybe it’s time to change…

olilarkin (s)

The problem is vu_arrow.png. For nanovg images can not be taller than 16384 pixels, so it crashes.

With Skia it crashes when loading on retina screen during the resizing of vu_arrow.png. If I place a 2nd resized version vu_arrow@2x.png next to the original, there is no crash. I also re-saved the original file with photoshop and now it seems to work without crashing, even without the @2x version.

        mMakeGraphicsFunc = [&]() {
          return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, 0.58);
        };

Not sure what your post above is indicating - 0.58 screen scale? Why?

I am going to try your SKIA/Metal suggestion and see what happens. If Metal is going to be the way forward I will just state “plugin requires GPU that supports Metal Graphics” and move on.

0.58 for example. It means 58% from PLUG_WIDTH, PLUG_HEIGHT

SKIA can switch CPU/GPU graphics fast and support >16384 pixels

I don’t have any bitmaps, multi or single frame, that come close to 16384 total height or width so that’s not an issue with NanoVG.

An older version of SKIA I once looked at had adjustments for bitmap antialiasing - which is what I believe makes the images blurry. I don’t see any such adjustment in the latest version.

Nevertheless, I will check out SKIA and Metal and see what happens. Thank you for the suggestions.

I have now tested with SKIA and Metal and get the same result. Plugin switches faster between Left/Right Dual Mono instances but occasionally pauses on a blank UI screen. Repeated toggling L/R eventually crashed:

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
Squire | 9822ba165c8200ad3eea20c1d3f8a51ff3c7a5c38397f17d396e73f464c81ef7 | 806d9dba1244a1cd17220443b7331b0ef1566c44 | 2021-12-06_16:29:51
 
Performing @selector(handleButtonAction:) from sender MASegmentedControl 0x7ffa10006a70
abort() called
Pure virtual function called!

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff2056992e __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff205985bd pthread_kill + 263
2   libsystem_c.dylib             	0x00007fff204ed406 abort + 125
3   libc++abi.dylib               	0x00007fff2055bef2 abort_message + 241
4   libc++abi.dylib               	0x00007fff2055b922 __cxa_pure_virtual + 18
5   com.test.audiounit.testplugin  	0x0000000123544f26 iplug::igraphics::IGraphics::LoadBitmap(char const*, int, bool, int) + 214

The issue appears to be with “Pure virtual function called!” from something while loading a bitmap. Any ideas where to look for the cause?