[Ask] Mixer on outside JSAM Audio Source
JSAM Version: 3.0.0 preview 6 Unity: 2021.3.21f1
How do we make sure the mixer works for a audio source not managed by JSAM?
It seems the mixer doesn't really used or functioned?
For my case I currently call Start/Awake/OnEnable, then call my source.volume = AudioManager.SoundVolume
There is currently no easy way to make JSAM's Audio Manager manage your own Audio Source. I'll be working on adding a solution for this in the next update.
I apologize for the long wait, but if if you still need help on this issue, what you can do is create a script that hooks onto the AudioManager's volume change events and changes an AudioSource's volume level automatically. Something like the below.
public class ManagedSource : MonoBehaviour
{
public float relativeVolume;
public AudioSource source;
private void Start()
{
AudioManager.OnSoundVolumeChanged += UpdateVolume;
}
private void OnDestroy()
{
AudioManager.OnSoundVolumeChanged -= UpdateVolume;
}
void UpdateVolume(float v)
{
source.volume = relativeVolume * v * AudioManager.MasterVolume;
}
}