Instantiate Failed (Magicmatch)

Last year I began tinkering with software synths… i.e. I developed a little synth in C, and used it for a rudimentary 64k intro (details here: http://soledadpenades.com/projects/demoscene/to_the_beat/ )

But the Impulse Tracker exporter was a little limited, I couldn’t adjust the parameters of the synth on the fly and it was very tedious to get the sound I wanted.

I am now developing “V2” of this synth, will now use C++ instead of C and I have thought I’ll “embed” it into a VST instrument so that I can play with all the parameters on the fly, build the whole song in renoise using my synth and then export it to my demo format with an exporter I’ll build later.

I was planning on using Renoise since it’s the only VST host that works for me and my system (linux), plus it saves a Song.xml file that I can parse ;)

But I’m getting some problems and since there are several vst linux developers round here, I thought it could be a good idea to ask for help here.

The main problem I’m getting now is this error in Renoise’s log:

VstPlugs: Trying to instantiate /home/sole/.vst/sorollet_vst.so  
VstPlugs: Instantiate FAILED (MagicMatch) !!!  
  

I don’t know if that could be something related to my setup… It is somehow awkward: Ubuntu 64 bit, but I am building the plugin in 32bit (anyway, until I didn’t build it with 32 bit, renoise wouldn’t even try to load it).

Or maybe it is something else I have done, it’s not like there’s a lot of docs about vst synth dev in linux… :D

Maybe Renoise team members know what that message means… hope they don’t mind telling me!

Thanks :lol:

MagicMatch: calling the main vst function returns an invalid AEffect or AEffect.magic != ‘VstP’

Thanks TakTik!

I wasn’t returning the instance of the plugin properly… had done a mess with includes and the “main” function which has to be recreated in a magic way in linux and blablah.

Now it loads but it’s crashing somewhere else (I’m getting a superdreadful error message which says the plugin crashed in VST event/function ‘Dispatch’).

It’s being quite a bumpy road but I think I’ll get to grips with this, one way or the other.

I wonder how do people debug VST’s… But I guess this isn’t the forum for this. Now back to work. Thanks again! :yeah:

gdb PATH_TO/renoise
load the plugin in Renoise
when you build your so with debug info, gdb will load and use it…

Oh thanks again taktik. You’re great :)

I tried this but for some reason gdb just spits an strange error in my main system (x64). I have searched for more info about it (googled) but it seems to be happening in 64bit systems only:

Renoise LOG> System: Failed to create a RT thread. Trying again as FIFO thread on process scope...  
/build/buildd/gdb-7.0/gdb/infrun.c:2455: internal-error: handle_inferior_event: Assertion `inf' failed.  
A problem internal to GDB has been detected,  
further debugging may prove unreliable.  
Quit this debugging session? (y or n) y  
  
/build/buildd/gdb-7.0/gdb/infrun.c:2455: internal-error: handle_inferior_event: Assertion `inf' failed.  
A problem internal to GDB has been detected,  
further debugging may prove unreliable.  
Create a core file of GDB? (y or n) n  
Renoise LOG> CrashLog: [0xf7773400]  
Renoise LOG> CrashLog: [(nil)]  
  

But I tried the same thing in a VirtualBox-ed ubuntu 32 bit and it works, and I could find the error. So it’s going to be slow as hell to debug, I’ll have to be supercareful x)

What does this error mean:

VstPlugs: Plugin is a Mach-O executable...
VstPlugs: Instantiate FAILED (MagicMatch failed - is no VST Plugin) !!!
VstPlugs: CreateInstance FAILED

Any idea? It loads in Bitwig…

Hmm. TakTik above said…

MagicMatch: calling the main vst function returns an invalid AEffect or AEffect.magic != ‘VstP’

In other words, when the vst is instanced from its VSTMain function it should return a valid pointer to a AEffect structure. See http://ygrabit.steinberg.de/~ygrabit/public_html/vstgui/V2.0/include/AEffect.hIn that file you will see the lines…

#define kEffectMagic CCONST ('V', 's', 't', 'P')

//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------

struct AEffect
{
	long magic; // must be kEffectMagic ('VstP')
	long (VSTCALLBACK *dispatcher)(AEffect *effect, long opCode, long index, long value,
		void *ptr, float opt);
	void (VSTCALLBACK *process)(AEffect *effect, float **inputs, float** outputs, long sampleframes);
	void (VSTCALLBACK *setParameter)(AEffect *effect, long index, float parameter);
	float (VSTCALLBACK *getParameter)(AEffect *effect, long index);

	long numPrograms;
	long numParams; // all programs are assumed to have numParams parameters
	long numInputs; //
	long numOutputs;	//
	long flags; // see constants
	long resvd1; // reserved, must be 0
	long resvd2; // reserved, must be 0
	long initialDelay;	// for algorithms which need input in the first place
	long realQualities;	// number of realtime qualities (0: realtime)
	long offQualities;	// number of offline qualities (0: realtime only)
	float ioRatio; // input samplerate to output samplerate ratio, not used yet
	void *object; // for class access (see AudioEffect.hpp), MUST be 0 else!
	void *user; // user access
	long uniqueID; // pls choose 4 character as unique as possible.
						// this is used to identify an effect for save+load
	long version; //
	void (VSTCALLBACK *processReplacing)(AEffect *effect, float **inputs, float** outputs, long sampleframes);
	char future[60];	// pls zero
};

That ‘long magic’ entry in that structure must contain the bytes ‘VstP’ for it to be considered a valid pointer to the structure (hence the term ‘MagicMatch’). If it works in Bitwig however they could be ignoring the check of the magic entry in the structure? They could assume they have a valid AEffect pointer so long as it is not null. But that is very very very speculative on my part.

Worth probably checking if the vst loads in other hosts?

Thanks, still wonder, because after 10.9->10.12.4 upgrade, Korg Wavestation refuses to load as VST in Renoise, but component still works. The vst also works in bitwig.

Any idea maybe?

Is there a way to extract the fxp data from song xml, and put it into the wave station preset dir, hopefully the synth can handle fxp preset loading itself?

Seems to be a Sierra/Korg/Renoise problem :slight_smile:

EDIT: Uhm btw it would be awesome, if Renoise would make the fxp data accessible in such a case, e.g. a context menu entry “save fxp”, so even if the vst does not load, you still can save the preset… I had quite a bunch of such cases. Sometimes it was an OS update, sometimes a synth update…

Is there a way to extract the fxp data from song xml…

The only real thing I can quickly see ffx is that the parameters for a vst are encoded in Base64/CDATA format in the song.xml file. So you would first have to extract that and convert it into plain ascii. Then I suppose you would have to add a fxp header to try and recreate a valid fxp file. There could be other small factors involved as well :slight_smile:

As for the Korg Wavestation loading thing, I agree it’s going to be a Sierra/Korg/Renoise problem somewhere ffx :slight_smile:

I found a strange workaround to make Korg Wavestation VST starting again:

  • Load the Wavestation AU

  • Now load your song which uses the WavestationVST

Vague explanation: Since the AU version only is a wrapper and also loads the VST version (but here works), the VST is now cached in memory. If you now load the song, the VST will be loaded from cache and that bug preventing the usual loading way will not apply…?