/bitwig-api-proxy

Don't use this: A set of proxy classes that wrap the Bitwig Controller Scripting API, automatically caching observed properties and created objects.

Primary LanguageTypeScriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Bitwig API Proxy

DON'T USE THIS. This package is no longer useful in Bitwig >= 2.0 as the api now gives you direct access to read values without setting up observers. As such, this package will no longer be maintained.


This set of proxy classes wrap the Bitwig Controller Scripting API in a way that automatically caches observed properties and created objects, while having the added benefit of removing the need for stub files. It exists as part of the Typewig framework, but can be used generally.

Installation

$ npm install --save bitwig-api-proxy

Usage

Once you have setup an observer for the first time or called a create method...

import { host } from 'bitwig-api-proxy';


const transport = host.createTransport();
transport.addIsPlayingObserver(isPlaying => {/* ...do something */});

...the associated value will be added to the cache of the method's class instance (as shown below).

console.log(transport.cache.isPlaying);  // always reflects the current isPlaying state

Limitations

The cache, while helpful, currently has its limitations. Cached property names will be the same for method calls with the same methodName, but different args. That means that if you call a create method more than once, each subsequent call will replace the associated cached reference. The same goes for observer methods.