Exemple #1
0
        /// <summary>
        /// Parse the rpp file.
        /// </summary>
        private void Example()
        {
            // open the file and parse it
            parser = new ReaperParser(pathToReaperFile);

            if (!parser.isValid)
            {
                Debug.LogError("The ReaperParser was not initialized.");
                return;
            }

            // get the parsed main ReaperNode object
            rpp = parser.rpp;

            // e.g. get the position of the cursor. There is only one value. Value returns always the first of all values.
            string cursorPosition = rpp.GetNode("CURSOR").value;

            Debug.Log("The cursor position: " + cursorPosition);

            // e.g. get the main tempo information of the session.
            List <string> tempo = rpp.GetNode("TEMPO").values;

            Debug.Log("Tempo information: " + string.Join(", ", tempo.ToArray()));

            // e.g. get the name of the first item on the last track
            string itemName = rpp.GetLastNode("TRACK").GetNode("ITEM").GetNode("NAME").value;

            Debug.Log("name of the first item on the last track: " + itemName);

            // load the audio in a coroutine to be sure the audioclip is loaded before assigned to a audiosource
            StartCoroutine(LoadAudio());
        }