Unified · Split
| @@ -1,5 +1,6 @@ | |||
| 1 | </$objtype/mkfile | 1 | </$objtype/mkfile |
| 2 | LIB=libleaf.$objtype.a | 2 | LIB=libleaf.$objtype.a |
| 3 | TARG=plan9_example | ||
| 3 | 4 | ||
| 4 | CFLAGS=$CFLAGS -p -IInc -IExternals -IExternals/plan9 -D__plan9__=1 | 5 | CFLAGS=$CFLAGS -p -IInc -IExternals -IExternals/plan9 -D__plan9__=1 |
| 5 | 6 | ||
| @@ -54,14 +55,17 @@ HFILES=\ · 48 unmodified lines | |||
| 54 | 55 | ||
| 55 | LIBOBJ=${OFILES:%=$LIB(%)} | 56 | LIBOBJ=${OFILES:%=$LIB(%)} |
| 56 | 57 | ||
| 57 | default:V: $LIB | 58 | default:V: $LIB $TARG |
| 58 | 59 | ||
| 59 | all:V: $LIB | 60 | all:V: $LIB $TARG |
| 60 | 61 | ||
| 61 | $LIB: $LIBOBJ | 62 | $LIB: $LIBOBJ |
| 62 | ar vu $LIB $newmember | 63 | ar vu $LIB $newmember |
| 63 | 64 | ||
| 64 | $LIB(%.$O):N: %.$O | 65 | $LIB(%.$O):N: %.$O |
| 65 | 66 | ||
| 67 | $TARG: $TARG.$O | ||
| 68 | $LD $LDFLAGS -o $target $prereq | ||
| 69 | |||
| 66 | clean:V: | 70 | clean:V: |
| 67 | rm -f */*.[$OS] */*/*.[$OS] *.a | 71 | rm -f */*.[$OS] */*/*.[$OS] *.a |
| @@ -11,20 +11,21 @@ void · 10 unmodified lines | |||
| 11 | main(int, char **) | 11 | main(int, char **) |
| 12 | { | 12 | { |
| 13 | LEAF leaf; | 13 | LEAF leaf; |
| 14 | tCycle cycle; | 14 | tCycle cycle, cycle2; |
| 15 | char mem[1000]; | 15 | char mem[1000]; |
| 16 | Biobuf out; | 16 | Biobuf out; |
| 17 | int i; | 17 | int i; |
| 18 | 18 | ||
| 19 | LEAF_init(&leaf, 44100, mem, 1000, fandom); | 19 | LEAF_init(&leaf, 44100, mem, 1000, fandom); |
| 20 | tCycle_init(&cycle, &leaf); | 20 | tCycle_init(&cycle, &leaf); |
| 21 | tCycle_setFreq(&cycle, 220); | 21 | tCycle_init(&cycle2, &leaf); |
| 22 | tCycle_setFreq(&cycle2, 10); | ||
| 22 | Binit(&out, 1, OWRITE); | 23 | Binit(&out, 1, OWRITE); |
| 23 | 24 | ||
| 24 | for(i = 0; i < 44100; i++){ | 25 | for(i = 0; i < 2*44100; i++){ |
| 25 | float f = tCycle_tick(&cycle); | ||
| 26 | s16int s[2]; | 26 | 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); | ||
| 28 | s[1] = s[0]; | 29 | s[1] = s[0]; |
| 29 | Bwrite(&out, s, sizeof(s)); | 30 | Bwrite(&out, s, sizeof(s)); |
| 30 | } | 31 | } |