GetWaveForm() private method

private GetWaveForm ( AudioClip clip, AssetImporter importer, int channel, float width, float height ) : Texture2D
clip UnityEngine.AudioClip
importer AssetImporter
channel int
width float
height float
return UnityEngine.Texture2D
        public override Texture2D RenderStaticPreview(string assetPath, UnityEngine.Object[] subAssets, int width, int height)
        {
            AssetImporter atPath = AssetImporter.GetAtPath(assetPath);
            AudioImporter exists = atPath as AudioImporter;

            if (!exists)
            {
                return(null);
            }
            AudioClip audioClip = this.target as AudioClip;

            Texture2D[] array = new Texture2D[audioClip.channels];
            for (int i = 0; i < audioClip.channels; i++)
            {
                array[i] = AudioUtil.GetWaveForm(audioClip, atPath, i, (float)width, (float)(height / audioClip.channels));
            }
            return(AudioClipInspector.CombineWaveForms(array));
        }
示例#2
0
        public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height)
        {
            AssetImporter atPath    = AssetImporter.GetAtPath(assetPath);
            AudioImporter importer2 = atPath as AudioImporter;

            if (importer2 == null)
            {
                return(null);
            }
            AudioClip target = this.target as AudioClip;

            Texture2D[] waveForms = new Texture2D[target.channels];
            for (int i = 0; i < target.channels; i++)
            {
                waveForms[i] = AudioUtil.GetWaveForm(target, atPath, i, (float)width, (float)(height / target.channels));
            }
            return(CombineWaveForms(waveForms));
        }