Example #1
0
        private void ScaleReact(ILineModel line)
        {
            if (!line.ScaleProperty.IsScaleReactOnAudio)
            {
                return;
            }
            float value;

            switch (line.EmissionProperty.EmissionFrequencyType)
            {
            case AudioFrequencyType.Band:
                value = AudioPeerService.GetAudioBand(line.ScaleProperty.ScaleBandBuffer);
                break;

            case AudioFrequencyType.BandBuffer:
                value = AudioPeerService.GetAudioBandBuffer(line.ScaleProperty.ScaleBandBuffer);
                break;

            case AudioFrequencyType.Amplitude:
                value = AudioPeerService.GetAmplitude();
                break;

            case AudioFrequencyType.AmplitudeBuffer:
                value = AudioPeerService.GetAmplitudeBuffer();
                break;

            case AudioFrequencyType.Frequency:
                value = AudioPeerService.GetFrequencyBand(line.ScaleProperty.ScaleBandBuffer);
                break;

            case AudioFrequencyType.FrequencyBuffer:
                value = AudioPeerService.GetFrequencyBandBuffer(line.ScaleProperty.ScaleBandBuffer);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (value > line.ScaleProperty.ScaleThreshold)
            {
                line.LineGameObject.widthMultiplier = value * line.ScaleProperty.ScaleMultiplier;
            }
            else
            {
                line.LineGameObject.widthMultiplier = 1;
            }
        }
Example #2
0
        private void EmissionReact(ILineModel line)
        {
            if (!line.EmissionProperty.IsEmissionReactOnAudio || !line.IsEmissionEnabled)
            {
                return;
            }
            float value;

            switch (line.EmissionProperty.EmissionFrequencyType)
            {
            case AudioFrequencyType.Band:
                value = AudioPeerService.GetAudioBand(line.EmissionProperty.EmissionBandBuffer);
                break;

            case AudioFrequencyType.BandBuffer:
                value = AudioPeerService.GetAudioBandBuffer(line.EmissionProperty.EmissionBandBuffer);
                break;

            case AudioFrequencyType.Amplitude:
                value = AudioPeerService.GetAmplitude();
                break;

            case AudioFrequencyType.AmplitudeBuffer:
                value = AudioPeerService.GetAmplitudeBuffer();
                break;

            case AudioFrequencyType.Frequency:
                value = AudioPeerService.GetFrequencyBand(line.EmissionProperty.EmissionBandBuffer);
                break;

            case AudioFrequencyType.FrequencyBuffer:
                value = AudioPeerService.GetFrequencyBandBuffer(line.EmissionProperty.EmissionBandBuffer);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            if (value > line.EmissionProperty.EmissionThreshold)
            {
                line.LineGameObject.sharedMaterial.SetColor("_EmissionColor", line.EmissionIntensity * line.EmissionColor * value);
            }
            else
            {
                line.LineGameObject.sharedMaterial.SetColor("_EmissionColor", Color.black);
            }
        }
Example #3
0
 private void HandleRotation()
 {
     if (_isRotationEnabled && !_isDrawMode && AudioPeerService.HasClip())
     {
         _rotateTransform.Rotate(_rotateAxis.x * _rotateSpeed.x * Time.deltaTime * AudioPeerService.GetAmplitudeBuffer(),
                                 _rotateAxis.y * _rotateSpeed.y * Time.deltaTime * AudioPeerService.GetAmplitudeBuffer(),
                                 _rotateAxis.z * _rotateSpeed.z * Time.deltaTime * AudioPeerService.GetAmplitudeBuffer());
     }
 }