/* * 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 { /// /// SoundEffects section of the .qua /// [Serializable] public class SoundEffectInfo { /// /// The time at which to play the sound sample. /// public float StartTime { get; set; } /// /// The one-based index of the sound sample in the CustomAudioSamples array. /// public int Sample { get; set; } /// /// The volume of the sound sample. Defaults to 100. /// public int Volume { get; set; } /// /// By-value comparer, auto-generated by Rider. /// private sealed class ByValueEqualityComparer : IEqualityComparer { public bool Equals(SoundEffectInfo x, SoundEffectInfo 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 x.StartTime.Equals(y.StartTime) && x.Sample == y.Sample && x.Volume == y.Volume; } public int GetHashCode(SoundEffectInfo obj) { unchecked { var hashCode = obj.StartTime.GetHashCode(); hashCode = (hashCode * 397) ^ obj.Sample; hashCode = (hashCode * 397) ^ obj.Volume; return hashCode; } } } public static IEqualityComparer ByValueComparer { get; } = new ByValueEqualityComparer(); } }