예제 #1
0
        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);
        }
예제 #2
0
    protected override void MFStart()
    {
        base.MFStart();

        Uti = this;

        DontDestroyOnLoad(gameObject);
    }
예제 #3
0
    protected override void MFOnDestroy()
    {
        base.MFOnDestroy();

        Clean();

        Uti = null;
    }
예제 #4
0
        public void NewBarcodeHandler(string barcode, int counts)
        {
            Logger.Info($"New barcode scan: barcode {barcode} - counts {counts}");

            SoundUtility.Play(SoundUtility.Sound.Success);

            ParseBarcodeCommandResponse(barcode, counts);
        }
예제 #5
0
    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;
            }
        }
예제 #7
0
        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);
        }
예제 #8
0
    /// <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;
    }
예제 #9
0
        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));
 }