File tree 3 files changed +6
-17
lines changed
3 files changed +6
-17
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
- import * as Tone from ' tone' ;
3
-
4
- import { onMount } from ' svelte' ;
5
2
import Voice from ' $lib/voice.svelte' ;
6
3
7
4
let voices = 1 ;
8
-
9
- onMount (() => {
10
- Tone .start ();
11
- });
12
5
</script >
13
6
14
7
<div class =" space-y-4" >
15
- {#each Array (voices ) as _ }
16
- <Voice />
8
+ {#each Array (voices ) as _ , i }
9
+ <Voice >
10
+ <slot >Voice {i + 1 }</slot >
11
+ </Voice >
17
12
{/each }
18
13
<button class ="py-4 card variant-soft-secondary w-full" on:click ={() => (voices += 1 )}
19
14
>Add Voice</button
Original file line number Diff line number Diff line change 30
30
31
31
<div class =" card variant-ghost p-4 w-full flex flex-col h-full mx-auto justify-center items-center" >
32
32
{#if osc }
33
- <p >Voice</p >
33
+ <slot >Voice</slot >
34
34
<button on:click ={toggleOsc } type =" button" class =" btn btn-icon variant-ghost uppercase" >
35
35
<img src ={icon } alt =" " />
36
36
</button >
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
- let start = false ;
3
2
import Synth from ' $lib/synth.svelte' ;
4
3
</script >
5
4
6
5
<div class =" p-4 w-full space-y-4" >
7
- <button class ="btn variant-soft-primary w-full" on:click ={() => (start = ! start )}
8
- >{start ? ' Stop' : ' Start' }</button
9
- >
10
- {#if start }
11
- <Synth />
12
- {/if }
6
+ <Synth />
13
7
</div >
You can’t perform that action at this time.
0 commit comments