Author Topic: VST 64 bit dll only works with 32 bit plugin?  (Read 521 times)

moz

  • Posts: 10
Hi:

I am currently testing the VST integration.

Here is my question:

I am building a 64 bit app. The vst integration works with a 32 bit plugin but when I use a 64 bit plugin I get a memory error.
Is the bass_vst only be used with 32 bit plugins or is there a specific trick to use 64 bit plugins?

thanks,
Moz

Falcosoft

  • Posts: 36
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #1 on: 23 Apr '19 - 06:18 »
Hi,
There are both 32-bit and 64-bit versions of Bass_vst.dll. In a 32-bit application you can only use the 32-bit version of Bass_vst.dll and in a 64-bit application you have to use the 64-bit version (this works the same way as in case of Bass.dll). Also the 32-bit version of Bass_vst can load only 32-bit versions of other dlls/VST plugins while the 64-bit version can only load 64-bit plugins. This is a platform limitation that is true for all other dll files, not only for VST plugin dll files. To overcome this platform limitation you have to use 3rd party tools like jBridge:
https://jstuff.wordpress.com/jbridge/
So you must have mixed up your tested plugins or you accidentally compiled a 32-bit host. There is no way your 64-bit host application using 64-bit version of Bass_vst can load a 32-bit plugin natively (and vice versa).


« Last Edit: 23 Apr '19 - 09:06 by Falcosoft »

moz

  • Posts: 10
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #2 on: 23 Apr '19 - 13:26 »
Hi Falcosoft,

thanks a lot for your response.

That all makes sense. Maybe my issue is not with 32 vs 64 bit but somewhere else?

The error happens with this code section:


Code: [Select]

if (!BASS_Init(0, 44100, 0, 0, NULL))
{
// handle error
return false;
}

stream = BASS_StreamCreateFile(false, filename, 0, 0, BASS_STREAM_DECODE | BASS_SAMPLE_FLOAT);

BASS_CHANNELINFO info;
BASS_ChannelGetInfo(stream, &info);
DWORD fpflag = 0;

if (info.origres == 32)
fpflag = BASS_ENCODE_FP_32BIT;
else if (info.origres == 24)
fpflag = BASS_ENCODE_FP_24BIT;
else if (info.origres == 16)
fpflag = BASS_ENCODE_FP_16BIT;
else if (info.origres == 8)
fpflag = BASS_ENCODE_FP_8BIT;

BASS_Encode_Start(stream, outFilename, BASS_ENCODE_PCM | fpflag, NULL, NULL);

DWORD plugin;
const void* fName = vstPath;
plugin = BASS_VST_ChannelSetDSP(stream, vstPath, BASS_UNICODE, prio);

float buffer[10000];
while (!_kbhit() && BASS_ChannelIsActive(stream)) {
int c = BASS_ChannelGetData(stream, buffer, sizeof(buffer));
}


and specifically with these few lines:

Code: [Select]
float buffer[10000];
while (!_kbhit() && BASS_ChannelIsActive(stream)) {
int c = BASS_ChannelGetData(stream, buffer, sizeof(buffer));

In 32 bit it all works well. In 64 bit (using 64 bit plugin) I get the following error:

Exception thrown at 0x00000001800915C9 (plugin.dll) in AudioTester.exe: 0xC0000005: Access violation reading location 0x00000000704CBED4.

Any ideas what I could be doing wrong?

thanks,
Moz

Falcosoft

  • Posts: 36
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #3 on: 23 Apr '19 - 14:55 »
To narrow down where the problem is you can try 2 things:
1. Disable the VST processing temporarily. This way you can find out if your error has anything to do with using Bass_VST or the problem is your BASS_ChannelGetData() processing (where you actually get the error anyway).
2. Instead of your custom processing with BASS_STREAM_DECODE flag and BASS_ChannelGetData() you can try to use simply BASS_ChannelPlay(stream, 0) without using BASS_STREAM_DECODE flag and any custom buffers.

moz

  • Posts: 10
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #4 on: 23 Apr '19 - 15:09 »
yes, I will run some more tests and scenarios. I did already one test by disabling the

Code: [Select]
plugin = BASS_VST_ChannelSetDSP(stream, vstPath, BASS_UNICODE, prio);
All worked afterwards. So it is definitely something with the plugin logic.

Another thing i have noticed is that the bass_vst.lib in 64 bit (8kB) is quite smaller in size than the 32 bit version (19 kB)
Download Link: http://www.un4seen.com/download.php?z/5/bass_vst24).
May not mean anything.

Will run some more tests. thanks for the pointers.

moz

  • Posts: 10
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #5 on: 23 Apr '19 - 18:25 »
Ok so after running some more tests it seems its an issue with certain plugins only.

I have worked with one plugin only 'FabFilter Pro-Q 2'. It works fine in 32 bit.
I have now tested other 64 bit plugins which work fine but for whatever reason the 'FabFilter Pro-Q 2'
is running into an Access Violation.

It does seem it is a bass_vst issue not working with all plugins.

Not sure where to go next. :-(

Falcosoft

  • Posts: 36
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #6 on: 23 Apr '19 - 19:52 »
Hi,
I have bad/good news depending on the perspective :)
The good news is that I have tried FabFilter Pro-Q 2 v2.1.6 trial with the 64-bit version of my Midi Player program that also uses Bass_vst x64 and the plugin works perfectly.
So it's not a general Bass_vst x64 failure.
The bad news is that you should investigate further what the issue is with your solution.
Maybe you could try my slightly modified version of Bass_Vst that I use in my applications. You can find both binaries and source code in the package of my Midi Player:
http://falcosoft.hu/softwares.html#midiplayer
Also for comparison/testing you can try my player with your other problematic plugins. Here's a short tutorial video about how to use VST/VSTi plugins with it:
https://youtu.be/mzZhhLXG0kk

« Last Edit: 23 Apr '19 - 20:09 by Falcosoft »

moz

  • Posts: 10
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #7 on: 23 Apr '19 - 20:39 »
So I used your bass_vst.dll instead of the one from http://www.un4seen.com/download.php?z/5/bass_vst24
and all works fine now.

To confirm this theory could you download the latest bass_vst.dll and see if your player still works with it by replacing the dll?
I wonder if something is wrong with that dll.

thanks for all your help.

Falcosoft

  • Posts: 36
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #8 on: 24 Apr '19 - 03:03 »
Unfortunately I cannot test with the version '2.4.5.0' available at un4seen since it has missing exported functions that my applications actively use. The version available at un4seen actually has a wrong version number. It should be v2.4.0.7 instead of v2.4.5.0. You can check the change log on Github. So actually the version at un4seen is not the 'latest', it's from 2013.  It is several commits behind compared to my v2.4.0.10, that's why it has missing exports. 
« Last Edit: 24 Apr '19 - 04:05 by Falcosoft »

moz

  • Posts: 10
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #9 on: 24 Apr '19 - 21:07 »
ok no problem. It works with your dll. That is good enough for me. :-)

Thanks for all your help.

Ian @ un4seen

  • Administrator
  • Posts: 21731
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #10 on: 26 Apr '19 - 12:50 »
Unfortunately I cannot test with the version '2.4.5.0' available at un4seen since it has missing exported functions that my applications actively use. The version available at un4seen actually has a wrong version number. It should be v2.4.0.7 instead of v2.4.5.0. You can check the change log on Github. So actually the version at un4seen is not the 'latest', it's from 2013.  It is several commits behind compared to my v2.4.0.10, that's why it has missing exports.

The BASS_VST 2.4.5 version that's currently on the BASS webpage was forked from BASS_VST 2.4.0.6 by BaseHead to add some features for their products. The most interesting addition was support for OSX. Does your BASS_VST update support OSX too? Can you please also point me to the changelog that you mention? I couldn't find it in the GitHub project: https://github.com/r10s/BASS_VST

Falcosoft

  • Posts: 36
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #11 on: 26 Apr '19 - 18:16 »
Hi Ian,
I'm glad you have showed up here since I think now this is a chance to figure out/reconstruct what happened with Bass_Vst exactly. I feel there is much confusion about versions of Bass_VST between community members (including myself).   
Quote
The BASS_VST 2.4.5 version that's currently on the BASS webpage was forked from BASS_VST 2.4.0.6 by BaseHead to add some features for their products.
It's good to know. I have suspected something like this, that's why I said that this version should have been named '2.4.0.7' instead of '2.4.5.0'. Also I cannot find any trace of version '2.4.5.0' on GitHub and I cannot find any commits from BaseHead either. So am I right by guessing that this version from BaseHead is from a time when the source code of Bass_VST was not even released? And when finally the source of version '2.4.0.6' was released this missed the modifications made by BaseHead? If I'm right then the situation is rather unfortunate since Radio42's additions in version '2.4.0.8' are very significant but misses BaseHead's features. So these additions/features should be merged somehow.   
Quote
Does your BASS_VST update support OSX too?
No, my fork is based on '2.4.0.8' that has Windows platform specific calls like LoadLibraryA()/LoadLibraryW(). I myself have not added other platform specific code but I have never tested it on anything but x86/x64 Windows.
Quote
Can you please also point me to the changelog that you mention? I couldn't find it in the GitHub project
Actually I referred to the changelog of the main repository and especially the changes of '2.4.0.8' made by Radio42.  But as I have mentioned my version is a fork of '2.4.0.8' so it can be found among the forks:
https://github.com/Falcosoft/BASS_VST
I'm not sure my modifications are relevant for everyone, but Radio42's definitely are. The currently available version on Un4seen does not support the important BASS_VST_Get/SetChunk calls, has broken VST(i) instrument support and according to this thread also has x64 specific problems (just to name a few).
Thanks in advance. 

« Last Edit: 26 Apr '19 - 18:41 by Falcosoft »

sveakul

  • Posts: 76
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #12 on: 27 Apr '19 - 03:35 »
@Falcosoft:  Thanks for putting your bass_vst.dll build up on GitHub!  I noticed that while the size and version number (2.4.0.10) are the same on both that one and the one in your latest midiplayer package, the GitHub posting has a newer mod date of 12-15-2018 vs. 02-04-2017 for the player.  Are they still the same build internally?

Falcosoft

  • Posts: 36
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #13 on: 27 Apr '19 - 08:46 »
Quote
Are they still the same build internally?
Yes, they are the same. Adding my fork to GitHub was just an afterthought when I had to create a GitHub account anyway in 2018. All the modifications actually was made in 2017 without using Git then (for Midiplayer I still use SVN).

rv

  • Posts: 279
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #14 on: 28 Apr '19 - 14:07 »
Just discovered your fork
What tool do you use to compile the dll for 64 bit?
I can't open the project in visual studio 2019

Falcosoft

  • Posts: 36
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #15 on: 28 Apr '19 - 23:35 »
Quote
I can't open the project in visual studio 2019
Hi,
I think your problem is that .dsp and .dsw files are converted by Git to Linux style text files using LF line endings. Normally with a Git client at checkout you should get Windows style CRLF line endings when you use Windows but when you simply download repository as a zip you can get text files with wrong line endings. So the solution is to convert .dsp and .dsw files to use Windows style CRLF line endings. You can use e.g. Notepad++ or Notepad2 to do this.
To tell you the truth I was also not aware the possible line ending problems with Git when I uploaded my fork:
https://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/

rv

  • Posts: 279
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #16 on: 29 Apr '19 - 11:44 »
Will see this...

Will your 64bit DLL work on Windows XP 64 bit without need of installing any c++ runtime?

How you did to remove the dependency on the runtime?

Ian @ un4seen

  • Administrator
  • Posts: 21731
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #17 on: 29 Apr '19 - 14:35 »
It's good to know. I have suspected something like this, that's why I said that this version should have been named '2.4.0.7' instead of '2.4.5.0'. Also I cannot find any trace of version '2.4.5.0' on GitHub and I cannot find any commits from BaseHead either. So am I right by guessing that this version from BaseHead is from a time when the source code of Bass_VST was not even released? And when finally the source of version '2.4.0.6' was released this missed the modifications made by BaseHead? If I'm right then the situation is rather unfortunate since Radio42's additions in version '2.4.0.8' are very significant but misses BaseHead's features. So these additions/features should be merged somehow.   

I have checked with BaseHead about this and they're going to provide the sources of their update so that it can be merged with the main BASS_VST branch. That will hopefully happen later this week.

Will your 64bit DLL work on Windows XP 64 bit without need of installing any c++ runtime?

How you did to remove the dependency on the runtime?

You can avoid the need to install extra VC++ runtimes by linking with the libraries from the Windows Driver Kit. The files (taken from the Vista WDK) are available here:

   www.un4seen.com/stuff/msvcrt.zip

rv

  • Posts: 279
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #18 on: 29 Apr '19 - 16:41 »
Thank you

I am sorry, I am very newbie in c++
How to link to this CRT files in VisualStudio project    ????

Actually, my solution was to use the v141_xp toolset in the options and to select Runtime Multithread (/MT)

This caused the dll to bloat, but works on Windows XP without need of runtime

Your solution seems cleaner. Let me know where to link to your CRT

Ian @ un4seen

  • Administrator
  • Posts: 21731
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #19 on: 29 Apr '19 - 17:56 »
Your project's "Runtime Library" needs to be set to "Multi-threaded DLL" and "Additional Library Directories" needs to include where you put the files (note it's different for Win32 and x64 platforms). For 32-bit WinXP support, also add "msvcrt_winxp.obj" to the "Additional Dependencies" setting for the Win32 platform.

rv

  • Posts: 279
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #20 on: 29 Apr '19 - 19:30 »
Thank you, it seems to compile good. Will try it on a Windows xp 64 bit

Should I add "msvcrt_win2003.obj" to additional Dependencies for the 64 bit version?

The v141_xp still important to use ?

Ian @ un4seen

  • Administrator
  • Posts: 21731
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #21 on: 30 Apr '19 - 16:00 »
Should I add "msvcrt_win2003.obj" to additional Dependencies for the 64 bit version?

As far as I've seen, it doesn't seem to be needed but adding it shouldn't do any harm.

The v141_xp still important to use ?

Yes, you should probably still use the "v141_xp" compiler. I believe the other latest VC++ compilers disable XP support in the output EXE/DLL's header.

sveakul

  • Posts: 76
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #22 on: 13 May '19 - 03:08 »
I have checked with BaseHead about this and they're going to provide the sources of their update so that it can be merged with the main BASS_VST branch. That will hopefully happen later this week.

Ian did you hear anything yet from BaseHead about this?

Ian @ un4seen

  • Administrator
  • Posts: 21731
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #23 on: 13 May '19 - 13:57 »
Not yet. I will check what the latest is.

Ian @ un4seen

  • Administrator
  • Posts: 21731
Re: VST 64 bit dll only works with 32 bit plugin?
« Reply #24 on: 17 May '19 - 12:49 »
The BaseHead BASS_VST code has now been received. Now just a matter of merging it. That will hopefully happen next week.