Пример #1
0
        /// <summary>
        /// Adds a synctrack object (bpm or time signature) into the song.
        /// </summary>
        /// <param name="syncTrackObject">Item to add.</param>
        /// <param name="autoUpdate">Automatically update all read-only arrays?
        /// If set to false, you must manually call the updateArrays() method, but is useful when adding multiple objects as it increases performance dramatically.</param>
        public void Add(SyncTrack syncTrackObject, bool autoUpdate = true)
        {
            syncTrackObject.song = this;
            SongObjectHelper.Insert(syncTrackObject, _syncTrack);

            if (autoUpdate)
            {
                UpdateCache();
            }
        }
Пример #2
0
        /// <summary>
        /// Removes a synctrack object (bpm or time signature) from the song.
        /// </summary>
        /// <param name="autoUpdate">Automatically update all read-only arrays?
        /// If set to false, you must manually call the updateArrays() method, but is useful when removing multiple objects as it increases performance dramatically.</param>
        /// <returns>Returns whether the removal was successful or not (item may not have been found if false).</returns>
        public bool Remove(SyncTrack syncTrackObject, bool autoUpdate = true)
        {
            bool success = false;

            if (syncTrackObject.tick > 0)
            {
                success = SongObjectHelper.Remove(syncTrackObject, _syncTrack);
            }

            if (success)
            {
                syncTrackObject.song = null;
            }

            if (autoUpdate)
            {
                UpdateCache();
            }

            return(success);
        }