MIDI: Detect presence and compatibility of Sound Canvas VA before attempting to import it later. It currently does not work with arm64, only x86_64 native or Rosetta 2.

CQTexperiment
Christopher Snowhill 2021-08-10 17:35:03 -07:00
parent 59a5a7687e
commit 0891a20bba
1 changed files with 8 additions and 1 deletions

View File

@ -19,6 +19,8 @@
#import "PlaylistController.h"
#import <dlfcn.h>
static OSType getOSType(const char * in_)
{
const unsigned char * in = (const unsigned char *) in_;
@ -211,6 +213,11 @@ static OSType getOSType(const char * in_)
if ((componentManufacturer == 'rolD' || componentManufacturer == 'RoCl') && componentSubType == 'Sc55')
{
const char * plugin_path = "/Library/Audio/Plug-Ins/Components/SOUND Canvas VA.component/Contents/Resources/SCCore00.dylib";
if (!dlopen_preflight(plugin_path))
return NO;
SCPlayer * scplayer = new SCPlayer;
SCPlayer::sc_mode mode = SCPlayer::sc_sc55;
@ -232,7 +239,7 @@ static OSType getOSType(const char * in_)
else if ([flavor isEqualToString:@"xg"])
mode = SCPlayer::sc_xg;
scplayer->set_sccore_path("/Library/Audio/Plug-Ins/Components/SOUND Canvas VA.component/Contents/Resources/SCCore00.dylib");
scplayer->set_sccore_path(plugin_path);
scplayer->set_mode( mode );
scplayer->setSampleRate( 44100 );