History

added scale

Paul Batchelor committed 5 years ago

Commit 14f4c7a1 parent f8a34974 files · +63 −1Browse files

Unified · Split

4 files
  1. Makefile +2 −1
  2. algos.org +2 −0
  3. mkdb.janet +1 −0
  4. scale.org +58 −0
Makefile+2−1
@@ -52,7 +52,8 @@ phasor.o \ · 51 unmodified lines
52swell.o \52swell.o \
53biramp.o \53biramp.o \
54core.o \54core.o \
55patchwerk/patchwerk.o55patchwerk/patchwerk.o \
56scale.o \
56 57
57include nodes/config.mk58include nodes/config.mk
58 59
algos.org+2−0
@@ -44,3 +44,5 @@ whose smoothing amount changes based on the direction. · 43 unmodified lines
44 44
45@!(ref "biramp")!@ converts a phasor ramp signal into a ramp45@!(ref "biramp")!@ converts a phasor ramp signal into a ramp
46that goes up and down.46that goes up and down.
47
48@!(ref "scale")!@ provides some simple scaling utilities.
mkdb.janet+1−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
33(ww-add-link "swell" "swell.org")33(ww-add-link "swell" "swell.org")
34(ww-add-link "biramp" "biramp.org")34(ww-add-link "biramp" "biramp.org")
35(ww-add-link "core" "core.org")35(ww-add-link "core" "core.org")
36(ww-add-link "scale" "scale.org")
36 37
37# sync and close38# sync and close
38 39
scale.org+58−0
@@ -0,0 +1,58 @@
1#+TITLE: Scale
2* Overview
3=scale= provides some helpful scaling functions. Scaling
4refers to taking a value in some range, and then protionally
5refitting it to be in another range. In other words...
6scaling!
7* Tangled files
8=scale.h= and =scale.c=
9
10#+NAME: scale.h
11#+BEGIN_SRC c :tangle scale.h
12#ifndef SK_SCALE_H
13#define SK_SCALE_H
14#ifndef SKFLT
15#define SKFLT float
16#endif
17<<funcdefs>>
18#endif
19#+END_SRC
20
21#+NAME: scale.c
22#+BEGIN_SRC c :tangle scale.c
23#include "scale.h"
24<<funcs>>
25#+END_SRC
26* Scale
27The function =sk_scale= takes in a value between 0 and 1,
28an returns a value to be in between =min= and =max=.
29
30#+NAME: funcdefs
31#+BEGIN_SRC c
32SKFLT sk_scale(SKFLT in, SKFLT min, SKFLT max);
33#+END_SRC
34
35#+NAME: funcs
36#+BEGIN_SRC c
37SKFLT sk_scale(SKFLT in, SKFLT min, SKFLT max)
38{
39
40 return in * (max - min) + min;
41}
42#+END_SRC
43* Biscale
44The function =sk_biscale= takes a value between -1 and
451 and returns a value between =min= and =max=.
46
47#+NAME: funcdefs
48#+BEGIN_SRC c
49SKFLT sk_biscale(SKFLT in, SKFLT min, SKFLT max);
50#+END_SRC
51
52#+NAME: funcs
53#+BEGIN_SRC c
54SKFLT sk_biscale(SKFLT in, SKFLT min, SKFLT max)
55{
56 return min + (in + 1.0) * 0.5 * (max - min);
57}
58#+END_SRC

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