Skip to content

Commit ab45209

Browse files
committed
chore: cleanup
1 parent 4a55498 commit ab45209

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

src/lib/synth.svelte

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
<script lang="ts">
2-
import * as Tone from 'tone';
3-
4-
import { onMount } from 'svelte';
52
import Voice from '$lib/voice.svelte';
63
74
let voices = 1;
8-
9-
onMount(() => {
10-
Tone.start();
11-
});
125
</script>
136

147
<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>
1712
{/each}
1813
<button class="py-4 card variant-soft-secondary w-full" on:click={() => (voices += 1)}
1914
>Add Voice</button

src/lib/voice.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<div class="card variant-ghost p-4 w-full flex flex-col h-full mx-auto justify-center items-center">
3232
{#if osc}
33-
<p>Voice</p>
33+
<slot>Voice</slot>
3434
<button on:click={toggleOsc} type="button" class="btn btn-icon variant-ghost uppercase">
3535
<img src={icon} alt="" />
3636
</button>

src/routes/+page.svelte

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
<script lang="ts">
2-
let start = false;
32
import Synth from '$lib/synth.svelte';
43
</script>
54

65
<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 />
137
</div>

0 commit comments

Comments
 (0)