Skip to main content

Blog

-> -> Improvements to language bindings
2021 Jan 30

More language binding work

For idiomatic javascript, two changes had to be made. One was to use named arguments, and the second was to use promises.

As far as I know it is not possible to provide native promises from C code, so it looks like the way forward for async functions is to provide javascript wrappers.

With these two changes in place, you end up with the following example:

/*
 *  Demonstration of connecting to the service and adding a new Track and Part
 */
imports.searchPath.push("../../gir")
imports.searchPath.push(".")

const GLib = imports.gi.GLib
const Waveform = imports.gi.Waveform
const Ayyi = imports.gi.Ayyi
const AM = imports.support.AM

const loop = new GLib.MainLoop(null, null)

AM.connect_all(async () => {

    // Add a new track
    const track_id = await AM.Song.add_track({
        type: Ayyi.MediaType.AUDIO,
        name: 'New Track',
        channels: Waveform.ChannelCount.MONO
    })

    log(`New Track ${track_id.get_idx()} added`)

    // Add a new Part
    const part_id = await AM.Song.add_part({
        name: 'New part',
        pool_item: AM.pool__get_item_from_idx(0),
        track: track_id.get_idx(),
        start: new Ayyi.SongPos({beat: 4}),
        length: 10000
    })

    log(`New part "${part_id.get_idx()}" added`)

    loop.quit()
}, null)

loop.run()

Currently still only a limited subset of functionality is available but a lot of the work to allow the introspection to correctly analyse the code has been done.


2020 Nov 21

Mixer strip UI comparison

As part of making some minor improvements to the mixer strip styling, I thought it was a good time to review the current state of mixer UI's.

Below is a side by side comparison of some of the most well known applications in the space. Ayyi is number 7.

From left to right, they are Ardour, Reaper-v6, Cubase 7, Cubase 8, DAE, Protools 11, Ayyi, FL Studio, Cakewalk, Voice Meeter, Reason 10, Performer 10, Note Performer, Logic, Reaper, Digital, Bain, Harrison Mixbus, Reason, Ableton Live, Reaper, Prosonus Studiolive

My personal favourite is number 15 which I believe is the Reaper Imperial theme. Hats off to those guys, very impressive.


2020 Nov 10

Javascript support

Proof of concept introspection was added to the client library. GObject Introspection is a pretty powerful facility. Its quite impressive that adding support for scripting languages such as JavaScript and Python is so easy.

An example JavaScript program looks like this

/*
 *  Demonstration of connecting to the server and adding a new Track
 */
const GLib  = imports.gi.GLib
const AM = imports.gi.AM

const loop = new GLib.MainLoop(null, null)

AM.init(null)

AM.connect_all(() => {
    AM.Song.add_track(
        1,
        "New Track",
        1,
        id => {
            log(`New Track ${id.get_idx()} added`)
            loop.quit()
        },
        null
    )
}, null)

loop.run()