<commit_before>﻿// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Statistics;
using osu.Framework.Timing;
using System;

namespace osu.Framework.Audio.Track
{
    public abstract class Track : AdjustableAudioComponent, IAdjustableClock, ITrack
    {
        public event Action Completed;
        public event Action Failed;

        protected virtual void RaiseCompleted() => Completed?.Invoke();
        protected virtual void RaiseFailed() => Failed?.Invoke();

        /// <summary>
        /// Is this track capable of producing audio?
        /// </summary>
        public virtual bool IsDummyDevice => true;

        /// <summary>
        /// Point in time in milliseconds to restart the track to on loop or <see cref="Restart"/>.
        /// </summary>
        public double RestartPoint { get; set; }

        protected override void OnLooping() => Restart();

        /// <summary>
        /// Reset this track to a logical default state.
        /// </summary>
        public virtual void Reset()
        {
            Volume.Value = 1;

            ResetSpeedAdjustments();

            Stop();
            Seek(0);
        }

        /// <summary>
        /// Restarts this track from the <see cref="RestartPoint"/> while retaining adjustments.
        /// </summary>
        public virtual void Restart()
        {
            Stop();
            Seek(RestartPoint);
            Start();
        }

        public virtual void ResetSpeedAdjustments()
        {
            Frequency.Value = 1;
            Tempo.Value = 1;
        }

        /// <summary>
        /// Current position in milliseconds.
        /// </summary>
        public abstract double CurrentTime { get; }

        private double length;

        /// <summary>
        /// Length of the track in milliseconds.
        /// </summary>
        public double Length
        {
            get => length;
            set
            {
                if (value < 0)
                    throw new ArgumentException("Track length must be >= 0.", nameof(value));

                length = value;
            }
        }

        public virtual int? Bitrate => null;
<commit_msg>Unbind and reset adjustments on reset call<commit_after>﻿// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Statistics;
using osu.Framework.Timing;
using System;

namespace osu.Framework.Audio.Track
{
    public abstract class Track : AdjustableAudioComponent, IAdjustableClock, ITrack
    {
        public event Action Completed;
        public event Action Failed;

        protected virtual void RaiseCompleted() => Completed?.Invoke();
        protected virtual void RaiseFailed() => Failed?.Invoke();

        /// <summary>
        /// Is this track capable of producing audio?
        /// </summary>
        public virtual bool IsDummyDevice => true;

        /// <summary>
        /// Point in time in milliseconds to restart the track to on loop or <see cref="Restart"/>.
        /// </summary>
        public double RestartPoint { get; set; }

        protected override void OnLooping() => Restart();

        /// <summary>
        /// Reset this track to a logical default state.
        /// </summary>
        public virtual void Reset()
        {
            Volume.Value = 1;

            ResetSpeedAdjustments();

            Stop();
            Seek(0);
        }

        /// <summary>
        /// Restarts this track from the <see cref="RestartPoint"/> while retaining adjustments.
        /// </summary>
        public virtual void Restart()
        {
            Stop();
            Seek(RestartPoint);
            Start();
        }

        public virtual void ResetSpeedAdjustments()
        {
            Frequency.Value = 1;
            Tempo.Value = 1;

            Frequency.UnbindBindings();
            Frequency.SetDefault();

            Tempo.UnbindBindings();
            Tempo.SetDefault();
        }

        /// <summary>
        /// Current position in milliseconds.
        /// </summary>
        public abstract double CurrentTime { get; }

        private double length;

        /// <summary>
        /// Length of the track in milliseconds.
        /// </summary>
        public double Length
        {
            get => length;
            set
            {
                if (value < 0)
                    throw new ArgumentException("Track length must be >= 0.", nameof(value));

                length = value;
            }
        }

        public virtual int? Bitrate => null;

{'fraction_non_alphanumeric': 0.104480781482268, 'fraction_numerical': 0.002548311743469951, 'mean_word_length': 1.5893347993402969, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7229501', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1117, 'n_words': 390}