public uint GetCappedLengthForPos(uint pos)
        {
            uint newLength = length;

            if (pos > tick)
            {
                newLength = pos - tick;
            }
            else
            {
                newLength = 0;
            }

            Starpower nextSp = null;

            if (song != null && chart != null)
            {
                int arrayPos = SongObjectHelper.FindClosestPosition(this, chart.starPower);
                if (arrayPos == SongObjectHelper.NOTFOUND)
                {
                    return(newLength);
                }

                while (arrayPos < chart.starPower.Count - 1 && chart.starPower[arrayPos].tick <= tick)
                {
                    ++arrayPos;
                }

                if (chart.starPower[arrayPos].tick > tick)
                {
                    nextSp = chart.starPower[arrayPos];
                }

                if (nextSp != null)
                {
                    // Cap sustain length
                    if (nextSp.tick < tick)
                    {
                        newLength = 0;
                    }
                    else if (pos > nextSp.tick)
                    {
                        // Cap sustain
                        newLength = nextSp.tick - tick;
                    }
                }
                // else it's the only starpower or it's the last starpower
            }

            return(newLength);
        }
 public Starpower(Starpower _starpower) : base(_starpower.tick)
 {
     length = _starpower.length;
     flags  = _starpower.flags;
 }
 public void CopyFrom(Starpower sp)
 {
     tick   = sp.tick;
     length = sp.length;
     flags  = sp.flags;
 }