void OnGUI()
        {
            int spaceV = 10;

            if (!HelperDemo.CheckSFExists())
            {
                return;
            }

            // Set custom Style. Good for background color 3E619800
            if (myStyle == null)
            {
                myStyle = new CustomStyle();
            }

            if (midiFilePlayer != null)
            {
                scrollerWindow = GUILayout.BeginScrollView(scrollerWindow, false, false, GUILayout.Width(Screen.width));

                // Display popup in first to avoid activate other layout behind
                PopMidi.Draw(MidiPlayerGlobal.MPTK_ListMidi, midiFilePlayer.MPTK_MidiIndex, myStyle);

                MainMenu.Display("Test Midi File Player Scripting - Demonstrate how to use the MPTK API to Play Midi", myStyle);

                GUISelectSoundFont.Display(scrollerWindow, myStyle);

                //
                // Left column: Midi action
                // ------------------------

                GUILayout.BeginHorizontal();

                GUILayout.BeginVertical(myStyle.BacgDemos, GUILayout.Width(550));
                // Open the popup to select a midi
                if (GUILayout.Button("Current Midi file: '" + midiFilePlayer.MPTK_MidiName + (midiFilePlayer.MPTK_IsPlaying ? "' is playing" : "' is not playing"), GUILayout.Width(500), GUILayout.Height(40)))
                {
                    PopMidi.Show = !PopMidi.Show;
                }
                PopMidi.Position(ref scrollerWindow);

                GUILayout.Space(spaceV);
                string playTime     = string.Format("{0:00}:{1:00}:{2:00}:{3:000}", midiFilePlayer.MPTK_PlayTime.Hours, midiFilePlayer.MPTK_PlayTime.Minutes, midiFilePlayer.MPTK_PlayTime.Seconds, midiFilePlayer.MPTK_PlayTime.Milliseconds);
                string realDuration = string.Format("{0:00}:{1:00}:{2:00}:{3:000}", midiFilePlayer.MPTK_RealDuration.Hours, midiFilePlayer.MPTK_RealDuration.Minutes, midiFilePlayer.MPTK_RealDuration.Seconds, midiFilePlayer.MPTK_RealDuration.Milliseconds);

                GUILayout.Label(string.Format("Time from start playing {0} / {1}", playTime, realDuration), myStyle.TitleLabel3, GUILayout.Width(400));

#if TestWithLocalTime
                TimeSpan localDeltaMidi = DateTime.Now - localStartTimeMidi;
                GUILayout.Label(string.Format("Debug Time start local  {0} {1:F3} {2}",
                                              string.Format("{0:00}:{1:00}:{2:00}:{3:000}",
                                                            localDeltaMidi.Hours, localDeltaMidi.Minutes, localDeltaMidi.Seconds, localDeltaMidi.Milliseconds),
                                              (midiFilePlayer.MPTK_PlayTime - localDeltaMidi).TotalSeconds, midiFilePlayer.OutputRate), myStyle.TitleLabel3, GUILayout.Width(400));
#endif

                //GUILayout.Space(spaceV);
                GUILayout.BeginHorizontal();
                GUILayout.Label("Time Position: " + playTime, myStyle.TitleLabel3, GUILayout.Width(220));
                double currentPosition = Math.Round(midiFilePlayer.MPTK_Position / 1000d, 2);
                double newPosition     = Math.Round(GUILayout.HorizontalSlider((float)currentPosition, 0f, (float)midiFilePlayer.MPTK_Duration.TotalSeconds, GUILayout.Width(buttonWidth)), 2);
                if (newPosition != currentPosition)
                {
                    Debug.Log("New position " + currentPosition + " --> " + newPosition + " " + Event.current.type);
                    midiFilePlayer.MPTK_Position = newPosition * 1000d;
                }
                GUILayout.EndHorizontal();


                //GUILayout.Space(spaceV);
                GUILayout.BeginHorizontal();
                GUILayout.Label("Tick Position: " + midiFilePlayer.MPTK_TickCurrent + " / " + midiFilePlayer.MPTK_TickLast, myStyle.TitleLabel3, GUILayout.Width(220));
                long tick = (long)GUILayout.HorizontalSlider((float)midiFilePlayer.MPTK_TickCurrent, 0f, (float)midiFilePlayer.MPTK_TickLast, GUILayout.Width(buttonWidth));
                if (tick != midiFilePlayer.MPTK_TickCurrent)
                {
                    midiFilePlayer.MPTK_TickCurrent = tick;
                }
                GUILayout.EndHorizontal();

                // Define the global volume
                GUILayout.Space(spaceV);
                GUILayout.BeginHorizontal();
                GUILayout.Label("Global Volume: " + Math.Round(midiFilePlayer.MPTK_Volume, 2), myStyle.TitleLabel3, GUILayout.Width(220));
                midiFilePlayer.MPTK_Volume = GUILayout.HorizontalSlider(midiFilePlayer.MPTK_Volume * 100f, 0f, 100f, GUILayout.Width(buttonWidth)) / 100f;
                GUILayout.EndHorizontal();

                // Transpose each note
                GUILayout.Space(spaceV);
                GUILayout.BeginHorizontal();
                GUILayout.Label("Note Transpose: " + midiFilePlayer.MPTK_Transpose, myStyle.TitleLabel3, GUILayout.Width(220));
                midiFilePlayer.MPTK_Transpose = (int)GUILayout.HorizontalSlider((float)midiFilePlayer.MPTK_Transpose, -24f, 24f, GUILayout.Width(buttonWidth));
                GUILayout.EndHorizontal();

                // Transpose each note
                GUILayout.Space(spaceV);
                GUILayout.BeginHorizontal();
                GUILayout.Label("Speed: " + Math.Round(midiFilePlayer.MPTK_Speed, 2), myStyle.TitleLabel3, GUILayout.Width(220));
                midiFilePlayer.MPTK_Speed = GUILayout.HorizontalSlider((float)midiFilePlayer.MPTK_Speed, 0.1f, 5f, GUILayout.Width(buttonWidth));
                GUILayout.EndHorizontal();


                GUILayout.Space(spaceV);
                GUILayout.BeginHorizontal(GUILayout.Width(350));
                GUILayout.Label("Voices Statistics ", myStyle.TitleLabel3, GUILayout.Width(220));
                GUILayout.Label(string.Format("Played:{0,-4}   Free:{1,-3}   Active:{2,-3}   Reused:{3} %",
                                              midiFilePlayer.MPTK_StatVoicePlayed, midiFilePlayer.MPTK_StatVoiceCountFree, midiFilePlayer.MPTK_StatVoiceCountActive, Mathf.RoundToInt(midiFilePlayer.MPTK_StatVoiceRatioReused)),
                                myStyle.TitleLabel3, GUILayout.Width(330));
                GUILayout.EndHorizontal();

                // Enable or disable channel
                GUILayout.Space(spaceV);
                GUILayout.Label("Channel / Preset, enable or disable channel: ", myStyle.TitleLabel3, GUILayout.Width(400));

                GUILayout.BeginHorizontal();
                for (int channel = 0; channel < midiFilePlayer.MPTK_ChannelCount(); channel++)
                {
                    bool state = GUILayout.Toggle(midiFilePlayer.MPTK_ChannelEnableGet(channel), string.Format("{0} / {1}", channel + 1, midiFilePlayer.MPTK_ChannelPresetGetIndex(channel)), GUILayout.Width(65));
                    if (state != midiFilePlayer.MPTK_ChannelEnableGet(channel))
                    {
                        midiFilePlayer.MPTK_ChannelEnableSet(channel, state);
                        Debug.LogFormat("Channel {0} state:{1}, preset:{2}", channel + 1, state, midiFilePlayer.MPTK_ChannelPresetGetName(channel) ?? "not set");
                    }

                    if (channel == 7)
                    {
                        // Create a new line ...
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                    }
                }
                GUILayout.EndHorizontal();

                // Random playing ?
                GUILayout.Space(spaceV);
                GUILayout.BeginHorizontal();
                IsRandomPlay = GUILayout.Toggle(IsRandomPlay, "  Random Play Midi", GUILayout.Width(220));

                // Weak device ?
                //midiFilePlayer.MPTK_WeakDevice = GUILayout.Toggle(midiFilePlayer.MPTK_WeakDevice, "Weak Device", GUILayout.Width(220));
                GUILayout.EndHorizontal();
                GUILayout.Space(spaceV);

                // Play/Pause/Stop/Restart actions on midi
                GUILayout.BeginHorizontal(GUILayout.Width(500));
                if (midiFilePlayer.MPTK_IsPlaying && !midiFilePlayer.MPTK_IsPaused)
                {
                    GUI.color = ButtonColor;
                }
                if (GUILayout.Button(new GUIContent("Play", "")))
                {
                    midiFilePlayer.MPTK_Play();
                }
                GUI.color = Color.white;

                if (midiFilePlayer.MPTK_IsPaused)
                {
                    GUI.color = ButtonColor;
                }
                if (GUILayout.Button(new GUIContent("Pause", "")))
                {
                    if (midiFilePlayer.MPTK_IsPaused)
                    {
                        midiFilePlayer.MPTK_UnPause();
                    }
                    else
                    {
                        midiFilePlayer.MPTK_Pause();
                    }
                }
                GUI.color = Color.white;

                if (GUILayout.Button(new GUIContent("Stop", "")))
                {
                    midiFilePlayer.MPTK_Stop();
                }

                if (GUILayout.Button(new GUIContent("Restart", "")))
                {
                    midiFilePlayer.MPTK_RePlay();
                }
                GUILayout.EndHorizontal();

                // Previous and Next button action on midi
                GUILayout.BeginHorizontal(GUILayout.Width(500));
                if (GUILayout.Button(new GUIContent("Previous", "")))
                {
                    midiFilePlayer.MPTK_Previous();
                    CurrentIndexPlaying = midiFilePlayer.MPTK_MidiIndex;
                }
                if (GUILayout.Button(new GUIContent("Next", "")))
                {
                    midiFilePlayer.MPTK_Next();
                    CurrentIndexPlaying = midiFilePlayer.MPTK_MidiIndex;
                    Debug.Log("MPTK_Next - CurrentIndexPlaying " + CurrentIndexPlaying);
                }
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();

                if (!string.IsNullOrEmpty(infoMidi) || !string.IsNullOrEmpty(infoLyrics) || !string.IsNullOrEmpty(infoCopyright) || !string.IsNullOrEmpty(infoSeqTrackName))
                {
                    //
                    // Right Column: midi infomation, lyrics, ...
                    // ------------------------------------------
                    GUILayout.BeginVertical(myStyle.BacgDemos);
                    if (!string.IsNullOrEmpty(infoMidi))
                    {
                        scrollPos1 = GUILayout.BeginScrollView(scrollPos1, false, true);//, GUILayout.Height(heightLyrics));
                        GUILayout.Label(infoMidi, myStyle.TextFieldMultiLine);
                        GUILayout.EndScrollView();
                    }
                    GUILayout.Space(5);
                    if (!string.IsNullOrEmpty(infoLyrics))
                    {
                        //Debug.Log(scrollPos + " " + countline+ " " + myStyle.TextFieldMultiLine.CalcHeight(new GUIContent(lyrics), 400));
                        //float heightLyrics = myStyle.TextFieldMultiLine.CalcHeight(new GUIContent(infoLyrics), 400);
                        //scrollPos.y = - 340;
                        //if (heightLyrics > 200) heightLyrics = 200;
                        scrollPos2 = GUILayout.BeginScrollView(scrollPos2, false, true);//, GUILayout.Height(heightLyrics));
                        GUILayout.Label(infoLyrics, myStyle.TextFieldMultiLine);
                        GUILayout.EndScrollView();
                        //if (GUILayout.Button(new GUIContent("Add", ""))) lyrics += "\ntestest testetst";
                    }
                    GUILayout.Space(5);
                    if (!string.IsNullOrEmpty(infoCopyright))
                    {
                        scrollPos3 = GUILayout.BeginScrollView(scrollPos3, false, true);
                        GUILayout.Label(infoCopyright, myStyle.TextFieldMultiLine);
                        GUILayout.EndScrollView();
                    }
                    GUILayout.Space(5);
                    if (!string.IsNullOrEmpty(infoSeqTrackName))
                    {
                        scrollPos4 = GUILayout.BeginScrollView(scrollPos4, false, true);
                        GUILayout.Label(infoSeqTrackName, myStyle.TextFieldMultiLine);
                        GUILayout.EndScrollView();
                    }
                    GUILayout.EndVertical();
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal(myStyle.BacgDemos);
                GUILayout.Label("Go to your Hierarchy, select GameObject MidiFilePlayer: inspector contains a lot of parameters to control the sound.", myStyle.TitleLabel2);
                GUILayout.EndHorizontal();


                GUILayout.EndScrollView();
            }
        }