jevstrudel.git / website / src / repl / components / panel / AudioEngineTargetSelector.jsx
AudioEngineTargetSelector.jsx29 lines · 1.0 KB · raw
1import React from 'react';
2import { audioEngineTargets } from '../../../settings.mjs';
3import { SelectInputDuplicate } from '@src/repl/components/panel/SettingsTab';
4
5// Allows the user to select an audio interface for Strudel to play through
6export function AudioEngineTargetSelector({ target, onChange, isDisabled }) {
7  const onTargetChange = (target) => {
8    onChange(target);
9  };
10  const options = new Map([
11    [audioEngineTargets.webaudio, audioEngineTargets.webaudio],
12    [audioEngineTargets.osc, audioEngineTargets.osc],
13  ]);
14  return (
15    <div className="flex flex-col gap-1">
16      <SelectInputDuplicate isDisabled={isDisabled} options={options} value={target} onChange={onTargetChange} />
17      {target === audioEngineTargets.osc && (
18        <div>
19          <p className="text-sm italic">
20            ⚠ All events routed to OSC, audio is silenced! See{' '}
21            <a className="text-blue-500" href="https://strudel.cc/learn/input-output/">
22              Docs
23            </a>
24          </p>
25        </div>
26      )}
27    </div>
28  );
29}