|
4 | 4 | import type { voiceType } from './types';
|
5 | 5 | export let voice: voiceType;
|
6 | 6 |
|
7 |
| -<<<<<<< Updated upstream |
8 |
| - let osc: Tone.Oscillator | undefined = undefined; |
9 |
| - let touchStartY: number = 0; |
10 |
| - let value: number = 0; |
11 |
| -======= |
12 | 7 | let valueInDb: number = -Infinity;
|
13 | 8 | $: {
|
14 | 9 | valueInDb = 20 * Math.log10(value);
|
|
18 | 13 | let osc: Tone.Oscillator | undefined = undefined;
|
19 | 14 | // let touchStart: number = 0;
|
20 | 15 | let value: number = -100;
|
21 |
| ->>>>>>> Stashed changes |
22 | 16 |
|
23 | 17 | onMount(() => {
|
24 | 18 | if (osc) return;
|
25 | 19 | import('tone').then((Tone) => {
|
26 | 20 | osc = new Tone.Oscillator(voice.note, 'sine').toDestination();
|
27 | 21 | });
|
28 | 22 | });
|
29 |
| -<<<<<<< Updated upstream |
30 |
| - // $: console.log(value); |
31 |
| -======= |
32 |
| ->>>>>>> Stashed changes |
33 | 23 | </script>
|
34 | 24 |
|
35 | 25 | <button
|
36 | 26 | on:touchstart={(e) => {
|
37 |
| -<<<<<<< Updated upstream |
38 |
| - touchStartY = e.changedTouches[0].clientY; |
39 |
| - }} |
40 |
| - on:touchmove={(e) => { |
41 |
| - const touch = e.changedTouches[0]; |
42 |
| - const directionY = touchStartY < touch.clientY ? 'down' : 'up'; |
43 |
| - // const directionX = touchStartX < touch.screenX ? 'left' : 'right'; |
44 |
| - if (directionY == 'up' && value == 0) return; |
45 |
| - if (directionY == 'down' && value < 100) { |
46 |
| - value += 1; |
47 |
| - } |
48 |
| - if (directionY == 'up' && value > 0) value -= 1; |
49 |
| -======= |
50 | 27 | // touchStart = e.changedTouches[0].clientX;
|
51 | 28 | if (osc) osc.start();
|
52 | 29 | }}
|
|
60 | 37 | 0
|
61 | 38 | );
|
62 | 39 | if (osc) osc.volume.linearRampTo(value, 0.1);
|
63 |
| ->>>>>>> Stashed changes |
64 | 40 | }}
|
65 | 41 | class="flex justify-center items-center"
|
66 | 42 | >
|
|
69 | 45 | <rect width="100" height="100" fill={voice.color} />
|
70 | 46 | <text x="10" y="60" font-size="35" fill="white">{value}</text>
|
71 | 47 | </g>
|
72 |
| -<<<<<<< Updated upstream |
73 |
| - <!-- <g> |
74 |
| - <rect x="0" y="0" width="100" height="100" fill="red"></rect> |
75 |
| - <text x="0" y="50" font-family="Verdana" font-size="35" fill="blue">Hello</text> |
76 |
| - </g> --> |
77 |
| -======= |
78 |
| ->>>>>>> Stashed changes |
79 | 48 | </svg>
|
80 | 49 | </button>
|
0 commit comments