Author Topic: Bass VST  (Read 349 times)

JJS

  • Posts: 121
Bass VST
« on: 8 Oct '18 - 05:57 »
I have created an application that uses the VST add-on. I've invested quite a bit of time in the app, only to find that the VST add-on has quite a few serious bugs (e.g. it doesn't work with many VST plugins, and loading them hangs the app). Is this plugin dead? Are they any plans to update it and fix the bugs? It's a shame that the add-on has issues, as VST functionality seems important to the Bass system.

Falcosoft

  • Posts: 11
Re: Bass VST
« Reply #1 on: 8 Oct '18 - 10:50 »
Hi,
I do not think that Bass_VST has such serious bugs. I have been using it for years without finding VST/VSTi plugins that do not work at all. Also my users have not reported such serious problems with plugins so far. Make sure you use only VST 2.x plugins since Bass_VST does not support VST 3. Also make sure that you use plugins with the right bitness (32-bit plugins with your 32-bit host and 64-bit plugins with your 64-bit host).
As a test you can try to load your problematic plugins to my program that also use Bass_VST to see if it produces the same errors:
http://falcosoft.hu/softwares.html#midiplayer
https://youtu.be/mzZhhLXG0kk

Or if the problematic plugins are free to download you can post some links here so I could try them myself.

Ps: my program uses a little customized version of Bass_VST, but you can find both the sources and binaries in Midiplayer's folder.
« Last Edit: 8 Oct '18 - 11:02 by Falcosoft »

JJS

  • Posts: 121
Re: Bass VST
« Reply #2 on: 8 Oct '18 - 12:29 »
I'm loading an instrument plugin called "CM Dominator". Unloading that plugin then loading another on the same mixer channel causes the program to crash. This doesn't happen with other VST instruments that I have. Your program seems to load and unload this plugin fine. Am I doing something wrong here?

This snippet creates an 'input' mixer channel and plugs it into the 'master' mixer channel

Code: [Select]
public InputChannelViewModel(int masterChannelHandle, int index)
        {
            this.MasterChannelHandle = masterChannelHandle;
            this.Index = index;

            this.Handle = BassMix.BASS_Mixer_StreamCreate(
                44100,
                2,
                BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);

            if (this.Handle == 0)
            {
                throw new InvalidOperationException(Bass.BASS_ErrorGetCode().ToString());
            }

            if (!BassMix.BASS_Mixer_StreamAddChannel(this.MasterChannelHandle, this.Handle, BASSFlag.BASS_MIXER_NONSTOP))
            {
                throw new InvalidOperationException(Bass.BASS_ErrorGetCode().ToString());
            }

            this.Volume = 80;
            this.Pan = 0;

            BassMix.BASS_Mixer_ChannelPlay(this.Handle);
        }

Then later, an instrument can be added to the input channel...

Code: [Select]
      public override void Load()
        {
            this.VstHandle = BassVst.BASS_VST_ChannelCreate(
                44100,
                2,
                this.Filename,
                BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);

            if (this.VstHandle == 0)
            {
                throw new InvalidOperationException(Bass.BASS_ErrorGetCode().ToString());
            }

            if (!BassMix.BASS_Mixer_StreamAddChannel(
                this.MixerChannelHandle,
                this.VstHandle ,
                BASSFlag.BASS_STREAM_AUTOFREE))
            {
                throw new InvalidOperationException(Bass.BASS_ErrorGetCode().ToString());
            }

            BassMix.BASS_Mixer_ChannelPlay(this.VstHandle);
        }

        public override void Unload()
        {
            if (this.VstHandle != 0)
            {
                BassVst.BASS_VST_ChannelFree(this.VstHandle);

                this.VstHandle = 0;
            }
        }

Unload is called before Load to load a new instrument.

rv

  • Posts: 238
Re: Bass VST
« Reply #3 on: 8 Oct '18 - 12:59 »
Falcosoft, if you have found some bugs in the actual BASS_VST github release, can you share them with us?
If it's only customisations made for your own use, maybe you can tell us a bit more about them here?

JJS

  • Posts: 121
Re: Bass VST
« Reply #4 on: 8 Oct '18 - 13:15 »
rv, 

I understand how complicated these things are and everyone needs help, but please don't hijack the thread.  I've got a lot of time invested in this and I really need the help.

JJS

Falcosoft

  • Posts: 11
Re: Bass VST
« Reply #5 on: 8 Oct '18 - 13:17 »
Of course, no problem:

version 2.4.0.9

- Modified IDLE_UNLOAD_PENDING_COUNTDOWN from 10 to 5 sec.  Since some plugins require complete unload before reload 10 sec wait time is too much.
- Added cleanUpPlugins() function to remove loaded plugins before unload. It matters when you load/unload bass_vst dynamically.
- Added Visual C++ 6 project for x86 version.

version 2.4.0.10

- Added BASS_VST_SetEditKnobMode (knobMode 0: circular, 1: circular relative, 2: linear)
- Modified BASS_VST_PARAM_INFO members maximum characters to 24.
  (I know VST specification dictates maximum 8 character but it is ridiculously low and no plugins/hosts respect this limit.) 



Falcosoft

  • Posts: 11
Re: Bass VST
« Reply #6 on: 8 Oct '18 - 15:57 »
Hi,
I have just checked my code (mainly the unload part) to find some differences and I have found that I had to free the Editor and destroy the associated Window handle before calling BASS_VST_ChannelFree(). Of course it's only relevant if you use the Editor of the plugins. Unfortunately I do not use Bass Mixer addon so my architecture is different from yours. There's still the possibility that Bass Mixer somehow interferes with Bass_VST...

Code: [Select]
 
      if VstiInfo.channelHandle <> 0 then
      begin
        if assigned(FrmVSTi) then
        begin
          BASS_VST_EmbedEditor(Midistream, 0);
          Sleep(10);
          FrmVSTi.Panel.Perform(CM_RECREATEWND, 0, 0);
          Sleep(10);
        end;
        BASS_VST_ChannelFree(MidiStream);
      end;
« Last Edit: 8 Oct '18 - 16:10 by Falcosoft »

JJS

  • Posts: 121
Re: Bass VST
« Reply #7 on: 8 Oct '18 - 23:45 »
When you say "destroy the window handle" do you mean destroy the window handle of the window that contained the VST GUI?

thusly:

  • Free the editor
  • Destroy the window handle (in my case the GUI is embedded in a windows forms panel embedded in a WPF WindowsFormsHost control)
  • Free the VSTi channel


JJS

  • Posts: 121
Re: Bass VST
« Reply #8 on: 9 Oct '18 - 00:59 »
I did some trial and error and it looks like the call to  BassMix.BASS_Mixer_ChannelPlay(this.Handle); was the culprit. The troublesome VSTs loaded and unloaded correctly after I commented that line out. Apparently it's not necessary?  It's odd that only some VSTIs wouldn't load/unload correctly, but I don't know a lot about what goes on inside of them. I also implemented destroying the GUI host window handle as you suggested, not sure if it makes any difference but I'll leave it in for now.

Code: [Select]
public InputChannelViewModel(int masterChannelHandle, int index)
        {
            this.MasterChannelHandle = masterChannelHandle;
            this.Index = index;

            this.Handle = BassMix.BASS_Mixer_StreamCreate(
                44100,
                2,
                BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);

            if (this.Handle == 0)
            {
                throw new InvalidOperationException(Bass.BASS_ErrorGetCode().ToString());
            }

            if (!BassMix.BASS_Mixer_StreamAddChannel(this.MasterChannelHandle, this.Handle, BASSFlag.BASS_MIXER_NONSTOP))
            {
                throw new InvalidOperationException(Bass.BASS_ErrorGetCode().ToString());
            }

            this.Volume = 80;
            this.Pan = 0;

           [b] //BassMix.BASS_Mixer_ChannelPlay(this.Handle);[/b]
        }

Ed1966

  • Posts: 89
Re: Bass VST
« Reply #9 on: 9 Oct '18 - 05:15 »
Will you update in the add-ons: BASS_VST 2.4.5 ?
(with Delphi headers)

That will be amazing. :)

rv

  • Posts: 238
Re: Bass VST
« Reply #10 on: 10 Oct '18 - 12:43 »
I also have a crash when I unload one VST plugin on a mixer, then load it again
I don't think I use Bass_Mixer_ChannelPlay

JJS

  • Posts: 121
Re: Bass VST
« Reply #11 on: 14 Oct '18 - 12:17 »
Well I thought the problem was gone, but it isn't. I still have flaky behavior when loading and unloading VSTs, and so doesn't the previous poster. I don't know if it has anything  to do with the mixer or not.

Where do I go from here?

My app has 4 mixer channels and 1 master channel. You can load 1 VSTis and 2 effects on each channel, and 2 effects on the master. I want to let the user load and unload VSTis and VST effects anytime. There are volume and pan controls on each mixer channel as well as VU.

How else could I do this if not with the mixer?

rv

  • Posts: 238
Re: Bass VST
« Reply #12 on: 14 Oct '18 - 12:32 »
do you see any difference if you use the bass_vst.dll version of falcosoft?

Falcosoft

  • Posts: 11
Re: Bass VST
« Reply #13 on: 14 Oct '18 - 18:27 »
You can try to set the process affinity to only one CPU core for testing. Unfortunately I wrote the VST handling part of my program years ago so I do not remember exactly what problems I had encountered then and why I chose the workarounds that are currently in the code. But I have found that before loading/unloading plugins there are calls to
SetProcessAffinityMask(GetCurrentProcess, 1) and at the end to SetProcessAffinityMask(GetCurrentProcess, FmMain.OrigProcessMask) to restore original mask. You can test if this makes a difference for you by opening Task manager -> Processes/Details and then set affinity to CPU0 on the right click context menu of your program's process and then try opening/closing VST plugins.

Also loading VST/VSTi bank settings (*.fxb files) at startup are implemented by a timer since right after plugin's loading restoring bank settings resulted in frequent hangs.
« Last Edit: 14 Oct '18 - 19:00 by Falcosoft »

JJS

  • Posts: 121
Re: Bass VST
« Reply #14 on: 14 Oct '18 - 23:22 »
do you see any difference if you use the bass_vst.dll version of falcosoft?

What does this mean?

JJS

  • Posts: 121
Re: Bass VST
« Reply #15 on: 14 Oct '18 - 23:25 »
You can try to set the process affinity to only one CPU core for testing. Unfortunately I wrote the VST handling part of my program years ago so I do not remember exactly what problems I had encountered then and why I chose the workarounds that are currently in the code. But I have found that before loading/unloading plugins there are calls to
SetProcessAffinityMask(GetCurrentProcess, 1) and at the end to SetProcessAffinityMask(GetCurrentProcess, FmMain.OrigProcessMask) to restore original mask. You can test if this makes a difference for you by opening Task manager -> Processes/Details and then set affinity to CPU0 on the right click context menu of your program's process and then try opening/closing VST plugins.

Also loading VST/VSTi bank settings (*.fxb files) at startup are implemented by a timer since right after plugin's loading restoring bank settings resulted in frequent hangs.

Perhaps the timer needs a longer timeout?  I'll try the processor affinity and see if this yields some new info.

Falcosoft

  • Posts: 11
Re: Bass VST
« Reply #16 on: 15 Oct '18 - 00:43 »
Quote
What does this mean?
It means that the version of Bass_VST.dll in my Midiplayer's package is slightly different from the versions downloadable from Un4seen.com and Github.
You can find the differences a few posts above. Rv suggested that you should try the version in Midiplayer's package instead of the Un4seen and Github versions to see if it makes any difference.

Quote
Perhaps the timer needs a longer timeout?
Maybe you have misunderstood my sentence: The using of a timer solved the problem (timeout is not relevant, I used 100ms anyway) that was caused by immediate restoring of bank settings from .fxb files after loading plugins.
« Last Edit: 15 Oct '18 - 00:51 by Falcosoft »

JJS

  • Posts: 121
Re: Bass VST
« Reply #17 on: 15 Oct '18 - 00:54 »
It means that the version of Bass_VST.dll in my Midiplayer's package is slightly different from the versions downloadable from Un4seen.com and Github.
You can find the differences a few posts above. Rv suggested that you should try the version in Midiplayer's package instead of the Un4seen and Github versions to see if it makes any difference.

I'll give it a try, thanks.

Quote
Maybe you have misunderstood my sentence: The using of a timer solved the problem (timeout is not relevant, I used 100ms anyway) that was caused by immediate restoring of bank settings from .fxb files after loading plugins.

What I meant was If you were getting crashes restoring the .fxb files right after loading the plugin, and slightly delaying the restoring action solved the crashing problem, is it possible that more complex plugins might require  a slightly longer delay? Just a thought...


JJS

  • Posts: 121
Re: Bass VST
« Reply #18 on: 15 Oct '18 - 18:35 »
Hello,

I tried the version of bass_vst.dll v 2.0.4.10  from Midiplayer 5. The program still crashes randomly after loading some VSTs or VSTis, or sometimes a load just causes instability. Because it's not repeatable, it's very hard to say if the behavior changed with the new DLL.

I'm going to try building a simplified version of my app (just a simple windows forms app) to help narrow things down. If the problem still persists in this simplified app, I'll upload it.

If you have any other ideas or anything else I might try, please let me know.

Falcosoft

  • Posts: 11
Re: Bass VST
« Reply #19 on: 15 Oct '18 - 21:52 »
Hi,
It's a good start to write a barebone application for testing.
Also for the first step of testing I recommend to choose 'nice plugins'. I have attached a testing package (both 32 and 64-bit versions included) that can identify problems with plugins. You have to give the tester application the path of the testable plugin as the first and only parameter e.g:
VST-Plugin Unit Test.exe mytestplugin.dll.
May I suggest to use my VST/VSTi plugins (SimpleGainVST, OPL3VSTi, MuntVSTi) from Midiplayer's VST folder since they pass all tests with 97% and without giving any exceptions/access violation errors. My midi program/host using Bass_VST is rock stable with these plugins. But of course you can also try your other plugins and select other nice ones that pass the majority of the test suite.
After you have selected the nice plugins you should stress test your application/host with them: loading multiple instances, multiple load/unload cycles, parameter changing etc.
This way you can find out if your application/host is stable enough under optimal conditions. If not, at least we know that the problem is really your app and/or Bass_VST and this is the area we should focus on.
If you can make an application/host that is very stable with 'nice' plugins but unstable with others then it's highly likely that the problems are somehow plugin related.
So after above steps you should test your problematic plugins with the VST tester and see what problems/bugs the plugins themselves show.
Be aware that many times a failed test can be fatal, meaning all the tests after the 1st failed one can result in errors since the plugin is already in a catastrophic state.
To test what other real problems the plugin contains you should de-select the test that caused the fatal error and run the test suite again.
If you can identify the main problem areas of your bad plugins then you/we can find out more easily what mitigation technics and workarounds may be used (hopefully).

http://www.pcjv.de/Applications/Tools/VSTPluginUnitTest.7z
 
« Last Edit: 15 Oct '18 - 22:17 by Falcosoft »

JJS

  • Posts: 121
Re: Bass VST
« Reply #20 on: 15 Oct '18 - 22:35 »
Hi,
It's a good start to write a barebone application for testing.
Also for the first step of testing I recommend to choose 'nice plugins'. I have attached a testing package (both 32 and 64-bit versions included) that can identify problems with plugins. You have to give the tester application the path of the testable plugin as the first and only parameter e.g:
VST-Plugin Unit Test.exe mytestplugin.dll.
May I suggest to use my VST/VSTi plugins (SimpleGainVST, OPL3VSTi, MuntVSTi) from Midiplayer's VST folder since they pass all tests with 97% and without giving any exceptions/access violation errors. My midi program/host using Bass_VST is rock stable with these plugins. But of course you can also try your other plugins and select other nice ones that pass the majority of the test suite.
After you have selected the nice plugins you should stress test your application/host with them: loading multiple instances, multiple load/unload cycles, parameter changing etc.
This way you can find out if your application/host is stable enough under optimal conditions. If not, at least we know that the problem is really your app and/or Bass_VST and this is the area we should focus on.
If you can make an application/host that is very stable with 'nice' plugins but unstable with others then it's highly likely that the problems are somehow plugin related.
So after above steps you should test your problematic plugins with the VST tester and see what problems/bugs the plugins themselves show.
Be aware that many times a failed test can be fatal, meaning all the tests after the 1st failed one can result in errors since the plugin is already in a catastrophic state.
To test what other real problems the plugin contains you should de-select the test that caused the fatal error and run the test suite again.
If you can identify the main problem areas of your bad plugins then you/we can find out more easily what mitigation technics and workarounds may be used (hopefully).

http://www.pcjv.de/Applications/Tools/VSTPluginUnitTest.7z
 

OK Thanks, I'll work on testing the VSTs and building a bare-bones app