Help for Vst on OSX

Started by Salvo,

Chris

can you try the following :
var
FInfo: BASS_VST_INFO;
  begin
    if DSP <> 0 then
    begin
        BASS_VST_GetInfo(DSP, @Finfo);
        if(Finfo.HasEditor > 0) and (Finfo.EditorWidth > 0) and (Finfo.EditorHeight > 0) then
        BASS_VST_EmbedEditor(dsp, NSViewHandle) ;
     else
   // just check the Returnvalues of HasEditor, EditorWidth, EditorHeigth
     end;

Salvo

Quote from: Chriscan you try the following :
var
FInfo: BASS_VST_INFO;
  begin
    if DSP <> 0 then
    begin
        BASS_VST_GetInfo(DSP, @Finfo);
        if(Finfo.HasEditor > 0) and (Finfo.EditorWidth > 0) and (Finfo.EditorHeight > 0) then
        BASS_VST_EmbedEditor(dsp, NSViewHandle) ;
     else
   // just check the Returnvalues of HasEditor, EditorWidth, EditorHeigth
     end;
yes of course already tried it is a haseditor with width and heigth.

Salvo

I found the error need to use NSWindow on bass_vst I put a Pointer:
function BASS_VST_EmbedEditor(vstHandle : DWORD; ParentWindow :{$IFDEF MSWINDOWS}HWND {$ELSE}Pointer{$ENDIF}) : BOOL; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; external bassvstdll;

Thank you all for your help. :)

Salvo

Another problem.
Now the editor works.
The problem is on this REMIX plugin.
When the program is released on OSX it crashes.
Calling
dsp := BASS_VST_ChannelSetDSP(0, pChar(Filename), BASS_UNICODE, 0);

even if at the close of the program I put:
          BASS_VST_ChannelRemoveDSP(0,dsp);
          BASS_VST_ChannelFree(DSP);
crashes on OSX.
It's as if the plugin isn't fully released because there's a timer inside the VST.
This is the OSX report:

Crashed Thread:        26  JUCE Timer

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

External Modification Warnings:
Debugger attached to process.

.......
Thread 26 Crashed:: JUCE Timer
0   libsystem_kernel.dylib                  0x195bba600 __pthread_kill + 8
1   libsystem_pthread.dylib                 0x195bf2f70 pthread_kill + 288
2   libsystem_c.dylib                       0x195aff908 abort + 128
3   libc++abi.dylib                         0x195ba944c abort_message + 132
4   libc++abi.dylib                         0x195b97968 demangling_terminate_handler() + 132
5   libc++abi.dylib                         0x195ba8710 std::__terminate(void (*)()) + 16
6   libc++abi.dylib                         0x195ba866c std::terminate() + 36
7   Remix                                   0x13a0e1118 juce::Timer::TimerThread::run() + 712
8   Remix                                   0x13a0b65d0 juce::Thread::createNativeThread(juce::Thread::Priority)::$_16::__invoke(void*) + 432
9   libsystem_pthread.dylib                 0x195bf32e4 _pthread_start + 136
10  libsystem_pthread.dylib                 0x195bee0fc thread_start + 8

Salvo

Sorry maybe it's a problem with the delphi debugger on OSX.
I will do further tests.
Thank you

Chris

#25
Quote from: Salvodsp := BASS_VST_ChannelSetDSP(0, pChar(Filename), BASS_UNICODE, 0);

The first Variable must be a Valid HSTREAM and not Zero.


Salvo

#27
Unfortunately I have to give you bad news: the file you gave me corrected does not work on OSX.
entering this crashes:
dsp := BASS_VST_ChannelSetDSP(0, pChar(Filename), BASS_UNICODE, 0);


Apple's response is this:
Application Specific Information:
*** CFRelease() called with NULL ***


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   CoreFoundation                          0x1859e75f4 CFRelease.cold.1 + 16
1   CoreFoundation                          0x185806d44 CFRelease + 132
2   libbass_vst.dylib                       0x106df8890 0x106df4000 + 18576
3   CoreFoundation                          0x185893e28 __CFRunLoopDoTimer + 1012
4   CoreFoundation                          0x185893938 __CFRunLoopDoTimers + 356
5   CoreFoundation                          0x1858790f0 __CFRunLoopRun + 1856
6   CoreFoundation                          0x185878334 CFRunLoopRunSpecific + 572
7   HIToolbox                               0x190cb10cc RunCurrentEventLoopInMode + 292
8   HIToolbox                               0x190cb6ebc ReceiveNextEventCommon + 636
9   HIToolbox                               0x190cb7020 _BlockUntilNextEventMatchingListInModeWithFilter + 76
10  AppKit                                  0x1893bca70 _DPSNextEvent + 660
11  AppKit                                  0x189ce27b8 -[NSApplication(NSEventRouting)

Salvo

#28
I put a message before it crashed (normally it takes 3 seconds before it crashes)
showmessage(Bass_ErrorGetCode)
and it always gives me 41.
I can't understand why compiling and running the program under IDE delphi instead does not give me the error.
Outside IDE DELPHI instead crashes.

 

Salvo

#29
From many tests done I am 100% sure that there is an error on the libbass_vst.dylib library on the call
dsp := BASS_VST_ChannelSetDSP(ch, pChar(Filename), BASS_UNICODE, 0);

compiling in debug mode, it works without Apple's signature.
compiling in release mode with Apple signature the program crashes.
Library that cannot be used for OSX.
Ian only you can get rid of this bug. >:(

Ian @ un4seen

I guess the BASS_VST_ChannelSetDSP call failed, ie. returned 0? It looks like BASS_VST will still try to unload the VST (with NULL handle) then. Here's an update that should stop doing that:

   www.un4seen.com/stuff/bass_vst-osx.zip

Salvo

#31
returns BASS_VST_ChannelSetDSP -> 0.

Salvo

Compiling in debug mode, it works without Apple's signature.
compiling in release mode with Apple signature, returns BASS_VST_ChannelSetDSP -> 0.

Salvo

Nothing to do gives me :
BASS_VST_ChannelSetDSP -> 0.
Bass_ErrorGetCode -> 41

and it always crashes.

Ian @ un4seen

Is it actually crashing now or just failing to load the VST? And are all VST affected? You could try loading the VST bundle in your own code using CFBundleCreate and CFBundleLoadExecutableAndReturnError, and seeing whether that also fails in your release/signed build. If it does, you can check the error from CFBundleLoadExecutableAndReturnError to hopefully find out why.

Salvo

It doesn't crash but it always comes back
BASS_VST_ChannelSetDSP -> 0.
Bass_ErrorGetCode -> 41

implement CFBundleCreate and CFBundleLoadExecutableAndReturnError, from delphi I don't know how to do it.

"""""And are all VST affected? """"
Yes

Salvo

CFBundleCreate ??
I didn't understand whether to load the vst like "limeter.svt" or the "bass_vst.dylib" library ?

Salvo

#37
BundleURL := CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR('/Library/Audio/plug-Ins/VST/TDR Nova.vst'), kCFURLPOSIXPathStyle, True);

          // Create the CFBundle
          Bundle := CFBundleCreate(kCFAllocatorDefault, BundleURL);

I loaded the bundle "TDR Nova.vst" and it gives me : Unable to load the package "TDR Nova".
If I run the program by launching it from the Delphi IDE with debug instead it loads it perfectly.

So the problem is delphi ???

Ian @ un4seen

To find the cause, perhaps you could compare Delphi's "release" and "debug" build settings, and change the "release" settings to be more like the "debug" settings. The linker (and signing) settings would probably be a good place to start.

Salvo

Thanks Ian for the suggestion but I already did it to no avail,, I put the linker settings the same as the debug, but nothing to do.
Maybe there is a problem on Delphi 12.
However, I won't give up, I'll let you know when I've found the cause.