Ejemplo n.º 1
0
        public void AudioDBFileGui(AudioLoader.AudioFileInfo audioFile)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("   " + audioFile.Name);
            GUILayout.FlexibleSpace();
            //string buttonText = " ► ";
            //if (DbPlayer.clip != null && DbPlayer.clip.name == clipName)
            //{
            //if (DbPlayer.isPlaying)
            //buttonText = "  ■  ";
            //else if (DbPlayer.clip.loadState == AudioDataLoadState.Loading)
            //buttonText = "...";
            //}

            //if (GUILayout.Button(buttonText))
            //{
            //if (DbPlayer.isPlaying && DbPlayer.clip.name == clipName)
            //DbPlayer.Stop();
            //else
            //{
            //DbPlayer.clip = clip;
            //DbPlayer.Play();
            //}
            //}
            if (!_expandedDbItems.ContainsKey(audioFile.Name))
                _expandedDbItems.Add(audioFile.Name, false);
            if (GUILayout.Button(" ☰  "))
                _expandedDbItems[audioFile.Name] = !_expandedDbItems[audioFile.Name];

            GUILayout.EndHorizontal();

            if (_expandedDbItems[audioFile.Name])
            {
                GUILayout.Label("   Path:\t" + audioFile.Path);
                GUILayout.Label("   File type:\t" + audioFile.FileExtension);
                if (audioFile.FileExtension.ToUpper() == ".MP3")
                {
                    if (Utils.LibMpg123Installed)
                    {
                        MP3Import.TrackInfo trackInfo;
                        LoadedMP3Info.TryGetValue(audioFile.Path, out trackInfo);
                        if (!LoadedMP3Info.ContainsKey(audioFile.Path))
                        {
                            MP3Import importer = new MP3Import();
                            trackInfo = importer.GetTrackInfo(audioFile.Path);
                            LoadedMP3Info.Add(audioFile.Path, trackInfo);
                        }
                        GUILayout.Label("      Title:\t\t" + trackInfo.Title);
                        GUILayout.Label("      Album:\t\t" + trackInfo.Album);
                        GUILayout.Label("      Artist:\t\t" + trackInfo.Artist);
                        GUILayout.Label("      Year:\t\t" + trackInfo.Year);
                        GUILayout.Label("      Genre:\t\t" + trackInfo.Genre);
                        GUILayout.Label("      Comment:\t" + trackInfo.Comment);
                        GUILayout.Label("      Tag:\t\t" + trackInfo.Tag);
                        GUILayout.Label("      Channels:\t" + trackInfo.Channels);
                        GUILayout.Label("      Encoding:\t" + trackInfo.Encoding);
                        GUILayout.Label("      Rate:\t\t" + trackInfo.Rate);
                    }
                    else
                        GUILayout.Label("MP3 support not installed");
                }
                //GUILayout.Label("   Channels:\t" + clip.channels.ToString());
                //GUILayout.Label("   Frequency:\t" + clip.frequency.ToString() + " Hz");
                //TimeSpan clipLength = TimeSpan.FromSeconds(clip.length);
                //GUILayout.Label("   Length:\t\t" + string.Format("{0:D2}:{1:D2}", clipLength.Minutes, clipLength.Seconds));
                //GUILayout.Label("   Load State:\t" + clip.loadState.ToString());
                //GUILayout.Label("   Load Type:\t" + clip.loadType.ToString());
                //GUILayout.Label("   Samples:\t" + clip.samples.ToString());
            }
        }