/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * Copyright (c) 2017-2019 Swan & The Quaver Team . */ using System; using System.Collections.Generic; namespace Quaver.API.Maps.Structures { /// /// CustomAudioSamples section of the .qua /// [Serializable] public class CustomAudioSampleInfo { /// /// The path to the audio sample. /// public string Path { get; set; } /// /// If true, the audio sample is always played back at 1.0x speed, regardless of the rate. /// public bool UnaffectedByRate { get; set; } /// /// By-value comparer, auto-generated by Rider. /// private sealed class ByValueEqualityComparer : IEqualityComparer { public bool Equals(CustomAudioSampleInfo x, CustomAudioSampleInfo y) { if (ReferenceEquals(x, y)) return true; if (ReferenceEquals(x, null)) return false; if (ReferenceEquals(y, null)) return false; if (x.GetType() != y.GetType()) return false; return string.Equals(x.Path, y.Path) && x.UnaffectedByRate == y.UnaffectedByRate; } public int GetHashCode(CustomAudioSampleInfo obj) { unchecked { return ((obj.Path != null ? obj.Path.GetHashCode() : 0) * 397) ^ obj.UnaffectedByRate.GetHashCode(); } } } public static IEqualityComparer ByValueComparer { get; } = new ByValueEqualityComparer(); } }