public void It_should_be_able_to_create_with_the_specified_values(int beat, long subBeatPos, int subBeatRes) { var subBeat = new Rational(subBeatPos, subBeatRes); var actual = BeatDuration.Of(beat, subBeatPos, subBeatRes); Assert.That(actual.BeatPart, Is.EqualTo(beat), "The instance has an invalid beat value."); Assert.That(actual.SubBeatPart, Is.EqualTo(subBeat), "The instance has an invalid sub-beat value."); }
public void It_should_be_able_to_create_with_the_specified_values(int beat, long subBeatPos, int subBeatRes) { var durationFromZero = BeatDuration.Of(beat, subBeatPos, subBeatRes); var actual = BeatPoint.At(beat, subBeatPos, subBeatRes); Assert.That(actual.DurationFromZero, Is.EqualTo(durationFromZero), "This instance has an invalid value."); }
public void Test_OnBeatDurationChanged() { var beatDuration = new BeatDuration(1); var calls = 0; beatDuration.Changed += delegate { calls++; }; beatDuration.Value = beatDuration.Value; Assert.AreEqual(0, calls); beatDuration.Value++; Assert.AreEqual(1, calls); }
public void It_should_be_able_to_multiply_with_a_int_from_left( int xBeat, long xSubPos, int xSubRes, int y ) { var x = xBeat + new Rational(xSubPos, xSubRes); Evaluate(x * y, out var beat, out var subBeat); var actual = y * BeatDuration.Of(xBeat, xSubPos, xSubRes); Assert.That(actual.BeatPart, Is.EqualTo(beat), "The instance has an invalid beat value."); Assert.That(actual.SubBeatPart, Is.EqualTo(subBeat), "The instance has an invalid sub-beat value."); }
public void It_should_be_able_to_normalize( int beat, long subBeatPos, int subBeatRes, int expectedBeat, long expectedSubBeatPos, int expectedSubBeatRes ) { var expectedSubBeat = new Rational(expectedSubBeatPos, expectedSubBeatRes); var actual = BeatDuration.Of(beat, subBeatPos, subBeatRes); Assert.That(actual.BeatPart, Is.EqualTo(expectedBeat), "The instance has an invalid beat value."); Assert.That(actual.SubBeatPart, Is.EqualTo(expectedSubBeat), "The instance has an invalid sub-beat value."); }
public void It_should_be_able_to_substract_with_duration( int xBeat, long xSubPos, int xSubRes, int yBeat, long ySubPos, int ySubRes ) { var x = BeatDuration.Of(xBeat, xSubPos, xSubRes); var y = BeatDuration.Of(yBeat, ySubPos, ySubRes); var expected = x - y; var actual = BeatPoint.At(x) - y; Assert.That(actual.DurationFromZero, Is.EqualTo(expected), "The instance has an invalid beat value."); }
public void It_should_be_able_to_multiply_with_a_ratio_from_right( int xBeat, long xSubPos, int xSubRes, long yNumerator, int yDenominator ) { var x = xBeat + new Rational(xSubPos, xSubRes); var y = new Rational(yNumerator, yDenominator); Evaluate(x * y, out var beat, out var subBeat); var actual = BeatDuration.Of(xBeat, xSubPos, xSubRes) * y; Assert.That(actual.BeatPart, Is.EqualTo(beat), "The instance has an invalid beat value."); Assert.That(actual.SubBeatPart, Is.EqualTo(subBeat), "The instance has an invalid sub-beat value."); }
public void It_should_be_able_to_divide_by_a_int( int xBeat, long xSubPos, int xSubRes, int y ) { if (y == 0) { return; } var x = xBeat + new Rational(xSubPos, xSubRes); Evaluate(x / y, out var beat, out var subBeat); var actual = BeatDuration.Of(xBeat, xSubPos, xSubRes) / y; Assert.That(actual.BeatPart, Is.EqualTo(beat), "The instance has an invalid beat value."); Assert.That(actual.SubBeatPart, Is.EqualTo(subBeat), "The instance has an invalid sub-beat value."); }
public void It_should_be_able_to_divide_by_a_ratio( int xBeat, long xSubPos, int xSubRes, long yNumerator, int yDenominator ) { var x = xBeat + new Rational(xSubPos, xSubRes); var y = new Rational(yNumerator, yDenominator); if (y == 0) { return; } Evaluate(x / y, out var beat, out var subBeat); var actual = BeatDuration.Of(xBeat, new Rational(xSubPos, xSubRes)) / y; Assert.That(actual.BeatPart, Is.EqualTo(beat), "The instance has an invalid beat value."); Assert.That(actual.SubBeatPart, Is.EqualTo(subBeat), "The instance has an invalid sub-beat value."); }
public void It_should_be_able_to_substract( int xBeat, long xSubPos, int xSubRes, int yBeat, long ySubPos, int ySubRes ) { var x = xBeat + new Rational(xSubPos, xSubRes); var y = yBeat + new Rational(ySubPos, ySubRes); Evaluate(x - y, out var beat, out var subBeat); var actual = BeatDuration.Of(xBeat, xSubPos, xSubRes) - BeatDuration.Of(yBeat, ySubPos, ySubRes) ; Assert.That(actual.BeatPart, Is.EqualTo(beat), "The instance has an invalid beat value."); Assert.That(actual.SubBeatPart, Is.EqualTo(subBeat), "The instance has an invalid sub-beat value."); }
/// <summary> /// Creates a new HoldNote instance. /// </summary> /// <param name="key">The key index the note is on.</param> /// <param name="beat">The beat the hold note starts.</param> /// <param name="length">The length of the hold note (in beats).</param> public HoldNote(KeyIndex key, Beat beat, BeatDuration length) : base(key, beat, length) { }
public BaseLongObject(KeyIndex key, Beat beat, BeatDuration length) : base(key, beat) { Length = length; }
public DummyLongObject(KeyIndex key, Beat beat, BeatDuration length) : base(key, beat, length) { }