AudioEffectState and DeviceState modules from the AtomicXCore framework to quickly add audio effect controls to your live streaming application. You’ll learn how to manage microphone volume, enable ear monitoring, and apply fun voice changer and reverb effects.
AudioEffectState and DeviceState, you can implement the following core features:AudioEffectState and DeviceState are singleton objects. You can access their instances from anywhere in your project.import { useAudioEffectState } from 'react-native-tuikit-atomic-x/lib/module/atomic-x/state/AudioEffectState';import { useDeviceState } from 'react-native-tuikit-atomic-x/lib/module/atomic-x/state/DeviceState';// Get state instancesconst audioEffect = useAudioEffectState();const deviceState = useDeviceState();
setVoiceEarMonitorVolume.import { useEffect } from 'react';import { useAudioEffectState } from 'react-native-tuikit-atomic-x/lib/module/atomic-x/state/AudioEffectState';// Access state instanceconst { setVoiceEarMonitorEnable, setVoiceEarMonitorVolume, earMonitorVolume } = useAudioEffectState();// 1. Toggle ear monitoringconst handleSetVoiceEarMonitorEnable = (enable) => {setVoiceEarMonitorEnable({ enable });};// 2. Adjust ear monitoring volumeconst handleSetVoiceEarMonitorVolume = (volume) => {setVoiceEarMonitorVolume({ volume });};// 3. Listen for volume changesuseEffect(() => {console.log('Ear monitoring volume:', earMonitorVolume);}, [earMonitorVolume]);
Parameter Name | Type | Description |
enable | boolean | Enable ear monitoring. true: Enable false: Disable |
Parameter Name | Type | Description |
volume | number | Ear monitoring volume. Range: [0, 100] Default: 100 |
setCaptureVolume method from DeviceState with the desired value.[0, 100] range, and call setCaptureVolume.import { useEffect } from 'react';import { useDeviceState } from 'react-native-tuikit-atomic-x/lib/module/atomic-x/state/DeviceState';// Access state instanceconst { setCaptureVolume, captureVolume } = useDeviceState();// 1. Adjust capturing volumeconst handleSetCaptureVolume = (volume) => {setCaptureVolume({ volume });};// 2. Listen for volume changesuseEffect(() => {console.log('Capturing volume:', captureVolume);}, [captureVolume]);
Parameter Name | Type | Description |
volume | number | Capturing volume. Range: [0, 100] Default: 100 |
setAudioChangerType and pass the desired enum value.import { useAudioEffectState } from 'react-native-tuikit-atomic-x/lib/module/atomic-x/state/AudioEffectState';// Access state instanceconst { setAudioChangerType } = useAudioEffectState();// Set voice changer effectconst handleSetAudioChangerType = (changerType) => {setAudioChangerType({ changerType });};
Parameter Name | Type | Description |
changerType | string | Voice changer effect, available options: NONE: Disable voice changer.CHILD: Mischievous kid, lively tone.LITTLE_GIRL: Child, sweet and crisp.MAN: Deep male, powerful tone.HEAVY_METAL: Heavy metal, metallic, rugged.COLD: Nasal, cold-like tone.FOREIGNER: Foreign accent.TRAPPED_BEAST: Deep, roaring tone.FATSO: Thick, humorous, full-bodied.STRONG_CURRENT: Sci-fi, electric interference.HEAVY_MACHINERY: Mechanical echo, industrial style.ETHEREAL: Airy, transparent, fairy-like. |
setAudioReverbType with the desired enum value.import { useAudioEffectState } from 'react-native-tuikit-atomic-x/lib/module/atomic-x/state/AudioEffectState';// Access state instanceconst { setAudioReverbType } = useAudioEffectState;// Set reverb effectconst handleSetAudioReverbType = (reverbType) => {setAudioReverbType({ reverbType });};
Parameter Name | Type | Description |
reverbType | string | Reverb effect, available options: NONE: Disable reverb.KTV: Simulates KTV private room, moderate echo, suited for singing.SMALL_ROOM: Compact spatial feel.AUDITORIUM: Wide echo, strong spatial presence.DEEP: Low-frequency, deep sound.LOUD: Increases loudness, fuller sound.METALLIC: Crisp, metallic reverb.MAGNETIC: Soft, warm, magnetic tone. |
State | Feature Description | API Documentation |
AudioEffectState | Manage audio effects: configure effects and get real-time status. | |
DeviceState | Manage devices: operate camera and microphone, get real-time status. |
AudioEffectState and DeviceState are global. You can call these interfaces (such as setting voice changer, reverb, or ear monitoring) at any time—before or after entering the live room. Changes take effect immediately and persist.setCaptureVolume. This is what your audience hears.setVoiceEarMonitorVolume. This only affects your own monitoring headphones and does not impact audience volume.AudioEffectState and DeviceState are singletons, their settings apply globally. If you see unexpected effects or volumes, it’s likely due to previous settings that were not reset. Make sure to reset these values when appropriate.DeviceState is enabled (call openLocalMicrophone).AudioChangerType and AudioReverbType at the same time. For example, you can use the 'LITTLE_GIRL' voice changer together with the 'KTV' reverb.Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários