blob: 5a9542267bdfca858cc2c38e5d86c38d2d844f66 [file] [log] [blame]
{
"name": "MIDIPianoRollView",
"version": "0.0.1",
"summary": "Customisable UIScrollView subclass for rendering/editing MIDI notes on a piano roll view.",
"swift_version": "4.2",
"description": "MIDIPianoRollView\n====\n\nCustomisable UIScrollView subclass for rendering/editing MIDI notes on a piano roll view.\n\nDemo\n----\n\n![alt tag](https://github.com/cemolcay/MIDIPianoRollView/raw/master/demo.gif)\n\nRequirements\n----\n\n* iOS 9.0+\n* Swift 4.2+\n* Xcode 10.0+\n\n\nUsage\n----\n\nCreate a `MIDIPianoRollView` either from storyboard (subclass from `UIScrollView`) or programmatically.\n\n#### `MIDIPianoRollView.Keys`\n\n- An enum that represents the data source of the piano roll's keys.\n- It can be either\n- A range of `UInt8` MIDI notes like `30...50` (30th note to 50th note)\n- A `Scale` of notes between specified octave range\n- Or custom unordered pitches.\n\n#### `MIDIPianoRollView.Bars`\n\n- An enum that represents the bar count on the piano roll.\n- It can be either\n- A fixed value by `.fixed(barCount)`\n- Or `.auto` that auto-caluclating bar count by the data source.\n\n#### `MIDIPianoRollNote`\n\n- Set the `notes` data source array in order to pop the notes.\n- It is a `[MIDIPianoRollNote]` array that has the start position, duration, midi note and velocity data for each note.\n\n#### `MIDIPianoRollPosition`\n\n- This represents the both position and duration values for the notes on the piano roll. Contains `bar`, `beat`, `subbeat` and `cent` values.\n- Each of them are `Int` and confomrs to `Comparable`, `Equatable`, `Codable` and custom `+` and `-` operatros.\n- Each `bar` has a number of `beat`s that the piano roll's `timesingature` has.\n- Each `beat` has 4 `subbeat`s.\n- Each `subbeat` has 240 `cent`s for fine tuning.\n\n#### `MIDIPianoRollCellView`\n\n- Each cell on the piano roll is a subclass of the `MIDIPianoRollCellView`.\n- You can basically create your custom cell view by subclassing it.\n\n#### `MIDIPianoRollRowView`\n\n- Each key view on the right side of the piano roll is a subclass of `MIDIPianoRollRowView`.\n- You can create your custom sublass may be with some piano key images and render it on the piano roll.\n\n#### `MIDIPianoRollMeasureView`\n\n- Measure is a custom view with bunch of `CALayer`s that rendering the position texts and guide lines.\n- You can set grid line width and colors.\n- You can set measure position label font and text colors.\n- If you don't want to render measure, then you can set the `isMeasureEnabled` property to false.\n\n#### `MIDIPianoRollView.ZoomLevel`\n\n- Zoom level represents the currently rendering beat value on the piano roll.\n- It has a customisable `minZoomLevel` and `maxZoomLevel` range.\n- Each zoom level have note rate, for example,\n- `.halfNotes` means a bar have 2 beats with 2 half notes,\n- `.quarterNotes` means a bar have 4 beats with 4 quarter notes.\n- If `isZoomingEnabled` is set true, then you can horizontally pinch-to-zoom in or out between customisable `minBeatWidth` and `maxBeatWidth` values to set current `beatWidth`.\n- When a `beatWidth` hits the limit, the zoom level advances the next level depending on the zooming in or out.\n- You can disable this behaviour by setting `isZoomingEnabled` property to false.\n- The same behavior also controls the row height zooming. If you vertically pinch-to-zoom, then current `rowHeight` will scale between `minRowHeight` and `maxRowHeight` properties.\n\n#### `MIDIPianoRollView.GridLine`\n\n- Contains line properties for grid line styling.\n- You can set each line's width, color or dash pattern styling.\n\n#### Editing\n\n- You can enter the cell editing mode by setting `isEditing` property to true.\n- When you are in the edit mode, you can not scroll the view but you can pan the cells to move or resize.\n- You can enable/disable the multiple editing by setting the `isMultipleEditingEnabled` property to true.\n- When it's enabled, you can drag your finger to render a multiple selection view to select all cells that under the drag-to-select box.\n- Then you can move or resize the selected cells.\n- When editing is done, piano roll will informs its delegate.\n\n#### `MIDIPianoRollViewDelegate`\n\n- Informs the delegate when the cell is edited.\n- You can update your `notes` data source in the delegate calls.\n\n``` swift\nfunc midiPianoRollView(_ midiPianoRollView: MIDIPianoRollView,\ndidMove cellView: MIDIPianoRollCellView,\nto newPosition: MIDIPianoRollPosition,\npitch: UInt8)\n```\n\n- Informs delegate about that the cell is moved a new position and/or row.\n- You can use the `pitch` value to determine which row is the cell moved.\n\n\n``` swift\nfunc midiPianoRollView(_ midiPianoRollView: MIDIPianoRollView,\ndidResize cellView: MIDIPianoRollCellView,\nto newDuration: MIDIPianoRollPosition)\n```\n\n- Informs delegate about that the cell's duration changed.\n- Called when cell is resized.\n\n``` swift\nfunc midiPianoRollViewMultipleEditingDraggingView(_ midiPianoRollView: MIDIPianoRollView) -> UIView?\n```\n\n- Return a custom UIView if you want to render your custom drag-to-select view.\n\n#### Example Project\n\n- Check out the example project for getting more information about the implementation.\n\n\nDocumentation\n----\n\nYou can find the documentation [here](https://cemolcay.github.io/MIDIPianoRollView).",
"homepage": "https://github.com/cemolcay/MIDIPianoRollView",
"license": "MIT",
"authors": {
"cemolcay": "ccemolcay@gmail.com"
},
"platforms": {
"ios": "9.0"
},
"source": {
"git": "https://github.com/cemolcay/MIDIPianoRollView.git",
"tag": "0.0.1"
},
"source_files": "MIDIPianoRollView/Source/*.swift",
"requires_arc": true,
"dependencies": {
"MusicTheorySwift": [
]
}
}