Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emurray2 committed Dec 25, 2021
1 parent f57e4c8 commit fc4d3aa
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions Sources/AudioKitUI/Controls/MIDITrackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,8 @@
// Copyright AudioKit. All Rights Reserved. Revision History at https://github.com/AudioKit/AudioKitUI/
import SwiftUI
import AudioKit
import UIKit

// This class will need a re-work -- will push a commit to AudioKit/AudioKit soon
extension MIDIFileTrackNoteMap {
public func getNoteList() -> [MIDINoteDuration] {
return self.noteList
}
public func getLowNote(noteList: [MIDINoteDuration]) -> Int {
if noteList.count >= 2 {
return (noteList.min(by: { $0.noteNumber < $1.noteNumber })?.noteNumber) ?? 0
} else {
return 0
}
}
public func getHiNote(noteList: [MIDINoteDuration]) -> Int {
if noteList.count >= 2 {
return (noteList.max(by: { $0.noteNumber < $1.noteNumber })?.noteNumber) ?? 0
} else {
return 0
}
}
}
struct NoteGroup: UIViewRepresentable {
@Binding var isPlaying: Bool
@Binding var sequencerTempo: Double
Expand All @@ -47,9 +28,9 @@ struct NoteGroup: UIViewRepresentable {
uiView.frame.origin.x -= 1
}
func populateViewNotes(_ uiView: UIView, context: Context) {
let noteList = noteMap.getNoteList()
let low = noteMap.getLowNote(noteList: noteList)
let high = noteMap.getHiNote(noteList: noteList)
let noteList = noteMap.noteList
let low = noteMap.loNote
let high = noteMap.hiNote
let range = (high - low) + 1
let noteh = trackHeight / CGFloat(range)
let maxh = trackHeight - noteh
Expand Down

0 comments on commit fc4d3aa

Please sign in to comment.