You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This worksthis.sounds.bgMusic.components.set('audio',{state: 'play'})// This doesn't work, but I wish it did :Dthis.sounds.bgMusic.components.set('audio',{state: 'play',volume: 0.3});
The text was updated successfully, but these errors were encountered:
we just dont handle that atm, that's something definitely we can add :D
adding note below for the threejs setup for it - would just need to add an adjustment to the AudioSystem to incorporate that:
// To increase the volume
function increaseVolume() {
if (audio.getVolume() < 1.0) {
audio.setVolume(audio.getVolume() + 0.1); // Increase volume by 0.1
}
}
// To decrease the volume
function decreaseVolume() {
if (audio.getVolume() > 0.0) {
audio.setVolume(audio.getVolume() - 0.1); // Decrease volume by 0.1
}
}
where audio is something previously setup like:
// Assuming audio is your THREE.Audio object
let audio = new THREE.Audio(listener);
// Set the audio source
let audioLoader = new THREE.AudioLoader();
audioLoader.load('path/to/audio.mp3', function(buffer) {
audio.setBuffer(buffer);
audio.setLoop(true);
audio.setVolume(0.5); // Set initial volume here
audio.play();
});
I'm trying to change the volume of an audio element, but I can't figure out how.
The documentation is limited on audio (should we have a page for it?)
https://docs.mrjs.io/js-api/audiosystem/#audiosystemsetaudiostateentity-state
I tried this, but it didn't work:
The text was updated successfully, but these errors were encountered: