History

a bit better example; build it on default rule

Sigrid Solveig Haflínudóttir committed 3 years ago

Commit ba1cc6b1 parent a3746882 files · +12 −7Browse files

Unified · Split

2 files
  1. leaf/mkfile +6 −2
  2. leaf/plan9_example.c +6 −5
leaf/mkfile+6−2
@@ -1,5 +1,6 @@
11 </$objtype/mkfile
22 LIB=libleaf.$objtype.a
3+TARG=plan9_example
34
45 CFLAGS=$CFLAGS -p -IInc -IExternals -IExternals/plan9 -D__plan9__=1
56
@@ -54,14 +55,17 @@ HFILES=\ · 48 unmodified lines
5455
5556 LIBOBJ=${OFILES:%=$LIB(%)}
5657
57−default:V: $LIB
58+default:V: $LIB $TARG
5859
59−all:V: $LIB
60+all:V: $LIB $TARG
6061
6162 $LIB: $LIBOBJ
6263 ar vu $LIB $newmember
6364
6465 $LIB(%.$O):N: %.$O
6566
67+$TARG: $TARG.$O
68+ $LD $LDFLAGS -o $target $prereq
69+
6670 clean:V:
6771 rm -f */*.[$OS] */*/*.[$OS] *.a
leaf/plan9_example.c+6−5
@@ -11,20 +11,21 @@ void · 10 unmodified lines
1111 main(int, char **)
1212 {
1313 LEAF leaf;
14− tCycle cycle;
14+ tCycle cycle, cycle2;
1515 char mem[1000];
1616 Biobuf out;
1717 int i;
1818
1919 LEAF_init(&leaf, 44100, mem, 1000, fandom);
2020 tCycle_init(&cycle, &leaf);
21− tCycle_setFreq(&cycle, 220);
21+ tCycle_init(&cycle2, &leaf);
22+ tCycle_setFreq(&cycle2, 10);
2223 Binit(&out, 1, OWRITE);
2324
24− for(i = 0; i < 44100; i++){
25− float f = tCycle_tick(&cycle);
25+ for(i = 0; i < 2*44100; i++){
2626 s16int s[2];
27− s[0] = 16384.0f*(f - 0.5f);
27+ tCycle_setFreq(&cycle, 800 + 400*tCycle_tick(&cycle2));
28+ s[0] = 16384.0f*(tCycle_tick(&cycle) - 0.5f);
2829 s[1] = s[0];
2930 Bwrite(&out, s, sizeof(s));
3031 }

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