private float[] ProcessNode()
        {
            SoundClip clip = SynthGraphEditorState.ActiveClip;

            // Calculate clip output
            float[] buffer = new float[ clip.SampleLength ];
            SoundClipState state = new SoundClipState();

            state.m_sampleRate   = clip.SampleRate;
            state.m_sampleLength = clip.SampleLength;
            state.m_index		 = 0;

            for ( int i = 0; i < buffer.Length; i++, state.m_index++ )
            {
                buffer[ i ] = m_rootNode.Process( state );
            }

            return buffer;
        }
Пример #2
0
    private void PlaySoundClip(SoundClipState scs)
    {
        soundClipState = scs;

        switch (soundClipState)
        {
            case SoundClipState.Opening:
                if (openSound != null)
                    AudioSource.PlayClipAtPoint(openSound, transform.position, 1);
                break;
            case SoundClipState.Opened:
                if (fullyOpenedSound != null)
                    AudioSource.PlayClipAtPoint(fullyOpenedSound, transform.position);
                break;
            case SoundClipState.Closing:
                if (closeSound != null)
                    AudioSource.PlayClipAtPoint(closeSound, transform.position);
                break;
            case SoundClipState.Closed:
                if (fullyClosedSound != null)
                    AudioSource.PlayClipAtPoint(fullyClosedSound, transform.position);
                break;
        }
    }