Commit
·
b35b8ac
1
Parent(s):
5a52b09
update source selection interface
Browse files
sourceviewer/frontend/player/AudioPlayer.svelte
CHANGED
@@ -156,36 +156,38 @@
|
|
156 |
class="component-wrapper"
|
157 |
data-testid={label ? "waveform-" + label : "unlabelled-audio"}
|
158 |
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
<div class="waveform-container">
|
160 |
<div id="waveform" bind:this={container} />
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
<time id="
|
168 |
-
|
169 |
-
<time bind:this={durationRef} id="duration">0:00</time>
|
170 |
</div>
|
171 |
</div>
|
172 |
-
|
173 |
-
{#if audioDecoded}
|
174 |
-
{#each [...Array(waveform.getDecodedData().numberOfChannels).keys()] as channelIdx}
|
175 |
-
<label>
|
176 |
-
<input
|
177 |
-
type="radio"
|
178 |
-
name="channels"
|
179 |
-
value={`${channelIdx}`}
|
180 |
-
on:change={(ev) => {
|
181 |
-
splitter.disconnect()
|
182 |
-
splitter.connect(audioContext.destination, Number(ev.target.value), 0);
|
183 |
-
}}
|
184 |
-
/>
|
185 |
-
{channelIdx}
|
186 |
-
</label>
|
187 |
-
{/each}
|
188 |
-
{/if}
|
189 |
|
190 |
{#if waveform}
|
191 |
<WaveformControls
|
@@ -207,11 +209,42 @@
|
|
207 |
{/if}
|
208 |
|
209 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
.component-wrapper {
|
211 |
padding: var(--size-3);
|
212 |
width: 100%;
|
213 |
}
|
214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
:global(::part(wrapper)) {
|
216 |
margin-bottom: var(--size-2);
|
217 |
}
|
@@ -238,6 +271,7 @@
|
|
238 |
}
|
239 |
.waveform-container {
|
240 |
display: flex;
|
|
|
241 |
align-items: center;
|
242 |
justify-content: center;
|
243 |
width: var(--size-full);
|
|
|
156 |
class="component-wrapper"
|
157 |
data-testid={label ? "waveform-" + label : "unlabelled-audio"}
|
158 |
>
|
159 |
+
<div class="viewer">
|
160 |
+
<div class="source-selection">
|
161 |
+
{#if audioDecoded}
|
162 |
+
{#each [...Array(waveform.getDecodedData().numberOfChannels).keys()] as channelIdx}
|
163 |
+
<label class="source" style={`height: ${waveform_settings.height}px`}>
|
164 |
+
<input
|
165 |
+
type="radio"
|
166 |
+
name="channels"
|
167 |
+
value={`${channelIdx}`}
|
168 |
+
on:change={(ev) => {
|
169 |
+
splitter.disconnect()
|
170 |
+
splitter.connect(audioContext.destination, Number(ev.target.value), 0);
|
171 |
+
}}
|
172 |
+
/>
|
173 |
+
{channelIdx}
|
174 |
+
</label>
|
175 |
+
{/each}
|
176 |
+
{/if}
|
177 |
+
</div>
|
178 |
<div class="waveform-container">
|
179 |
<div id="waveform" bind:this={container} />
|
180 |
+
<div class="timestamps">
|
181 |
+
<time bind:this={timeRef} id="time">0:00</time>
|
182 |
+
<div>
|
183 |
+
{#if mode === "edit" && trimDuration > 0}
|
184 |
+
<time id="trim-duration">{format_time(trimDuration)}</time>
|
185 |
+
{/if}
|
186 |
+
<time bind:this={durationRef} id="duration">0:00</time>
|
187 |
+
</div>
|
|
|
188 |
</div>
|
189 |
</div>
|
190 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
{#if waveform}
|
193 |
<WaveformControls
|
|
|
209 |
{/if}
|
210 |
|
211 |
<style>
|
212 |
+
input[type="radio"] {
|
213 |
+
appearance: none;
|
214 |
+
background-color: #fff;
|
215 |
+
margin-right: 0.5em;
|
216 |
+
font: inherit;
|
217 |
+
color: var(--neutral-400);
|
218 |
+
width: 1.15em;
|
219 |
+
height: 1.15em;
|
220 |
+
border: 0.15em solid var(--neutral-400);
|
221 |
+
border-radius: 50%;
|
222 |
+
}
|
223 |
+
|
224 |
+
input[type="radio"]:checked {
|
225 |
+
background-color: var(--color-accent);
|
226 |
+
}
|
227 |
+
|
228 |
.component-wrapper {
|
229 |
padding: var(--size-3);
|
230 |
width: 100%;
|
231 |
}
|
232 |
|
233 |
+
.viewer {
|
234 |
+
display: flex;
|
235 |
+
}
|
236 |
+
|
237 |
+
.source-selection {
|
238 |
+
display: flex;
|
239 |
+
flex-direction: column;
|
240 |
+
margin-right: 1em;
|
241 |
+
}
|
242 |
+
|
243 |
+
.source {
|
244 |
+
display: flex;
|
245 |
+
align-items: center;
|
246 |
+
}
|
247 |
+
|
248 |
:global(::part(wrapper)) {
|
249 |
margin-bottom: var(--size-2);
|
250 |
}
|
|
|
271 |
}
|
272 |
.waveform-container {
|
273 |
display: flex;
|
274 |
+
flex-direction: column;
|
275 |
align-items: center;
|
276 |
justify-content: center;
|
277 |
width: var(--size-full);
|