public static async Task <ISampleProvider> PlaySound(this MixingSampleProvider mixer, string path, SampleControl sampleControl) { var sound = await CachedSound.GetOrCreateCacheSound(path).ConfigureAwait(false); PlaySound(mixer, sound, sampleControl, out var rootSample); return(rootSample); }
private static void PlaySound(MixingSampleProvider mixer, CachedSound sound, SampleControl sampleControl, out ISampleProvider rootSample) { if (sound == null) { rootSample = default; return; } mixer.AddMixerInput(new CachedSoundSampleProvider(sound), sampleControl, out rootSample); }
public static void AddMixerInput(this MixingSampleProvider mixer, ISampleProvider input, SampleControl sampleControl, out ISampleProvider rootSample) { var adjustVolume = input.AddToAdjustVolume(sampleControl.Volume); var adjustBalance = adjustVolume.AddToBalanceProvider(sampleControl.Balance); sampleControl.VolumeChanged = f => adjustVolume.Volume = f; sampleControl.BalanceChanged = f => adjustBalance.Balance = f; rootSample = adjustBalance; mixer.AddMixerInput(adjustBalance); }
internal static ISampleProvider PlaySound(this MixingSampleProvider mixer, CachedSound sound, SampleControl sampleControl) { PlaySound(mixer, sound, sampleControl, out var rootSample); return(rootSample); }