Sigrid Solveig Haflínudóttircompile stuff50243ce5 years agoHistory
47 lines · 807 B · C
RawDownload
/* This code is placed in the public domain. */ #include <stdlib.h>#include "soundpipe.h" int sp_maygate_create(sp_maygate **p){    *p = malloc(sizeof(sp_maygate));    return SP_OK;} int sp_maygate_destroy(sp_maygate **p){    free(*p);    return SP_OK;} int sp_maygate_init(sp_data *sp, sp_maygate *p){    USED(sp);     p->prob = 0.0;    p->gate = 0;    p->mode = 0;    return SP_OK;} int sp_maygate_compute(sp_data *sp, sp_maygate *p, SPFLOAT *in, SPFLOAT *out){    if (*in == 0) {        if (p->mode) {            *out = 0;        } else {            *out = p->gate;        }        return SP_OK;    }     if ((1.0 * sp_rand(sp) / SP_RANDMAX) <= p->prob) {        *out = 1;        p->gate = 1;    } else {        *out = 0;        p->gate = 0;    }    return SP_OK;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t