Crate dome_cloomnik[][src]

A framework for building DOME plugins.

The basic structure of every plugin using this framework is:

Cargo.toml:

[package]
name = "my_awesome_dome_plugin"
description = "Really, really awesome DOME plugin written in Rust!"
version = "0.1.0"
authors = ["Me <me@gmail.com>"]
edition = "2018"

[dependencies]
libc = "0.2"
dome_cloomnik = "0.1"

[lib]
crate-type = ["cdylib"]

lib.rs:

use dome_cloomnik::{Context, WrenVM, register_modules};

#[no_mangle]
#[allow(non_snake_case)]
extern "C" fn PLUGIN_onInit(get_api: *mut libc::c_void, ctx: *mut libc::c_void) => libc::c_int {
    unsafe {
        dome_cloomnik::init_plugin(
            get_api,
            ctx,
            dome_cloomnik::Hooks {
                on_init: Some(on_init),
                pre_update: Some(pre_update),
                post_update: Some(post_update),
                pre_draw: Some(pre_draw),
                post_draw: Some(post_draw),
                on_shutdown: Some(on_shutdown),
            }
        );
    }
}

fn on_init(ctx: &Context) -> Result<(), ()> {
    register_modules! {
        ctx,
        ...
    };

    // ...
}

fn pre_update(ctx: &Context) -> Result<(), ()> {
    // ...
}

fn post_update(ctx: &Context) -> Result<(), ()> {
    // ...
}

fn pre_draw(ctx: &Context) -> Result<(), ()> {
    // ...
}

fn post_draw(ctx: &Context) -> Result<(), ()> {
    // ...
}

fn on_shutdown(ctx: &Context) -> Result<(), ()> {
    // ...
}

Go ahead, and start with [learning DOME plugins from the docs][https://domeengine.com/plugins/]. Don't worry, much of the things there will apply to doom_cloomnik too!

Macros

register_modules

Helper macro to register modules in Wren.

Structs

CallbackChannel

A DOME audio channel, as passed to the channel callbacks (mix and update).

Channel

A DOME audio channel.

Context

A context is the gate to all of DOME's functionalities for plugins.

Hooks

A struct containing all plugin hooks. All hooks are optional.

WrenVM

This is the gate for all operations using Wren.

Enums

ChannelState

The state of a channel.

WrenType

A Wren type.

Functions

init_plugin

This function must be called from the PLUGIN_preUpdate() function, with exactly the same arguments.

Type Definitions

ChannelMix

The mix callback of channel. It is responsible to fill buffer. See [DOME's documentation][https://domeengine.com/plugins/#audio] for more details.

ChannelUpdate

The update callback of channel. It is called between frames. See [DOME's documentation][https://domeengine.com/plugins/#audio] for more details.

Hook

DOME plugin hook.