ZenDB API thoughts

My last post about the ZenAwareFX API extensions triggered a lot of questions from other developers, and it really seems I need to clarify how things work. Let’s try with the following diagram:

On the right side you can see how Zen works within a VST host: Zen is loaded as a plugin, and can itself load other plugins. These plugins, when supporting the ZenAwareFX extensions, are able to cooperate with Zen, mostly for defining external asset files that the plugin may require.

On the left side, you can see how the ZenDaemon process queries the master Zen database over the internet, to retrieve relevant presets and tags, and update the local Zen database. In most cases (e.g when the host computer is connected to the internet) this ZenDaemon process lives as a separate thread inside the Zen plugin, so there is no need to run it explicitly.

The ZenDB API (currently under definition) will most probably consists in a header file, and a library for you to link with. It will enable plugin developers to query the local Zen database directly – for things like retrieving presets, searching for presets, adding or removing tags…

Basically, this means that a plugin developer who wants to implement a presets browser in his synth will only need to deal with the UI of the browser – tags, presets uploads/downloads/updates will be handled by ZenDB.

The local database is a SQLite file, which means that it doesn’t require to install anything on the end user system.

Another question I get asked a lot is, “if I use ZenDB in my plugin, do I need to install Zen on the end user system ?”. The answer is, “no – but ZenDB will create a Zen-compatible filesystem structure, that Zen will reuse if it is installed at a later time.”

A preliminary view of the Zen API’s

Note: A more recent version of this draft is available here

With Zen becoming more stable (especially with the 1.4 release), it is now time to start on opening it up to other developers. I am going to release 2 Zen API’s:
- the ZenAwareAudioFX API is a small extension to AudioEffectX, designed for cooperation between Zen and its hosted plugins.
- the ZenDB API will provide access to the local Zen database, and will allow developers to run searches to implement their own presets browser/manager.

Let me focus on the first API, which is the one I have mostly been working on lately. The need for this API stemmed from the need to deal with complex presets, with dependencies on data files (typically, samples) managed outside of the plugin. Absynth is a good example, and if you try to load a preset into Absynth without having the required .wav files in the proper folder, you will be greeted by an error message.

The ZenAwareAudioFX class aims to correct this, by enabling the plugin to communicate information about the required external files (that I call “assets”) it needs for the current preset. Everything is based on the existing mechanisms in the VST SDK, namely:

  • The host (e.g, Zen) will send requests to the Zen-aware plugin using vendorSpecific calls
  • The plugin will query the host using hostVendorSpecific calls

The ZenAwareAudioFX class takes care of all these calls, and leaves you with a few high level methods. These methods are pure virtual, so you simply have to inherit from ZenAwareAudioFX instead of AudioEffectX, and implement these methods in your plugin.

The methods you will need to implement are explained below:

virtual bool hasExternalAssets() const;This tells Zen if your plugin uses external assets. Usually this will return true, as you wouldn’t be here otherwise !

virtual unsigned int zenGetNumberOfAssets() const;This tells how many assets are used by the current preset.

virtual Zen::ZenErrorCode zenGetAssetName(unsigned int idx, char* assetName) const;This returns the name of the nth asset in the current preset. The host (Zen) will provide a char[128] buffer in assetName for you to write in. This name will be used to uniquely identify your asset among others for the same plugin, so if you use numeric ID’s for your assets, you can use itoa or equivalent to fill in the name.

virtual unsigned int zenGetAssetDataSize(unsigned int idx) const;As far as Zen is concerned, assets are opaque blocks of data with a name and a size. Zen will call this to know the required size, so that it can allocate it before calling the next method.

virtual Zen::ZenErrorCode zenGetAssetData(unsigned int idx, void* data) const;This sends the nth asset data to Zen. You just need to write into the provided data area (which has been allocated by Zen according to the size you declared in the previous method), using whatever serialization mechanism you want. Zen will associate this data block with the preset, upload it to the server, and distribute it to the clients.

typedef struct {
const char *assetName;
unsigned int assetSize;
void* data;
} ZenAssetData;
Zen::ZenErrorCode zenQueryAssetData(Zen::ZenAssetData* data);
This is used by the plugin to retrieve the asset from Zen. You will actually have to call this twice: first fill in assetName and set data to NULL. The call will return assetSize. Then allocate your memory area according to assetSize, set the data pointer in the ZenAssetData structure, and call this method again – Zen will then fill the area with the asset data.

BigTick Christmas promotion: only 2 weeks left

Don’t miss our Holiday sale: until December 31, we are offering a 50% discount on Rhino virtual synthesizer. This is a unique occasion to own this classic, now for 35 € only.

Go to our online shop and use coupon code XMAS2010 to get your discount.

Zen !

Just announced Zen on kvr – and I think the feedback has been great so far. People have very legitimate and relevant questions, but with a genuine interest. I’m glad I wasn’t so far off, about about 9 months ago, when I started writing down the Zen requirements: the music software industry is now ready for the turn we have seen in the games industry, and users are willing to consider software that requires online connectivity if this means better functionality or service, ease of use, while of course respecting privacy.

Beta testing is starting today and I am really counting on the involvement of users to start publishing and tagging presets. So if you want to contribute… just drop me a line !

  • What users say

    "I used my Korg 05R/W mainly for it's choir sounds. I sold it a while ago because I thought that I would be able to find a VSTi that could do that. After looking around for a while I started to regret that I'd sold the Korg because I could not find a VSTi that was able to produce those lush and airy choir sounds. When I heard Angelina I was so happy and jolly went out and bought it. Much respect!" - Slacknote
  • Register

  • Welcome !

    Welcome to Big Tick web site ! Please login or register.

    Registration is free, and will enable you to download additional instruments and effects.