Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demonstrate sequencer bugs #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Tests/AudioKitEXTests/SequencerEngineTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,32 @@ class SequencerEngineTests: XCTestCase {
XCTAssertEqual(events.map { $0.timeStamp }, [0, 157, 34, 191, 136, 37, 170, 71, 16, 173, 50, 207, 152, 53, 186, 87, 32, 189, 66, 223])
}

func testLoopLongNote() {
var seq = NoteEventSequence()

// Our test will loop 4 beats. Try to loop a note that is longer.
seq.add(noteNumber: 60, position: 0, duration: 5.0)

// Each render call will generate one beat. Render two bars.
let events = observerTest(sequence: seq, frameCount: 22050, renderCallCount: 8)

// We exepct an even number of note events!
XCTAssertEqual(events.count, 4)
}

func testLoopNoteNearEnd() {
var seq = NoteEventSequence()

// Our test will loop 4 beats. Extend a note beyond the bar.
seq.add(noteNumber: 60, position: 3, duration: 2.0)

// Each render call will generate one beat. Render two bars.
let events = observerTest(sequence: seq, frameCount: 22050, renderCallCount: 8)

// We exepct an even number of note events!
XCTAssertEqual(events.count, 4)
}

func testOverlap() {

var seq = NoteEventSequence()
Expand Down