public sealed class AudioBusA place voices sum into, on their way to the master.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The reason a game has a music slider. Every voice names a bus, every bus names a parent, and the tree is summed from the leaves up — so Music.Gain = 0.2f is one write that reaches every track playing and every track that will play, and an effect on a bus is computed once for everything routed into it.
Gain and mute are written directly from the game thread and read from the audio thread, with no command and no lock. Both are single values the CLR guarantees are written atomically — a Single and a Boolean — so the worst a race can do is apply a new gain one block later than it was set. Buying atomicity for that with a queue would make a volume slider feel worse, not better.
The effect chain is a snapshot, swapped whole. Adding an effect builds a new array and publishes it with one write; the audio thread reads the reference once per block and works from what it got. So the chain is never observed half-modified, and neither side waits for the other.
Fields and properties (13)
public int IndexIts index, which is what Bus holds. The master is zero.
public string NameWhat it is called.
public AudioBus? ParentWhat it sums into, or for the master.
public int DepthHow far it is from the master. The master is zero.
public IReadOnlyList<AudioBus> ChildrenBuses that sum into this one.
public float GainIts linear gain.
public bool MutedWhether it contributes nothing to its parent.
public float ParameterGainWhat parameter automation last worked out for this bus, as a linear gain.
public IReadOnlyList<IAudioEffect> EffectsThe effects on it, in the order they run.
public float PeakLevelThe loudest sample this bus produced in the last block, after its effects and its gain.
public bool IsFadingWhether a fade is running on this bus.
public AudioBus? SidechainSourceWhich bus keys this one's sidechained effects, if any.
public IReadOnlyList<AudioSend> SendsThe sends off this bus.
Methods (8)
public void FadeTo(float gain, TimeSpan duration, AudioFadeCurve curve = Decibel)Takes this bus's gain somewhere else over time.
public void CancelFade()Stops a fade where it is, leaving the gain at whatever it had reached.
public void AddEffect(IAudioEffect effect)Adds an effect to the end of the chain.
public bool RemoveEffect(IAudioEffect effect)Takes an effect off the chain.
public void ResetEffects()Clears every effect's memory of what came before.
public AudioSend AddSend(AudioBus target, float level = 1, bool preFader = false)Sends a copy of this bus's signal to another one.
public bool RemoveSend(AudioSend send)Takes a send off.
public void SetSidechain(AudioBus? source)Makes another bus's signal available to this bus's keyed effects.
Used by (30)
- PeerVoiceChat
- AudioEffectTestsVixen.Audio.Tests
- AudioEngineVixen.Audio
- AudioEventAssetTestsVixen.Audio.Tests
- AudioEventBuilderVixen.Audio
- AudioMixerVixen.Audio
- AudioMixerTestsVixen.Audio.Tests
- AudioRoutingTestsVixen.Audio.Tests
- AudioSendVixen.Audio
- BindingVixen.Audio
- BuiltinParameterTestsVixen.Audio.Tests
- BusTargetVixen.Audio
- CaptureTestsVixen.Audio.Tests
- ConvolutionTestsVixen.Audio.Tests
- DynamicsTestsVixen.Audio.Tests
- FadeTestsVixen.Audio.Tests
- LayeredEventTestsVixen.Audio.Tests
- MixControlVixen.Audio
- MixControlServerTestsVixen.Audio.Tests
- MixControlTestsVixen.Audio.Tests
- MixerAssetTestsVixen.Audio.Tests
- MixerBuilderVixen.Audio
- MixerParameterTestsVixen.Audio.Tests
- MixerParametersVixen.Audio
- MixerSnapshotsVixen.Audio
- MusicBuilderVixen.Audio
- MusicPlayerTestsVixen.Audio.Tests
- PerVoiceSendTestsVixen.Audio.Tests
- SpectrumAnalyzerTestsVixen.Audio.Tests
- VoiceParameterTestsVixen.Audio.Tests