private void NewSerialLine(string line) { Logger.Debug($"New line on serial port: {line}"); _lastBarcode = line; switch (_tokenStatus) { case TokenStatus.Waiting: _tokenStatus = TokenStatus.Counting; _tokenWatchdog.Start(); break; case TokenStatus.Counting: _tokenWatchdog.Ping(); break; default: return; } if (_tokenStatus != TokenStatus.Counting) { return; } if (_lastBarcodeDateTime.AddSeconds(Constants.SerialBarcodeDebounceTimeout) >= DateTime.Now) { return; } _lastBarcodeDateTime = DateTime.Now; _tokenCounts++; SoundUtility.Play(SoundUtility.Sound.Ping); }
protected override void MFStart() { base.MFStart(); Uti = this; DontDestroyOnLoad(gameObject); }
protected override void MFOnDestroy() { base.MFOnDestroy(); Clean(); Uti = null; }
public void NewBarcodeHandler(string barcode, int counts) { Logger.Info($"New barcode scan: barcode {barcode} - counts {counts}"); SoundUtility.Play(SoundUtility.Sound.Success); ParseBarcodeCommandResponse(barcode, counts); }
internal float GetPitch() { float pitch = SoundUtility.TransformPitch(PitchShift); if (RandomPitch != 0) { pitch *= SoundUtility.TransformPitch(UnityEngine.Random.Range(-RandomPitch, RandomPitch)); } return(pitch); }
private void FloatBytesToShortBytes(byte[] floatData, int floatIndex, byte[] shortData, int shortIndex, int sampleCount) { for (var i = 0; i < sampleCount; i++) { var floatValue = SoundUtility.ReadPcmFloat(floatData, floatIndex); floatIndex += 4; var shortValue = AudioBuffer.ShortFromFloat(floatValue); SoundUtility.WritePcmShort(shortValue, shortData, shortIndex); shortIndex += 2; } }
public List <string> GetSource(int bitDepth) { int originalSample = SoundUtility.PowerOfTwo(MaxValue); int downSample = originalSample - bitDepth; if (_formatter != null) { return(_formatter.GetSource(_slopeDurations, downSample)); } return(null); }
/// <summary> /// 読み込み /// </summary> public static void Load() { var load = Resources.LoadAll <AudioClip>(SoundUtility.GetPath(SoundType.BGM)); bgms = new Dictionary <string, AudioClip>(); foreach (var b in load) { bgms.Add(b.name, b); } load = Resources.LoadAll <AudioClip>(SoundUtility.GetPath(SoundType.SE)); ses = new Dictionary <string, AudioClip>(); foreach (AudioClip s in load) { ses.Add(s.name, s); } isLoad = true; }
private void ApplyFootsteps(BetterFootstepsComponent footsteps) { footsteps.FootstepSoundBuilding.AddAudioClips(SoundUtility.TryImportAudioClips("sfx_footstep_wood", "wav", 4, false)); footsteps.FootstepSoundBuilding.SetPitchRange(0.8f, 1.2f); footsteps.FootstepSoundDungeon.AddAudioClips(SoundUtility.TryImportAudioClips("sfx_footstep_stone", "wav", 4, false)); footsteps.FootstepSoundDungeon.SetPitchRange(0.8f, 1.2f); footsteps.FootstepsArmor.AddAudioClips(SoundUtility.TryImportAudioClips("sfx_footstep_armor_light", "wav", 11, false)); footsteps.FootstepsArmor.SetPitchRange(1f, 1.2f); footsteps.FootstepSoundOutside.AddAudioClips(SoundUtility.TryImportAudioClips("sfx_footstep_crunchy-grass", "wav", 4, false)); footsteps.FootstepSoundOutside.SetPitchRange(0.8f, 1.2f); footsteps.FootstepSoundShallow.AddAudioClips(SoundUtility.TryImportAudioClips("sfx_footstep_water", "wav", 6, false)); footsteps.FootstepSoundShallow.SetPitchRange(0.8f, 1.2f); footsteps.FootstepSoundSubmerged.AddSoundClip(SoundClips.SplashSmall); footsteps.FootstepSoundSubmerged.SetPitchRange(0.8f, 1.2f); footsteps.FootstepSoundSnow.AddSoundClip(SoundClips.PlayerFootstepSnow1); footsteps.FootstepSoundSnow.AddSoundClip(SoundClips.PlayerFootstepSnow2); footsteps.FootstepSoundSnow.SetPitchRange(0.8f, 1.2f); }
protected virtual int ReadFrameHeader() { return(SoundUtility.CalculateDataLength(FrameDuration, Config)); }