History

added mtof. also generic pointer stack operations

Paul Batchelor committed 5 years ago

Commit f84a13e1 parent e501bf12 files · +45 −0Browse files

Unified · Split

2 files
  1. core.org +44 −0
  2. mkdb.janet +1 −0
core.org+44−0
@@ -677,6 +677,50 @@ int sk_param_out(sk_core *core, · 676 unmodified lines
677677 =sk_param_out= will take an output cable of a node
678678 (referenced by index), and push it onto the sndkit stack.
679679 It will also push the cable's buffer onto the stack.
680+** Pushing/Popping Generic Pointers
681+#+NAME: funcdefs
682+#+BEGIN_SRC c
683+int sk_core_generic_push(sk_core *core, void *ptr);
684+int sk_core_generic_pop(sk_core *core, void **ptr);
685+#+END_SRC
686+
687+#+NAME: funcs
688+#+BEGIN_SRC c
689+int sk_core_generic_push(sk_core *core, void *ptr)
690+{
691+ int rc;
692+ sk_stacklet *s;
693+
694+ rc = sk_stack_push(&core->stack, &s);
695+ SK_ERROR_CHECK(rc);
696+
697+ s->type = SK_TYPE_GENERIC;
698+ s->ptr = ptr;
699+
700+ return rc;
701+}
702+#+END_SRC
703+
704+#+NAME: funcs
705+#+BEGIN_SRC c
706+int sk_core_generic_pop(sk_core *core, void **ptr)
707+{
708+ int rc;
709+ sk_stacklet *s;
710+
711+ rc = sk_stack_pop(&core->stack, &s);
712+
713+ SK_ERROR_CHECK(rc);
714+
715+ if (s->type != SK_TYPE_GENERIC) {
716+ return 1;
717+ }
718+
719+ if (ptr != NULL) *ptr = s->ptr;
720+
721+ return rc;
722+}
723+#+END_SRC
680724 * Registers
681725 A register interface is used alongside the stack
682726 interface to store and retrieve data. A value stored
mkdb.janet+1−0
@@ -39,6 +39,7 @@ · 38 unmodified lines
3939 (ww-add-link "siren" "doc/siren.org")
4040 (ww-add-link "smoother" "dsp/smoother.org")
4141 (ww-add-link "metro" "dsp/metro.org")
42+(ww-add-link "mtof" "dsp/mtof.org")
4243
4344 # sync and close
4445

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