public void Apply(PureDataSource source, float delay) { switch (type) { case PureDataOption.OptionTypes.Volume: source.SetVolume(GetValue <float>(), 0, delay); break; case PureDataOption.OptionTypes.Pitch: source.SetPitch(GetValue <float>(), 0, delay); break; case PureDataOption.OptionTypes.RandomVolume: float randomVolume = GetValue <float>(); source.SetVolume(source.Info.volume + source.Info.volume * HelperFunctions.RandomRange(-randomVolume, randomVolume), 0, delay); break; case PureDataOption.OptionTypes.RandomPitch: float randomPitch = GetValue <float>(); source.SetPitch(source.Info.pitch + source.Info.pitch * HelperFunctions.RandomRange(-randomPitch, randomPitch), 0, delay); break; case PureDataOption.OptionTypes.FadeIn: source.SetFadeIn(GetValue <float>()); break; case PureDataOption.OptionTypes.FadeOut: source.SetFadeOut(GetValue <float>()); break; case PureDataOption.OptionTypes.Loop: source.SetLoop(GetValue <bool>(), delay); break; case PureDataOption.OptionTypes.Clip: source.SetClip(source.pureData.clipManager.GetClip(GetValue <AudioClip>().name)); break; case PureDataOption.OptionTypes.Output: source.SetOutput(GetValue <string>(), delay); break; case PureDataOption.OptionTypes.PlayRange: Vector2 playRange = GetValue <Vector2>(); source.SetPlayRange(playRange.x, playRange.y, delay, true); break; case PureDataOption.OptionTypes.Time: source.SetPhase(GetValue <float>(), delay); break; case PureDataOption.OptionTypes.DopplerLevel: source.DopplerLevel = GetValue <float>(); break; case PureDataOption.OptionTypes.VolumeRolloffMode: source.VolumeRolloffMode = GetValue <PureDataVolumeRolloffModes>(); break; case PureDataOption.OptionTypes.MinDistance: source.MinDistance = GetValue <float>(); break; case PureDataOption.OptionTypes.MaxDistance: source.MaxDistance = GetValue <float>(); break; case PureDataOption.OptionTypes.PanLevel: source.PanLevel = GetValue <float>(); break; } }
public void Apply(PureDataSource source) { switch (type) { case PureDataOption.OptionTypes.Volume: float[] volumeData = GetValue <float[]>(); source.SetVolume(volumeData[0], volumeData[1], delay); break; case PureDataOption.OptionTypes.Pitch: float[] pitchData = GetValue <float[]>(); source.SetPitch(pitchData[0], pitchData[1], delay); break; case PureDataOption.OptionTypes.RandomVolume: float randomVolume = GetValue <float>(); source.SetVolume(source.Info.volume + source.Info.volume * HelperFunctions.RandomRange(-randomVolume, randomVolume), 0, delay); break; case PureDataOption.OptionTypes.RandomPitch: float randomPitch = GetValue <float>(); source.SetPitch(source.Info.pitch + source.Info.pitch * HelperFunctions.RandomRange(-randomPitch, randomPitch), 0, delay); break; case PureDataOption.OptionTypes.FadeIn: source.SetFadeIn(GetValue <float>()); break; case PureDataOption.OptionTypes.FadeOut: source.SetFadeOut(GetValue <float>()); break; case PureDataOption.OptionTypes.Loop: source.SetLoop(GetValue <bool>()); break; case PureDataOption.OptionTypes.Clip: source.SetClip(source.pureData.clipManager.GetClip(GetValue <string>())); break; case PureDataOption.OptionTypes.Output: source.SetOutput(GetValue <string>(), delay); break; case PureDataOption.OptionTypes.PlayRange: float[] playRangeData = GetValue <float[]>(); source.SetPlayRange(playRangeData[0], playRangeData[1], delay, true); break; case PureDataOption.OptionTypes.Time: source.SetPhase(GetValue <float>(), delay); break; case PureDataOption.OptionTypes.DopplerLevel: source.spatializer.DopplerLevel = GetValue <float>(); break; case PureDataOption.OptionTypes.VolumeRolloffMode: source.spatializer.VolumeRolloffMode = (PureDataVolumeRolloffModes)GetValue <float>(); break; case PureDataOption.OptionTypes.MinDistance: source.spatializer.MinDistance = GetValue <float>(); break; case PureDataOption.OptionTypes.MaxDistance: source.spatializer.MaxDistance = GetValue <float>(); break; case PureDataOption.OptionTypes.PanLevel: source.spatializer.PanLevel = GetValue <float>(); break; default: Logger.LogError(string.Format("{0} can not be applied to {1}.", this, source.GetType())); break; } }