Exemple #1
0
    // Use this for initialization
    void Start()
    {
        playlist = GetComponent <Hv_Playlist_AudioLib> ();

        playlist.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track01length, track1.samples);
        playlist.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track02length, track2.samples);
        playlist.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track03length, track3.samples);
        playlist.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track04length, track4.samples);
        playlist.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track05length, track5.samples);
        playlist.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track06length, track6.samples);
        playlist.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track07length, track7.samples);
        playlist.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track08length, track8.samples);
        playlist.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track09length, track9.samples);
        playlist.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track10length, track10.samples);

        playlist.FillTableWithMonoAudioClip("track01", track1);
        playlist.FillTableWithMonoAudioClip("track02", track2);
        playlist.FillTableWithMonoAudioClip("track03", track3);
        playlist.FillTableWithMonoAudioClip("track04", track4);
        playlist.FillTableWithMonoAudioClip("track05", track5);
        playlist.FillTableWithMonoAudioClip("track06", track6);
        playlist.FillTableWithMonoAudioClip("track07", track7);
        playlist.FillTableWithMonoAudioClip("track08", track8);
        playlist.FillTableWithMonoAudioClip("track09", track9);
        playlist.FillTableWithMonoAudioClip("track10", track10);
    }
    public override void OnInspectorGUI()
    {
        bool isEnabled = _dsp.IsInstantiated();

        if (!isEnabled)
        {
            EditorGUILayout.LabelField("Press Play!", EditorStyles.centeredGreyMiniLabel);
        }
        // events
        GUI.enabled = isEnabled;
        EditorGUILayout.Space();
        // play
        if (GUILayout.Button("play"))
        {
            _dsp.SendEvent(Hv_Playlist_AudioLib.Event.Play);
        }

        GUILayout.EndVertical();

        // parameters
        GUI.enabled = true;
        GUILayout.BeginVertical();
        EditorGUILayout.Space();
        EditorGUI.indentLevel++;

        // track01length
        GUILayout.BeginHorizontal();
        float track01length    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track01length);
        float newTrack01length = EditorGUILayout.Slider("track01length", track01length, 0.0f, 4410000.0f);

        if (track01length != newTrack01length)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track01length, newTrack01length);
        }
        GUILayout.EndHorizontal();

        // track01vol
        GUILayout.BeginHorizontal();
        float track01vol    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track01vol);
        float newTrack01vol = EditorGUILayout.Slider("track01vol", track01vol, 0.0f, 1.0f);

        if (track01vol != newTrack01vol)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track01vol, newTrack01vol);
        }
        GUILayout.EndHorizontal();

        // track02length
        GUILayout.BeginHorizontal();
        float track02length    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track02length);
        float newTrack02length = EditorGUILayout.Slider("track02length", track02length, 0.0f, 4410000.0f);

        if (track02length != newTrack02length)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track02length, newTrack02length);
        }
        GUILayout.EndHorizontal();

        // track02vol
        GUILayout.BeginHorizontal();
        float track02vol    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track02vol);
        float newTrack02vol = EditorGUILayout.Slider("track02vol", track02vol, 0.0f, 1.0f);

        if (track02vol != newTrack02vol)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track02vol, newTrack02vol);
        }
        GUILayout.EndHorizontal();

        // track03length
        GUILayout.BeginHorizontal();
        float track03length    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track03length);
        float newTrack03length = EditorGUILayout.Slider("track03length", track03length, 0.0f, 4410000.0f);

        if (track03length != newTrack03length)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track03length, newTrack03length);
        }
        GUILayout.EndHorizontal();

        // track03vol
        GUILayout.BeginHorizontal();
        float track03vol    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track03vol);
        float newTrack03vol = EditorGUILayout.Slider("track03vol", track03vol, 0.0f, 1.0f);

        if (track03vol != newTrack03vol)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track03vol, newTrack03vol);
        }
        GUILayout.EndHorizontal();

        // track04length
        GUILayout.BeginHorizontal();
        float track04length    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track04length);
        float newTrack04length = EditorGUILayout.Slider("track04length", track04length, 0.0f, 4410000.0f);

        if (track04length != newTrack04length)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track04length, newTrack04length);
        }
        GUILayout.EndHorizontal();

        // track04vol
        GUILayout.BeginHorizontal();
        float track04vol    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track04vol);
        float newTrack04vol = EditorGUILayout.Slider("track04vol", track04vol, 0.0f, 1.0f);

        if (track04vol != newTrack04vol)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track04vol, newTrack04vol);
        }
        GUILayout.EndHorizontal();

        // track05length
        GUILayout.BeginHorizontal();
        float track05length    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track05length);
        float newTrack05length = EditorGUILayout.Slider("track05length", track05length, 0.0f, 4410000.0f);

        if (track05length != newTrack05length)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track05length, newTrack05length);
        }
        GUILayout.EndHorizontal();

        // track05vol
        GUILayout.BeginHorizontal();
        float track05vol    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track05vol);
        float newTrack05vol = EditorGUILayout.Slider("track05vol", track05vol, 0.0f, 1.0f);

        if (track05vol != newTrack05vol)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track05vol, newTrack05vol);
        }
        GUILayout.EndHorizontal();

        // track06length
        GUILayout.BeginHorizontal();
        float track06length    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track06length);
        float newTrack06length = EditorGUILayout.Slider("track06length", track06length, 0.0f, 4410000.0f);

        if (track06length != newTrack06length)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track06length, newTrack06length);
        }
        GUILayout.EndHorizontal();

        // track06vol
        GUILayout.BeginHorizontal();
        float track06vol    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track06vol);
        float newTrack06vol = EditorGUILayout.Slider("track06vol", track06vol, 0.0f, 1.0f);

        if (track06vol != newTrack06vol)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track06vol, newTrack06vol);
        }
        GUILayout.EndHorizontal();

        // track07length
        GUILayout.BeginHorizontal();
        float track07length    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track07length);
        float newTrack07length = EditorGUILayout.Slider("track07length", track07length, 0.0f, 4410000.0f);

        if (track07length != newTrack07length)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track07length, newTrack07length);
        }
        GUILayout.EndHorizontal();

        // track07vol
        GUILayout.BeginHorizontal();
        float track07vol    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track07vol);
        float newTrack07vol = EditorGUILayout.Slider("track07vol", track07vol, 0.0f, 1.0f);

        if (track07vol != newTrack07vol)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track07vol, newTrack07vol);
        }
        GUILayout.EndHorizontal();

        // track08length
        GUILayout.BeginHorizontal();
        float track08length    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track08length);
        float newTrack08length = EditorGUILayout.Slider("track08length", track08length, 0.0f, 4410000.0f);

        if (track08length != newTrack08length)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track08length, newTrack08length);
        }
        GUILayout.EndHorizontal();

        // track08vol
        GUILayout.BeginHorizontal();
        float track08vol    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track08vol);
        float newTrack08vol = EditorGUILayout.Slider("track08vol", track08vol, 0.0f, 1.0f);

        if (track08vol != newTrack08vol)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track08vol, newTrack08vol);
        }
        GUILayout.EndHorizontal();

        // track09length
        GUILayout.BeginHorizontal();
        float track09length    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track09length);
        float newTrack09length = EditorGUILayout.Slider("track09length", track09length, 0.0f, 4410000.0f);

        if (track09length != newTrack09length)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track09length, newTrack09length);
        }
        GUILayout.EndHorizontal();

        // track09vol
        GUILayout.BeginHorizontal();
        float track09vol    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track09vol);
        float newTrack09vol = EditorGUILayout.Slider("track09vol", track09vol, 0.0f, 1.0f);

        if (track09vol != newTrack09vol)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track09vol, newTrack09vol);
        }
        GUILayout.EndHorizontal();

        // track10length
        GUILayout.BeginHorizontal();
        float track10length    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track10length);
        float newTrack10length = EditorGUILayout.Slider("track10length", track10length, 0.0f, 4410000.0f);

        if (track10length != newTrack10length)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track10length, newTrack10length);
        }
        GUILayout.EndHorizontal();

        // track10vol
        GUILayout.BeginHorizontal();
        float track10vol    = _dsp.GetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track10vol);
        float newTrack10vol = EditorGUILayout.Slider("track10vol", track10vol, 0.0f, 1.0f);

        if (track10vol != newTrack10vol)
        {
            _dsp.SetFloatParameter(Hv_Playlist_AudioLib.Parameter.Track10vol, newTrack10vol);
        }
        GUILayout.EndHorizontal();
        EditorGUI.indentLevel--;
    }