Runtime Exception using minihost example and Glitch vst plugin

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

I was trying to figure out if my host had a bug because the fairly popular Glitch VST kept crashing. It doesn't seem to crash when loaded into Reaper.

Then I've tried compiling and running Steinberg's minihost from the VST SDK2.4 sources. It too fails with a runtime exception when trying to load the Glitch VST. Other plugins work fine with both minihost and my own host.

Code: Select all

---------------------------
minihost.exe - Application Error
---------------------------
The instruction at "0x00a1b00e" referenced memory at "0x00000020". The memory could not be "read".


Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK   Cancel   
---------------------------
Can anyone else confirm Glitch 1.305 crashes when using the minihost example? And why does it crash at all? It loads and runs fine in Reaper.

I'm running XP32 SP3.

Post

Now that I think about it.. could this be related to Glitch needing time info/sample position from the host? My host doesn't yet do that, and neither does minihost. That might explain it. But I have to read the SDK docs some more. Am I on the right track?

Post

I figured it out. Glitch is a VST 2.3 plugin, and its using:

Code: Select all

AEffectProcessProc DECLARE_VST_DEPRECATED (process);
to process audio, I was trying to use processReplacing and this would fail.

I had to check if the VST could do processReplacing in the first place. And now that I've asked the VST, I get back:

Code: Select all

Can do receiveVstEvents    : yes
Can do receiveVstMidiEvent : yes
Can do midiProgramNames    : don't know
Can do canProcessReplacing : no
Tada! Problem solved.

Anywho.. I'm experimenting with the D language and trying out VSTs. Its quite fun. :)

Post

Well now I've implemented processing audio for both functions. They work, I've tried it with an older VST plug that uses process, and a newer one with processReplacing.

However Glitch still won't output audio. In fact it should animate that playing cursor in its GUI when the transport is disabled, but its not moving at all. Am I missing some 'startup' call to the VST?

Post

AndrejM. wrote:Now that I think about it.. could this be related to Glitch needing time info/sample position from the host? My host doesn't yet do that, and neither does minihost. That might explain it. But I have to read the SDK docs some more. Am I on the right track?
Yep, Glitch requires (and blindly expects) VstTimeInfo to be available. It relies on the tempo and ppqPos fields for timing, and also the kVstTransportPlaying flag to determine whether the host is actually playing or stopped. Some hosts (older versions of Sony ACID in particular) didn't seem to be reporting kVstTransportPlaying correctly, so I added the 'Disable Transport' toggle in Glitch to override it and force the sequencer to run constantly. Normally you should not need to do this.

AndrejM. wrote:I figured it out. Glitch is a VST 2.3 plugin, and its using:
AEffectProcessProc DECLARE_VST_DEPRECATED (process);
to process audio, I was trying to use processReplacing and this would fail.
(...)
Can do canProcessReplacing : no
I'm actually surprised to hear that this is returning false for you, because I definitely set the flag for canProcessReplacing. If I analyse what Glitch is doing with Achitophel's Plugin Consultant, then it reports that processReplacing is supported and is being used by my host (Renoise).

AndrejM. wrote:However Glitch still won't output audio.
Do you mean that it doesn't output any audio at all, or do you mean that audio appears to simply pass through unaffected? Even if Glitch's sequencer isn't running the audio should still be processed through things like overdrive, master filter, master volume, etc. So if it seems like audio is just passing through unaffected, try to turn up the overdrive or enable the master filter and see if these have any effect on the sound.

AndrejM. wrote:And why does it crash at all?
My old code is a mess and probably riddled with bugs :)
I'm Kieran, aka dblue, aka illformed | illformed.com | Glitch 2 now available for Windows, Mac and Linux!

Post

dblue wrote: I'm actually surprised to hear that this is returning false for you, because I definitely set the flag for canProcessReplacing. If I analyse what Glitch is doing with Achitophel's Plugin Consultant, then it reports that processReplacing is supported and is being used by my host (Renoise).
It was my mistake. I was trying to use:

Code: Select all

	static const char* canDos[] =
	{
		"receiveVstEvents",
		"receiveVstMidiEvent",
		"midiProgramNames",
		"canProcessReplacing"
	};

	for (VstInt32 canDoIndex = 0; canDoIndex < sizeof (canDos) / sizeof (canDos[0]); canDoIndex++)
	{
		printf ("Can do %s... ", canDos[canDoIndex]);
		VstInt32 result = (VstInt32)effect->dispatcher (effect, effCanDo, 0, 0, (void*)canDos[canDoIndex], 0);
		switch (result)
		{
			case 0  : printf ("don't know"); break;
			case 1  : printf ("yes"); break;
			case -1 : printf ("definitely not!"); break;
			default : printf ("?????");
		}
		printf ("\n");
	}
Instead I should have checked the flags field to figure it out. It turns out your VST does support processReplacing.

I'll figure out how to get some sound out of this baby, sooner or later! :p

Post

It works now! All I had to do was return a VstTimeInfo struct.

Of course I don't have any timing yet in my sequencer, so I'm just letting Glitch run on its own. Fantastic.

Btw your vst is awesome, but you know that. ;)

Post Reply

Return to “DSP and Plugin Development”