import React from "react"; import PropTypes from "prop-types"; import InputGroup from "../inputs/InputGroup"; import BooleanInput from "../inputs/BooleanInput"; import SelectInput from "../inputs/SelectInput"; import NumericInputGroup from "../inputs/NumericInputGroup"; import CompoundNumericInput from "../inputs/CompoundNumericInput"; import { AudioType, AudioTypeOptions, DistanceModelOptions, DistanceModelType } from "@xr3ngine/engine/src/scene/classes/AudioSource"; import useSetPropertySelected from "./useSetPropertySelected"; import { useTranslation } from "react-i18next"; /** * * AudioSourceProperties provides properties to custom audio element on the scene * used inside AudioNodeEditor component. * * @author Robert Long * @param {any} node * @param {any} editor * @param {any} multiEdit * @constructor */ export function AudioSourceProperties({ node, editor, multiEdit }) { const onChangeControls = useSetPropertySelected(editor, "controls"); const onChangeAutoPlay = useSetPropertySelected(editor, "autoPlay"); const onChangeLoop = useSetPropertySelected(editor, "loop"); const onChangeAudioType = useSetPropertySelected(editor, "audioType"); const onChangeVolume = useSetPropertySelected(editor, "volume"); const onChangeDistanceModel = useSetPropertySelected(editor, "distanceModel"); const onChangeRolloffFactor = useSetPropertySelected(editor, "rolloffFactor"); const onChangeRefDistance = useSetPropertySelected(editor, "refDistance"); const onChangeMaxDistance = useSetPropertySelected(editor, "maxDistance"); const onChangeConeInnerAngle = useSetPropertySelected(editor, "coneInnerAngle"); const onChangeConeOuterAngle = useSetPropertySelected(editor, "coneOuterAngle"); const onChangeConeOuterGain = useSetPropertySelected(editor, "coneOuterGain"); const { t } = useTranslation(); // TODO: Make node audio settings work with multi-edit // returning view containing inputs to customize audio element return ( <> { /* @ts-ignore */ } { /* @ts-ignore */ } { /* @ts-ignore */ } { /* @ts-ignore */ } { /* @ts-ignore */ } { /* @ts-ignore */ } {!multiEdit && node.audioType === AudioType.PannerNode && ( <> { /* @ts-ignore */ } { /* @ts-ignore */ } {node.distanceModel === DistanceModelType.Linear ? ( /* @ts-ignore */ ) : ( /* @ts-ignore */ )} { /* @ts-ignore */ } { /* @ts-ignore */ } { /* @ts-ignore */ } { /* @ts-ignore */ } { /* @ts-ignore */ } )} ); } AudioSourceProperties.propTypes = { node: PropTypes.object, editor: PropTypes.object, multiEdit: PropTypes.bool }; export default AudioSourceProperties;