-
Notifications
You must be signed in to change notification settings - Fork 0
Audio
Now every app initialization, if no CreateAudioManager() override is provided, it will initialize with BASS as the default audio manager. If you want to disable audio completely, you can override the CreateAudioManager() method and return a HeadlessAudioManager instance.
public class NoSoundApp : App {
protected override IAudioManager CreateAudioManager() => new HeadlessAudioManager();
}Sakura support buit-in audio filters that can be applied to the audio output. These filters can be used to create various audio effects, such as reverb, echo, distortion, and more. You can add these filters to the audio mixer to apply them to all audio tracks or to specific tracks.
A low-pass filter is an effect that will cut off frequencies above a certain threshold to create a muffled sound.
var muffleEffect = AudioManager.TrackMixer.AddLowPassFilter();
muffleEffect.CutoffFrequency.Value = 1000.0;
Scheduler.AddDelayed(() =>
{
muffleEffect.Reset();
}, 5000)Ducking is a common audio effect that will lower the volume of one audio source when another audio source is playing. Since this effect required the clock so it need to add to the draw heirarchy.
public class YourAwesomeApp : App {
private override void Load() {
Add(new AudioDucker(AudioManager.SampleMixer, AudioManager.TrackMixer, AudioManager.TrackVolume)
{
Threshold = 0.05f, // Triggers easily on quiet clicks
DuckMultiplier = 0.05, // Drops music to 5%
RecoverySpeed = 0.02f // Slow fade back up
});
}
}