public void PlayVibration() { vibrationValue.Clear(); curFile = rumblePresets[iterator].bytes; Result result; result = VibrationFile.Parse(ref curFileInfo, ref curFileContext, curFile, curFile.Length); Debug.Assert(result.IsSuccess()); sampleA = 0; vibrationTimer = (curFileInfo.sampleLength - 1) / samplesPerSec; }
public void PlayVibrationPreset(string presetName, float intensityMultiplier) { if (intensityMultiplier == 0f) { intensityMultiplier = 1f; } intensityOverallMultiplier = intensityMultiplier; int toUse = -1; for (int it = 0; (it < rumblePresets.Length && toUse == -1); it++) { if (rumblePresets[it].name == presetName) { toUse = it; } } if (toUse != -1) { vibrationValue.Clear(); curFile = rumblePresets[toUse].bytes; Result result; result = VibrationFile.Parse(ref curFileInfo, ref curFileContext, curFile, curFile.Length); Debug.Assert(result.IsSuccess()); sampleA = 0; } vibrationTimer = (curFileInfo.sampleLength - 1) / samplesPerSec; if (displayDebugLogs) { if (toUse != -1) { Debug.Log("PLAYING: " + rumblePresets[toUse].name); } else { Debug.Log("Preset: " + presetName + "... was not found!"); } } }