This commit is contained in:
Jade Rowland 2023-12-08 12:17:01 -05:00
parent 89fe0f11ae
commit ec44103d20
2 changed files with 3 additions and 1 deletions

View File

@ -82,7 +82,7 @@ let delays = {};
const maxfeedback = 0.98;
let channelMerger, destinationGain;
//update the output channel configuration to match user's audio device
export function initializeAudioOutput() {
const audioContext = getAudioContext();
const maxChannelCount = audioContext.destination.maxChannelCount;

View File

@ -3,6 +3,7 @@ import { getAudioContext, initializeAudioOutput } from '@strudel.cycles/webaudio
import { SelectInput } from './SelectInput';
const initdevices = new Map();
// Allows the user to select an audio interface for Strudel to play through
export function AudioDeviceSelector({ audioDeviceName, onChange }) {
const [devices, setDevices] = useState(initdevices);
const devicesInitialized = devices.size > 0;
@ -24,6 +25,7 @@ export function AudioDeviceSelector({ audioDeviceName, onChange }) {
return devicesMap;
}, []);
// on first load, check if there is a cached audio device name in settings and initialize it
useEffect(() => {
if (!audioDeviceName.length || devicesInitialized) {
return;