Sigrid Solveig Haflínudóttircompile stuff50243ce5 years agoHistory
55 lines · 1.1 KB · C
RawDownload
/* * Phasor * * A phasor produces a non-bandlimited sawtooth wave, * normalized to be in range 0-1. Phasors are most * frequently used to create table-lookup oscillators. * * This code is placed in the public domain. */ #include <stdlib.h>#define SK_PHASOR_PRIV#include "tangled/phasor.h"#include "soundpipe.h" int sp_phasor_create(sp_phasor **p){    *p = malloc(sizeof(sp_phasor));    return SP_OK;} int sp_phasor_destroy(sp_phasor **p){    sp_phasor *pp;    pp = *p;    free(pp->phasor);    free(*p);    return SP_OK;} int sp_phasor_init(sp_data *sp, sp_phasor *p, SPFLOAT iphs){    p->phasor = malloc(sizeof(sk_phasor));    p->freq = 440;    sk_phasor_init(p->phasor, sp->sr, iphs);    sk_phasor_freq(p->phasor, p->freq);    return SP_OK;} int sp_phasor_compute(sp_data *sp, sp_phasor *p, SPFLOAT *in, SPFLOAT *out){    USED(sp, in);     sk_phasor_freq(p->phasor, p->freq);    *out = sk_phasor_tick(p->phasor);    return SP_OK;} int sp_phasor_reset(sp_data *sp, sp_phasor *p, SPFLOAT iphs){    USED(sp);     sk_phasor_reset(p->phasor, iphs);    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