History

basic structure for example docs

Matthew Wang committed 6 years ago

Commit cea72f61 parent 223a8ee8 files · +93 −9Browse files

Showing the changes to Examples (2 of 8 files). Show all

Unified · Split

2 files
  1. Examples/basic-oscillators.c +36 −0
  2. Examples/basic-oscillators.h +22 −0
Examples/basic-oscillators.c+36−0
@@ -0,0 +1,36 @@
1+/*
2+ ==============================================================================
3+
4+ basic-oscillators.c
5+ Created: 5 Mar 2020 2:56:24pm
6+ Author: Matthew Wang
7+
8+ ==============================================================================
9+*/
10+
11+#include "basic-oscillators.c"
12+
13+void exampleInit()
14+{
15+ LEAF_init(44100, 64, mempool, 1000, &exampleRandom);
16+
17+ tCycle_init(&cycle);
18+ tCycle_setFreq(&cycle, 220);
19+}
20+
21+void exampleFrame()
22+{
23+
24+}
25+
26+float exampleTick(float sampleIn)
27+{
28+ float sampleOut = tCycle_tick(&cycle);
29+ return sampleOut;
30+}
31+
32+float exampleRandom()
33+{
34+ return ((float)rand()/(float)(RAND_MAX));
35+}
36+
Examples/basic-oscillators.h+22−0
@@ -0,0 +1,22 @@
1+/*
2+ ==============================================================================
3+
4+ basic-oscillators.h
5+ Created: 5 Mar 2020 2:56:24pm
6+ Author: Matthew Wang
7+
8+ ==============================================================================
9+*/
10+
11+#include "../LEAF/leaf.h"
12+
13+char mempool[1000];
14+tCycle cycle;
15+
16+void exampleInit(void);
17+
18+void exampleFrame(void);
19+
20+float exampleTick(float sampleIn);
21+
22+float exampleRandom(void);

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