ref: 262fbae1b70df3a7883a5c2b8df05e486622559b
dir: /piper/kick.c/
#include <u.h>
#include <libc.h>
#include "piper.h"
typedef struct Kick Kick;
struct Kick {
struct {
int freq;
int attack;
int release;
}a;
struct {
int freq;
int attack;
int release;
int enable;
}b;
int gate;
int volume;
char path[1];
};
static void
cmd(void *aux, Cmd *c)
{
}
static void *
alloc(char *path)
{
Kick *k;
if ((k = calloc(1, sizeof(*k) + strlen(path) + 1)) != nil) {
k->a.freq = pathopen(path, "A/Frequency/ctl");
k->a.attack = pathopen(path, "A/Attack/ctl");
k->a.release = pathopen(path, "A/Release/ctl");
k->b.freq = pathopen(path, "B/Frequency/ctl");
k->b.attack = pathopen(path, "B/Attack/ctl");
k->b.release = pathopen(path, "B/Release/ctl");
k->b.enable = pathopen(path, "B/Enable/ctl");
k->gate = pathopen(path, "Control/Gate/ctl");
k->volume = pathopen(path, "Control/Gain/ctl");
strcpy(k->path, path);
}
return k;
}
Synth kick_drum = {
.name = "Kick Drum",
.cmd = cmd,
.alloc = alloc,
};