react-native-audio-api
Version:
react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification
21 lines (17 loc) • 755 B
text/typescript
import AudioAPIModule from '../AudioAPIModule';
export function assertWorkletsEnabled() {
if (!AudioAPIModule.areWorkletsAvailable) {
throw new Error(
'[react-native-audio-api]: Worklets are not available. Please install react-native-worklets to use this feature.'
);
}
if (!AudioAPIModule.isWorkletsVersionSupported) {
throw new Error(
`[react-native-audio-api]: Worklets version ${AudioAPIModule.workletsVersion} is not supported.
Please install react-native-worklets of one of the following versions: [${AudioAPIModule.supportedWorkletsVersion.join(', ')}] to use this feature.`
);
}
}
export function clamp(value: number, min: number, max: number): number {
return Math.min(Math.max(value, min), max);
}