GetDuration() private method

private GetDuration ( AudioClip clip ) : double
clip UnityEngine.AudioClip
return double
Beispiel #1
0
        public override string GetInfoString()
        {
            AudioClip clip = target as AudioClip;
            int       c    = AudioUtil.GetChannelCount(clip);
            string    ch   = c == 1 ? "Mono" : c == 2 ? "Stereo" : (c - 1).ToString() + ".1";
            AudioCompressionFormat platformFormat = AudioUtil.GetTargetPlatformSoundCompressionFormat(clip);
            AudioCompressionFormat editorFormat   = AudioUtil.GetSoundCompressionFormat(clip);
            string s = platformFormat.ToString();

            if (platformFormat != editorFormat)
            {
                s += " (" + editorFormat.ToString() + " in editor" + ")";
            }
            s += ", " + AudioUtil.GetFrequency(clip) + " Hz, " + ch + ", ";

            System.TimeSpan ts = new System.TimeSpan(0, 0, 0, 0, (int)AudioUtil.GetDuration(clip));

            if ((uint)AudioUtil.GetDuration(clip) == 0xffffffff)
            {
                s += "Unlimited";
            }
            else
            {
                s += string.Format("{0:00}:{1:00}.{2:000}", ts.Minutes, ts.Seconds, ts.Milliseconds);
            }

            return(s);
        }
        public override string GetInfoString()
        {
            AudioClip target       = this.target as AudioClip;
            int       channelCount = AudioUtil.GetChannelCount(target);
            string    str1;

            switch (channelCount)
            {
            case 1:
                str1 = "Mono";
                break;

            case 2:
                str1 = "Stereo";
                break;

            default:
                str1 = (channelCount - 1).ToString() + ".1";
                break;
            }
            string str2 = str1;
            AudioCompressionFormat compressionFormat1 = AudioUtil.GetTargetPlatformSoundCompressionFormat(target);
            AudioCompressionFormat compressionFormat2 = AudioUtil.GetSoundCompressionFormat(target);
            string str3 = compressionFormat1.ToString();

            if (compressionFormat1 != compressionFormat2)
            {
                str3 = str3 + " (" + compressionFormat2.ToString() + " in editor)";
            }
            string   str4     = str3 + ", " + (object)AudioUtil.GetFrequency(target) + " Hz, " + str2 + ", ";
            TimeSpan timeSpan = new TimeSpan(0, 0, 0, 0, (int)AudioUtil.GetDuration(target));

            return((int)(uint)AudioUtil.GetDuration(target) != -1 ? str4 + string.Format("{0:00}:{1:00}.{2:000}", (object)timeSpan.Minutes, (object)timeSpan.Seconds, (object)timeSpan.Milliseconds) : str4 + "Unlimited");
        }
        public override string GetInfoString()
        {
            AudioClip clip         = this.target as AudioClip;
            int       channelCount = AudioUtil.GetChannelCount(clip);
            string    text         = (channelCount != 1) ? ((channelCount != 2) ? ((channelCount - 1).ToString() + ".1") : "Stereo") : "Mono";
            string    str          = string.Concat(new object[]
            {
                AudioUtil.GetSoundCompressionFormat(clip).ToString(),
                ", ",
                AudioUtil.GetFrequency(clip),
                " Hz, ",
                text,
                ", "
            });
            TimeSpan timeSpan = new TimeSpan(0, 0, 0, 0, (int)AudioUtil.GetDuration(clip));

            if ((uint)AudioUtil.GetDuration(clip) == 4294967295u)
            {
                str += "Unlimited";
            }
            else
            {
                str += string.Format("{0:00}:{1:00}.{2:000}", timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds);
            }
            str += ", ";
            return(str + EditorUtility.FormatBytes(AudioUtil.GetSoundSize(clip)));
        }
Beispiel #4
0
        public override string GetInfoString()
        {
            AudioClip target       = this.target as AudioClip;
            int       channelCount = AudioUtil.GetChannelCount(target);
            string    str          = (channelCount != 1) ? ((channelCount != 2) ? (((channelCount - 1)).ToString() + ".1") : "Stereo") : "Mono";
            AudioCompressionFormat targetPlatformSoundCompressionFormat = AudioUtil.GetTargetPlatformSoundCompressionFormat(target);
            AudioCompressionFormat soundCompressionFormat = AudioUtil.GetSoundCompressionFormat(target);
            string str2 = targetPlatformSoundCompressionFormat.ToString();

            if (targetPlatformSoundCompressionFormat != soundCompressionFormat)
            {
                str2 = str2 + " (" + soundCompressionFormat.ToString() + " in editor)";
            }
            string str3 = str2;

            object[] objArray1 = new object[] { str3, ", ", AudioUtil.GetFrequency(target), " Hz, ", str, ", " };
            str2 = string.Concat(objArray1);
            TimeSpan span = new TimeSpan(0, 0, 0, 0, (int)AudioUtil.GetDuration(target));

            if (((uint)AudioUtil.GetDuration(target)) == uint.MaxValue)
            {
                return(str2 + "Unlimited");
            }
            return(str2 + string.Format("{0:00}:{1:00}.{2:000}", span.Minutes, span.Seconds, span.Milliseconds));
        }
        public override string GetInfoString()
        {
            AudioClip clip         = base.target as AudioClip;
            int       channelCount = AudioUtil.GetChannelCount(clip);
            string    text         = (channelCount != 1) ? ((channelCount != 2) ? ((channelCount - 1).ToString() + ".1") : "Stereo") : "Mono";
            AudioCompressionFormat targetPlatformSoundCompressionFormat = AudioUtil.GetTargetPlatformSoundCompressionFormat(clip);
            AudioCompressionFormat soundCompressionFormat = AudioUtil.GetSoundCompressionFormat(clip);
            string text2 = targetPlatformSoundCompressionFormat.ToString();

            if (targetPlatformSoundCompressionFormat != soundCompressionFormat)
            {
                text2 = text2 + " (" + soundCompressionFormat.ToString() + " in editor)";
            }
            string text3 = text2;

            text2 = string.Concat(new object[]
            {
                text3,
                ", ",
                AudioUtil.GetFrequency(clip),
                " Hz, ",
                text,
                ", "
            });
            TimeSpan timeSpan = new TimeSpan(0, 0, 0, 0, (int)AudioUtil.GetDuration(clip));

            if ((uint)AudioUtil.GetDuration(clip) == 4294967295u)
            {
                text2 += "Unlimited";
            }
            else
            {
                text2 += string.Format("{0:00}:{1:00}.{2:000}", timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds);
            }
            return(text2);
        }