History

missing files

Paul Batchelor committed 5 years ago

Commit 9d8d9c41 parent bf3a8cd3 files · +129 −0Browse files

Unified · Split

3 files
  1. nodes/biramp/biramp.c +94 −0
  2. nodes/biramp/biramp.h +4 −0
  3. nodes/biramp/l_biramp.c +31 −0
nodes/biramp/biramp.c+94−0
@@ -0,0 +1,94 @@
1+#include <math.h>
2+#include <stdlib.h>
3+#include <stdint.h>
4+#include "patchwerk.h"
5+#include "core.h"
6+#include "dsp/biramp.h"
7+
8+struct biramp_n {
9+ pw_cable *in;
10+ pw_cable *pos;
11+ pw_cable *out;
12+ SKFLT lphs;
13+ SKFLT lpos;
14+};
15+
16+static void compute(pw_node *node)
17+{
18+ int blksize;
19+ int n;
20+ struct biramp_n *biramp;
21+
22+ blksize = pw_node_blksize(node);
23+
24+ biramp = (struct biramp_n *)pw_node_get_data(node);
25+
26+ for (n = 0; n < blksize; n++) {
27+ PWFLT in, pos, out;
28+ in = pw_cable_get(biramp->in, n);
29+ pos = pw_cable_get(biramp->pos, n);
30+
31+ out = sk_biramp_stateful(in, pos,
32+ &biramp->lphs,
33+ &biramp->lpos);
34+ pw_cable_set(biramp->out, n, out);
35+ }
36+}
37+
38+static void destroy(pw_node *node)
39+{
40+ pw_patch *patch;
41+ int rc;
42+ void *ud;
43+ rc = pw_node_get_patch(node, &patch);
44+ if (rc != PW_OK) return;
45+ pw_node_cables_free(node);
46+ ud = pw_node_get_data(node);
47+ pw_memory_free(patch, &ud);
48+}
49+
50+int sk_node_biramp(sk_core *core)
51+{
52+ pw_patch *patch;
53+ pw_node *node;
54+ int rc;
55+ sk_param in, pos;
56+ void *ud;
57+ struct biramp_n *biramp;
58+
59+ rc = sk_param_get(core, &pos);
60+ SK_ERROR_CHECK(rc);
61+
62+ rc = sk_param_get(core, &in);
63+ SK_ERROR_CHECK(rc);
64+
65+ patch = sk_core_patch(core);
66+
67+ rc = pw_memory_alloc(patch, sizeof(struct biramp_n), &ud);
68+ SK_PW_ERROR_CHECK(rc);
69+ biramp = (struct biramp_n *)ud;
70+
71+ biramp->lpos = -1;
72+ biramp->lphs = -1;
73+
74+ rc = pw_patch_new_node(patch, &node);
75+ SK_PW_ERROR_CHECK(rc);
76+
77+ rc = pw_node_cables_alloc(node, 3);
78+ SK_PW_ERROR_CHECK(rc);
79+
80+ pw_node_set_block(node, 2);
81+
82+ pw_node_get_cable(node, 0, &biramp->in);
83+ pw_node_get_cable(node, 1, &biramp->pos);
84+ pw_node_get_cable(node, 2, &biramp->out);
85+
86+ pw_node_set_data(node, biramp);
87+ pw_node_set_compute(node, compute);
88+ pw_node_set_destroy(node, destroy);
89+
90+ sk_param_set(core, node, &in, 0);
91+ sk_param_set(core, node, &pos, 1);
92+ sk_param_out(core, node, 2);
93+ return 0;
94+}
nodes/biramp/biramp.h+4−0
@@ -0,0 +1,4 @@
1+#ifndef SK_NODE_BIRAMP_H
2+#define SK_NODE_BIRAMP_H
3+int sk_node_biramp(sk_core *core);
4+#endif
nodes/biramp/l_biramp.c+31−0
@@ -0,0 +1,31 @@
1+#include <stdlib.h>
2+#include <stdio.h>
3+#include <string.h>
4+#include "lil/lil.h"
5+#include "patchwerk/patchwerk.h"
6+#include "core.h"
7+#include "sklil.h"
8+#include "biramp.h"
9+
10+static lil_value_t biramp(lil_t lil, size_t argc, lil_value_t *argv)
11+{
12+ sk_core *core;
13+ int rc;
14+ core = lil_get_data(lil);
15+
16+ SKLIL_ARITY_CHECK(lil, "biramp", argc, 2);
17+
18+ rc = sklil_param(core, argv[0]);
19+ SKLIL_PARAM_CHECK(lil, rc, "biramp");
20+ rc = sklil_param(core, argv[1]);
21+ SKLIL_PARAM_CHECK(lil, rc, "biramp");
22+
23+ rc = sk_node_biramp(core);
24+ SKLIL_ERROR_CHECK(lil, rc, "biramp didn't work out.");
25+ return NULL;
26+}
27+
28+void sklil_load_biramp(lil_t lil)
29+{
30+ lil_register(lil, "biramp", biramp);
31+}

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