Ejemplo n.º 1
0
        public float Sample(time_t position)
        {
            foreach (var point in m_points)
            {
                if (point.Position <= position)
                {
                    var next = point.Next;

                    float a = 0.5f, b = 0.5f;
                    if (next != null) // TODO(local): curve shape values from objects
                    {
                        return(point.Alpha + (next.Alpha - point.Alpha)
                               * point.Shape.Sample((float)((position - point.Position) / (next.Position - point.Position)), a, b));
                    }
                    else
                    {
                        return(point.Alpha);
                    }
                }
            }

            if (m_points.Count == 0)
            {
                return(0);
            }
            else
            {
                return(m_points[0].Alpha);
            }
        }
Ejemplo n.º 2
0
        private float GetTempRollValue(time_t position, HybridLabel label, out float valueMult, bool oneMinus = false)
        {
            var s = m_audioPlayback.Chart[label];

            valueMult = 1.0f;

            var mrAnalog = s.MostRecent <AnalogEntity>(position);

            if (mrAnalog == null || position > mrAnalog.AbsoluteEndPosition)
            {
                return(0);
            }

            if (mrAnalog.RangeExtended)
            {
                valueMult = 2.0f;
            }
            float result = mrAnalog.SampleValue(position);

            if (oneMinus)
            {
                return(1 - result);
            }
            else
            {
                return(result);
            }
        }
Ejemplo n.º 3
0
 public StateTick(AnalogEntity root, AnalogEntity segment, time_t pos, JudgeState state)
 {
     RootEntity    = root;
     SegmentEntity = segment;
     Position      = pos;
     State         = state;
 }
Ejemplo n.º 4
0
        private void Judge_OnTickProcessed(Entity entity, time_t position, JudgeResult result, bool isEarly)
        {
            //Logger.Log($"[{ obj.Stream }] { result.Kind } :: { (int)(result.Difference * 1000) } @ { position }");

            if (result.Kind == JudgeKind.Miss || result.Kind == JudgeKind.Bad)
            {
                m_comboDisplay.Combo = 0;
            }
            else
            {
                m_comboDisplay.Combo++;
            }

            if ((int)entity.Lane >= 6)
            {
                return;
            }

            if (entity.IsInstant)
            {
                if (result.Kind != JudgeKind.Miss)
                {
                    if (entity is ButtonEntity button && button.HasSample && m_hitSounds.ContainsKey(button.Sample))
                    {
                        var sample = m_hitSounds[button.Sample];
                        sample.Volume = button.SampleVolume * SAMPLE_VOLUME_MOD;
                        sample.Replay();
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public long TODO()
        {
            _internalDate = 123;
            var i = _internalDate;

            return((long)i);
        }
Ejemplo n.º 6
0
        private void Judge_OnTickProcessed(ChartObject obj, time_t position, JudgeResult result)
        {
            //Logger.Log($"[{ obj.Stream }] { result.Kind } :: { (int)(result.Difference * 1000) } @ { position }");

            if (result.Kind == JudgeKind.Miss || result.Kind == JudgeKind.Bad)
            {
                m_comboDisplay.Combo = 0;
            }
            else
            {
                m_comboDisplay.Combo++;
            }

            if (!obj.IsInstant)
            {
                m_streamHasActiveEffects[obj.Stream] = result.Kind != JudgeKind.Miss;
            }
            else
            {
                if (result.Kind != JudgeKind.Miss)
                {
                    CreateKeyBeam(obj.Stream, result.Kind, result.Difference < 0.0);
                }
            }
        }
Ejemplo n.º 7
0
 public override void ApplyToDsp(Dsp effect, time_t qnDur, float alpha = 0)
 {
     base.ApplyToDsp(effect, qnDur, alpha);
     if (effect is Phaser p)
     {
     }
 }
Ejemplo n.º 8
0
        private float GetTempRollValue(time_t position, int stream, out float valueMult, bool oneMinus = false)
        {
            var s = m_playback.Chart[stream];

            valueMult = 1.0f;

            var mrAnalog = s.MostRecent <AnalogObject>(position);

            if (mrAnalog == null || position > mrAnalog.AbsoluteEndPosition)
            {
                return(0);
            }

            if (mrAnalog.RangeExtended)
            {
                valueMult = 2.0f;
            }
            float result = mrAnalog.SampleValue(position);

            if (oneMinus)
            {
                return(1 - result);
            }
            else
            {
                return(result);
            }
        }
Ejemplo n.º 9
0
        private void SetLocked()
        {
            m_canControlCursorMovement = true;

            m_lockTimer      = m_lockDuration;
            m_lockTimerSpeed = 1.0;
        }
Ejemplo n.º 10
0
        public JudgeResult?UserPressed(time_t timeStamp)
        {
            if (AutoPlay)
            {
                return(null);
            }

            m_userHeld = true;
            m_userWhen = timeStamp;

            if (m_ticks.Count == 0)
            {
                return(null);
            }

            var tick = m_ticks[0];

            // Don't ACTUALLY handle holds handled in here
            if (tick.IsHold)
            {
                OnHoldPressed?.Invoke(timeStamp, tick.AssociatedObject);
                m_lastPressedObject = tick.AssociatedObject;
                return(null);
            }
            else
            {
                OnChipPressed?.Invoke(timeStamp, tick.AssociatedObject);
            }

            m_ticks.RemoveAt(0);

            time_t diff    = tick.Position + JudgementOffset - timeStamp;
            time_t absDiff = MathL.Abs(diff.Seconds);

            time_t offsetTime = timeStamp - JudgementOffset;

            JudgeResult result;

            if (absDiff <= PERF_RADIUS)
            {
                result = new JudgeResult(diff, JudgeKind.Perfect);
            }
            else if (absDiff <= CRIT_RADIUS)
            {
                result = new JudgeResult(diff, JudgeKind.Critical);
            }
            else if (absDiff <= NEAR_RADIUS)
            {
                result = new JudgeResult(diff, JudgeKind.Near);
            }
            // TODO(local): Is this how we want to handle misses?
            else
            {
                result = new JudgeResult(diff, JudgeKind.Bad);
            }

            OnTickProcessed?.Invoke(tick.AssociatedObject, offsetTime, result);
            return(result);
        }
Ejemplo n.º 11
0
 public override void ApplyToDsp(Dsp effect, time_t qnDur, float alpha = 0)
 {
     base.ApplyToDsp(effect, qnDur, alpha);
     if (effect is BitCrusher bitCrusher)
     {
         bitCrusher.Reduction = Reduction.Sample(alpha);
     }
 }
Ejemplo n.º 12
0
 public override void ApplyToDsp(Dsp effect, time_t qnDur, float alpha = 0)
 {
     base.ApplyToDsp(effect, qnDur, alpha);
     if (effect is TapeStop ts)
     {
         ts.Duration = Duration.Sample(alpha);
     }
 }
Ejemplo n.º 13
0
 public override void ApplyToDsp(Dsp effect, time_t qnDur, float alpha = 0)
 {
     base.ApplyToDsp(effect, qnDur, alpha);
     if (effect is Wobble wobble)
     {
         wobble.SetPeriod(Period.Sample(alpha) * qnDur.Seconds * 4);
     }
 }
Ejemplo n.º 14
0
            public Tick(ChartObject obj, time_t pos, bool isSegment, bool isAutoTick = false)
            {
                AssociatedObject = obj;
                Position         = pos;
                IsSegment        = isSegment;

                IsAutoTick = isAutoTick;
            }
Ejemplo n.º 15
0
            public Tick(ChartObject obj, time_t pos, bool isHold, bool isAutoTick = false)
            {
                AssociatedObject = obj;
                Position         = pos;
                IsHold           = isHold;

                IsAutoTick = isAutoTick;
            }
Ejemplo n.º 16
0
 public override void ApplyToDsp(Dsp effect, time_t qnDur, float alpha = 0)
 {
     base.ApplyToDsp(effect, qnDur, alpha);
     if (effect is SideChain sc)
     {
         sc.Amount   = Amount.Sample(alpha);
         sc.Duration = Duration.Sample(alpha) * qnDur.Seconds * 4;
     }
 }
Ejemplo n.º 17
0
 public override void ApplyToDsp(Dsp effect, time_t qnDur, float alpha = 0)
 {
     base.ApplyToDsp(effect, qnDur, alpha);
     if (effect is Flanger flanger)
     {
         flanger.SetDelay(Delay.Sample(alpha));
         flanger.SetDelayRange(Offset.Sample(alpha), Depth.Sample(alpha));
     }
 }
Ejemplo n.º 18
0
 public override void ApplyToDsp(Dsp effect, time_t qnDur, float alpha = 0)
 {
     base.ApplyToDsp(effect, qnDur, alpha);
     if (effect is Gate gate)
     {
         gate.SetGating(Gating.Sample(alpha));
         gate.SetGateDuration(GateDuration.Sample(alpha) * qnDur.Seconds * 4);
     }
 }
Ejemplo n.º 19
0
        public void UserReleased(time_t timeStamp)
        {
            m_userHeld = false;

            if (m_ticks.Count > 0 && m_ticks[0].IsHold && m_lastPressedObject == m_ticks[0].AssociatedObject)
            {
                OnHoldReleased?.Invoke(timeStamp, m_ticks[0].AssociatedObject);
            }
        }
Ejemplo n.º 20
0
 public override void ApplyToDsp(Dsp effect, time_t qnDur, float alpha = 0)
 {
     base.ApplyToDsp(effect, qnDur, alpha);
     if (effect is Retrigger retrigger)
     {
         retrigger.Mix      = Mix.Sample(alpha);
         retrigger.Gating   = Gating.Sample(alpha);
         retrigger.Duration = GateDuration.Sample(alpha) * qnDur.Seconds * 4;
     }
 }
Ejemplo n.º 21
0
        /*
        ** Return date: dd, mm, yyyy
        */
        private static void io_date()
        {
            time_t t = new time_t();
            tm     s = new tm();

            time(t);
            s = localtime(t);
            lua_pushnumber(s.tm_mday);
            lua_pushnumber(s.tm_mon + 1);
            lua_pushnumber(s.tm_year + 1900);
        }
Ejemplo n.º 22
0
        /*
        ** Return time: hour, min, sec
        */
        private static void io_time()
        {
            time_t t = new time_t();
            tm     s = new tm();

            time(t);
            s = localtime(t);
            lua_pushnumber(s.tm_hour);
            lua_pushnumber(s.tm_min);
            lua_pushnumber(s.tm_sec);
        }
Ejemplo n.º 23
0
        public static tm localtime(time_t t)
        {
            tm       result      = new tm();
            DateTime currentTime = DateTime.Now;

            result.tm_mday = currentTime.Day;
            result.tm_mon  = currentTime.Month - 1;            //+1
            result.tm_year = currentTime.Year - 1900;          //+1900
            result.tm_hour = currentTime.Hour;
            result.tm_min  = currentTime.Minute;
            result.tm_sec  = currentTime.Second;
            return(result);
        }
Ejemplo n.º 24
0
        public override bool AsyncFinalize()
        {
            if (!base.AsyncFinalize())
            {
                return(false);
            }

            //if (!m_script.LuaAsyncFinalize()) return false;
            //m_guiScript.InitSpriteRenderer();

            if (!m_highwayView.AsyncFinalize())
            {
                return(false);
            }
            if (!m_background.AsyncFinalize())
            {
                return(false);
            }

            if (!m_resources.FinalizeLoad())
            {
                return(false);
            }

            m_slamSample.Channel = Mixer.MasterChannel;
            m_slamSample.RemoveFromChannelOnFinish = false;

            foreach (var(name, sample) in m_hitSounds)
            {
                sample.Channel = Mixer.MasterChannel;
                sample.RemoveFromChannelOnFinish = false;
            }

            m_visualOffset = NscConfig.VideoOffset / 1000.0;

            if (!m_critRootUi.AsyncFinalize())
            {
                return(false);
            }
            if (!m_critRootWorld.AsyncFinalize())
            {
                return(false);
            }
            if (!m_comboDisplay.AsyncFinalize())
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 25
0
        public override void Update()
        {
            base.Update();

            if (m_numInputs == 0)
            {
                m_cursor.Position = new Vector2(0.5f, 0);
            }
            else
            {
                time_t inacc = m_totalInaccuracy / m_numInputs;
                float  alpha = (float)(inacc / m_inaccuracyWindow);

                m_cursor.Position = new Vector2((1 + alpha) * 0.5f, 0);
            }
        }
Ejemplo n.º 26
0
        public void RenderableObjectAppear(ChartObject obj)
        {
            if (obj.Stream >= 8)
            {
                return;
            }

            if (obj is ButtonObject bobj)
            {
                ObjectRenderable3D br3d;
                if (obj.IsInstant)
                {
                    br3d = new ButtonChipRenderState3D(bobj, m_resources, m_obj3dResources);
                }
                else
                {
                    float zDur = (float)(obj.AbsoluteDuration.Seconds / ViewDuration.Seconds);
                    br3d = new ButtonHoldRenderState3D(bobj, zDur * LENGTH_BASE, m_resources, m_obj3dResources);
                }

                m_renderables[obj.Stream][obj] = br3d;
            }
            else if (obj is AnalogObject aobj)
            {
                var color = obj.Stream == 6 ? m_lVolColor : m_rVolColor;

                if (obj.IsInstant)
                {
                    float zDur = (float)(SlamDurationTime(aobj).Seconds / ViewDuration.Seconds);
                    m_renderables[obj.Stream][obj] = new SlamRenderState3D(aobj, zDur * LENGTH_BASE, color, m_resources);
                }
                else
                {
                    time_t duration = obj.AbsoluteDuration;
                    if (aobj.PreviousConnected != null && aobj.Previous.IsInstant)
                    {
                        duration -= SlamDurationTime(aobj.PreviousConnected);
                    }

                    float zDur = (float)(duration.Seconds / ViewDuration.Seconds);
                    m_renderables[obj.Stream][obj] = new LaserRenderState3D(aobj, zDur * LENGTH_BASE, color, m_resources);
                }
            }
        }
Ejemplo n.º 27
0
        internal void InternalAdvancePosition(time_t position)
        {
            if (position - CurrentPosition > LargestPositionStep * 1.5)
            {
                time_t lastPos = CurrentPosition;
                for (int i = 0, n = MathL.CeilToInt((double)(position - CurrentPosition) / (double)LargestPositionStep); i < n; i++)
                {
                    time_t nextPos = MathL.Lerp((double)lastPos, (double)position, (double)(i + 1) / n);

                    CurrentPosition = nextPos;
                    AdvancePosition(nextPos);
                }
            }
            else
            {
                CurrentPosition = position;
                AdvancePosition(position);
            }
        }
Ejemplo n.º 28
0
        public void UserReleased(time_t position)
        {
            DespawnKeyBeam?.Invoke(Label);

            switch (m_state)
            {
            case JudgeState.Idle:
            case JudgeState.HoldOff: break;     // do nothing when released

            case JudgeState.HoldOn:
            {
                OnHoldReleased?.Invoke(position, m_currentStateTick.Entity);

                m_state = JudgeState.HoldOff;

                IsBeingPlayed = false;
            } break;
            }
        }
Ejemplo n.º 29
0
    public static string todayDate()
    {
        time_t t = new time_t();
        tm     tmp;
        string MY_TIME = new string(new char[50]);

        time(t);
        // localtime() uses the time pointed by t ,
        // to fill a tm structure with the
        // values that represent the
        // corresponding local time.
        tmp = localtime(t);
        // using strftime to display time
        // Copies into ptr the content of format,
        // expanding its format specifiers into the corresponding values
        // that represent the time described in timeptr, with a limit of maxsize characters.
        strftime(MY_TIME, sizeof(char), "%d %b %Y", tmp);

        return(MY_TIME);
    }
Ejemplo n.º 30
0
        public override void ApplyToDsp(Dsp effect, time_t qnDur, float alpha = 0)
        {
            base.ApplyToDsp(effect, qnDur, alpha);
            if (effect is BiQuadFilter filter)
            {
                switch (Type)
                {
                case EffectType.PeakingFilter:
                    filter.SetPeaking(Q.Sample(alpha), Freq.Sample(alpha), Gain.Sample(alpha));
                    break;

                case EffectType.LowPassFilter:
                    filter.SetLowPass(Q.Sample(alpha) * Mix.Sample(alpha) + 0.1f, Freq.Sample(alpha));
                    break;

                case EffectType.HighPassFilter:
                    filter.SetHighPass(Q.Sample(alpha) * Mix.Sample(alpha) + 0.1f, Freq.Sample(alpha));
                    break;
                }
            }
        }
Ejemplo n.º 31
0
        public time_t sceKernelLibcTime(time_t* Time)
        {
            PspRtc.Update();

            var CalculatedTime = (time_t)PspRtc.UnixTimeStamp;

            if (Time != null)
            {
                *Time = CalculatedTime;
            }
            return CalculatedTime;
        }