foo

Files: foo.h, foo.c

A short title describing the module
This is a description of the entire module. This is not a real module. This description should be a comprehensive sumary of what this function does.
Inside the Lua table, this is expressed as a multiline string, however it does not adhere to the tradtional 80 column rule found in programming.
Write as much text as needed here...

Functions

sp_foo_create(sp_foo **foo)
sp_foo_init(sp_data *sp, sp_foo *foo, sp_ftbl *bar, SPFLOAT bar2)
sp_foo_compute(sp_data *sp, sp_foo *foo, SPFLOAT *clock, SPFLOAT *input, SPFLOAT *out_left, SPFLOAT *out_right)
sp_foo_destroy(sp_foo **foo)

Mandatory Parameters

bar: This is a mandatory table value. It does not have a default value, so we set it to 'N/A'. Any that does not or cannot have a default value should set this default value to 'N/A'.
(Recommended value: N/A)
bar2: This is a mandatory parameter. In soundpipe, users will always need to specify this value, but a default value has been giving in case it is needed to write more complicated engines in the future.
(Recommended value: 123)

Optional Parameters

blah_1: This is an optional parameter. These values are always set to a value by default, and can be set after the init function has been called.
(Default value: 1.5)
blah_2: This is yet another optional parameter...
(Default value: 456.7)

Inputs

clock: this is the clock source for a made up plugin.
input: this is the audio input for a made up plugin.

Outputs

out_left: Stereo left output for foo.
out_right: Stereo right output for foo.

Other Functions:

sp_foo_set(sp_data *sp, sp_foo *foo, SPFLOAT var1, SPFLOAT var2)
foo_set description goes here.
var1: This is the first parameter
(Suggested default: 1.5)
var2: This is the second parameter
(Suggested default: 1.5)

Example Code

/*
 * This is a dummy example.
 * Please implement a small and simple working example of your module, and then
 * remove this header.
 * Don't be clever.
 * Bonus points for musicality. 
 *
 */

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "soundpipe.h"

typedef struct {
    sp_foo *foo;
    sp_osc *osc;
    sp_ftbl *ft; 
} UserData;

void process(sp_data *sp, void *udata) {
    UserData *ud = udata;
    SPFLOAT osc = 0, foo = 0;
    sp_osc_compute(sp, ud->osc, NULL, &osc);
    sp_foo_compute(sp, ud->foo, &osc, &foo);
    sp->out[0] = foo;
}

int main() {
    UserData ud;
    sp_data *sp;
    sp_create(&sp);
    sp_srand(sp, 1234567);

    sp_foo_create(&ud.foo);
    sp_osc_create(&ud.osc);
    sp_ftbl_create(sp, &ud.ft, 2048);

    sp_foo_init(sp, ud.foo);
    sp_gen_sine(sp, ud.ft);
    sp_osc_init(sp, ud.osc, ud.ft, 0);

    sp->len = 44100 * 5;
    sp_process(sp, &ud, process);

    sp_foo_destroy(&ud.foo);
    sp_ftbl_destroy(&ud.ft);
    sp_osc_destroy(&ud.osc);

    sp_destroy(&sp);
    return 0;
}