notations 0.0.48 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/beats.d.ts +34 -69
- package/lib/cjs/beats.js +178 -439
- package/lib/cjs/beats.js.map +1 -1
- package/lib/cjs/beatutils.d.ts +3 -0
- package/lib/cjs/beatutils.js +64 -0
- package/lib/cjs/beatutils.js.map +1 -0
- package/lib/cjs/beatview.d.ts +18 -0
- package/lib/cjs/beatview.js +62 -0
- package/lib/cjs/beatview.js.map +1 -0
- package/lib/cjs/carnatic/LineView.d.ts +2 -7
- package/lib/cjs/carnatic/LineView.js +13 -31
- package/lib/cjs/carnatic/LineView.js.map +1 -1
- package/lib/cjs/carnatic/NotationView.d.ts +8 -7
- package/lib/cjs/carnatic/NotationView.js +73 -153
- package/lib/cjs/carnatic/NotationView.js.map +1 -1
- package/lib/cjs/carnatic/atomviews.js +149 -287
- package/lib/cjs/carnatic/atomviews.js.map +1 -1
- package/lib/cjs/carnatic/beatviews.d.ts +4 -13
- package/lib/cjs/carnatic/beatviews.js +23 -118
- package/lib/cjs/carnatic/beatviews.js.map +1 -1
- package/lib/cjs/carnatic/embelishments.d.ts +1 -1
- package/lib/cjs/carnatic/embelishments.js +189 -283
- package/lib/cjs/carnatic/embelishments.js.map +1 -1
- package/lib/cjs/carnatic/gamakas.js +15 -47
- package/lib/cjs/carnatic/gamakas.js.map +1 -1
- package/lib/cjs/commands.js +111 -271
- package/lib/cjs/commands.js.map +1 -1
- package/lib/cjs/core.d.ts +6 -1
- package/lib/cjs/core.js +288 -493
- package/lib/cjs/core.js.map +1 -1
- package/lib/cjs/cycle.js +175 -367
- package/lib/cjs/cycle.js.map +1 -1
- package/lib/cjs/entity.js +48 -102
- package/lib/cjs/entity.js.map +1 -1
- package/lib/cjs/grids.d.ts +124 -1
- package/lib/cjs/grids.js +546 -6
- package/lib/cjs/grids.js.map +1 -1
- package/lib/cjs/iterators.js +96 -234
- package/lib/cjs/iterators.js.map +1 -1
- package/lib/cjs/layouts.d.ts +1 -1
- package/lib/cjs/layouts.js +62 -98
- package/lib/cjs/layouts.js.map +1 -1
- package/lib/cjs/loader.d.ts +2 -2
- package/lib/cjs/loader.js +23 -123
- package/lib/cjs/loader.js.map +1 -1
- package/lib/cjs/notation.d.ts +0 -3
- package/lib/cjs/notation.js +139 -241
- package/lib/cjs/notation.js.map +1 -1
- package/lib/cjs/parser.d.ts +2 -0
- package/lib/cjs/parser.js +217 -219
- package/lib/cjs/parser.js.map +1 -1
- package/lib/cjs/shapes.js +149 -283
- package/lib/cjs/shapes.js.map +1 -1
- package/lib/cjs/utils.d.ts +8 -0
- package/lib/cjs/utils.js +60 -55
- package/lib/cjs/utils.js.map +1 -1
- package/lib/esm/beats.d.ts +34 -69
- package/lib/esm/beats.js +172 -438
- package/lib/esm/beats.js.map +1 -1
- package/lib/esm/beatutils.d.ts +3 -0
- package/lib/esm/beatutils.js +37 -0
- package/lib/esm/beatutils.js.map +1 -0
- package/lib/esm/beatview.d.ts +18 -0
- package/lib/esm/beatview.js +35 -0
- package/lib/esm/beatview.js.map +1 -0
- package/lib/esm/carnatic/LineView.d.ts +2 -7
- package/lib/esm/carnatic/LineView.js +12 -31
- package/lib/esm/carnatic/LineView.js.map +1 -1
- package/lib/esm/carnatic/NotationView.d.ts +8 -7
- package/lib/esm/carnatic/NotationView.js +71 -152
- package/lib/esm/carnatic/NotationView.js.map +1 -1
- package/lib/esm/carnatic/atomviews.js +144 -284
- package/lib/esm/carnatic/atomviews.js.map +1 -1
- package/lib/esm/carnatic/beatviews.d.ts +4 -13
- package/lib/esm/carnatic/beatviews.js +21 -94
- package/lib/esm/carnatic/beatviews.js.map +1 -1
- package/lib/esm/carnatic/embelishments.d.ts +1 -1
- package/lib/esm/carnatic/embelishments.js +187 -296
- package/lib/esm/carnatic/embelishments.js.map +1 -1
- package/lib/esm/carnatic/gamakas.js +14 -48
- package/lib/esm/carnatic/gamakas.js.map +1 -1
- package/lib/esm/commands.js +100 -271
- package/lib/esm/commands.js.map +1 -1
- package/lib/esm/core.d.ts +6 -1
- package/lib/esm/core.js +286 -502
- package/lib/esm/core.js.map +1 -1
- package/lib/esm/cycle.js +172 -367
- package/lib/esm/cycle.js.map +1 -1
- package/lib/esm/entity.js +48 -104
- package/lib/esm/entity.js.map +1 -1
- package/lib/esm/grids.d.ts +124 -1
- package/lib/esm/grids.js +515 -5
- package/lib/esm/grids.js.map +1 -1
- package/lib/esm/iterators.js +93 -235
- package/lib/esm/iterators.js.map +1 -1
- package/lib/esm/layouts.d.ts +1 -1
- package/lib/esm/layouts.js +60 -97
- package/lib/esm/layouts.js.map +1 -1
- package/lib/esm/loader.d.ts +2 -2
- package/lib/esm/loader.js +20 -120
- package/lib/esm/loader.js.map +1 -1
- package/lib/esm/notation.d.ts +0 -3
- package/lib/esm/notation.js +135 -242
- package/lib/esm/notation.js.map +1 -1
- package/lib/esm/parser.d.ts +2 -0
- package/lib/esm/parser.js +211 -214
- package/lib/esm/parser.js.map +1 -1
- package/lib/esm/shapes.js +148 -288
- package/lib/esm/shapes.js.map +1 -1
- package/lib/esm/utils.d.ts +8 -0
- package/lib/esm/utils.js +55 -51
- package/lib/esm/utils.js.map +1 -1
- package/package.json +2 -1
package/lib/cjs/beats.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beats.js","sourceRoot":"","sources":["../../src/beats.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAuC;AACvC,uBAA8D;AAE9D,yCAAuD;AAIvD,IAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;AACnC,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;AAoBjC;IASE,cACkB,KAAa,EACb,IAAU,EACV,MAAgB,EAChB,QAAkB,EAClB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AAC,IAAI,CAAC,EAAE,qEAAqE,CAAC,CAAC;oBACtG,IAAI,IAAI,CAAC,WAAW;wBAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;iBACxD;;;;;;;;;YACD,IAAI,QAAQ,CAAC,MAAM,EAAE;gBACnB,IAAI,IAAI,CAAC,YAAY;oBAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;aACpD;SACF;IACH,CAAC;IACH,mBAAC;AAAD,CAAC,AA1FD,IA0FC;AA1FY,oCAAY","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { AtomType, Group, Line, Atom, Space, Role } from \"./\";\nimport { CycleIterator, CyclePosition } from \"./cycle\";\nimport { FlatAtom, WindowIterator } from \"./iterators\";\nimport { LayoutParams } from \"./layouts\";\n\ntype Fraction = TSU.Num.Fraction;\nconst ZERO = TSU.Num.Fraction.ZERO;\nconst ONE = TSU.Num.Fraction.ONE;\n\ninterface BeatViewDelegate {\n // A way to create all beats for an entire Line in one go (instead of one by one)\n viewForBeat(beat: Beat): BeatView;\n}\n\nexport interface BeatView {\n readonly beat: Beat;\n readonly needsLayout: boolean;\n readonly minSize: TSU.Geom.Size;\n readonly bbox: TSU.Geom.Rect;\n x: number;\n y: number;\n width: number;\n height: number;\n refreshLayout(): void;\n setStyles(config: any): void;\n}\n\nexport class Beat {\n private static idCounter = 0;\n layoutLine = -1;\n layoutColumn = -1;\n readonly uuid = Beat.idCounter++;\n // Should this be as flat Atoms or should we keep it as atoms and breakdown\n // later?\n atom: Atom;\n protected atomIsPlaceholder = false;\n constructor(\n public readonly index: number,\n public readonly role: Role,\n public readonly offset: Fraction,\n public readonly duration: Fraction,\n public readonly barIndex: number,\n public readonly beatIndex: number,\n public readonly instance: number,\n public readonly prevBeat: null | Beat,\n public nextBeat: null | Beat,\n ) {}\n\n debugValue(): any {\n return {\n index: this.index,\n role: this.role.name,\n offset: this.offset.toString(),\n duration: this.duration.toString(),\n barIndex: this.barIndex,\n beatIndex: this.beatIndex,\n instance: this.instance,\n atom: this.atom.debugValue(),\n };\n }\n\n get endOffset(): Fraction {\n return this.offset.plus(this.duration);\n }\n\n get filled(): boolean {\n return this.remaining.isZero;\n }\n\n get remaining(): Fraction {\n return this.atom ? this.duration.minus(this.atom.duration, true) : this.duration;\n }\n\n add(atom: Atom): boolean {\n if (this.remaining.cmp(atom.duration) < 0) {\n return false;\n }\n if (!this.atom) {\n this.atom = atom;\n } else {\n if (!this.atomIsPlaceholder) {\n this.atomIsPlaceholder = true;\n this.atom = new Group(this.atom).setDuration(ONE, true);\n }\n (this.atom as Group).addAtoms(true, atom);\n }\n return true;\n }\n\n ensureUniformSpaces(atoms: FlatAtom[], slotsPerBeat = 1): void {\n let lcm = 1;\n let gcd = 0;\n atoms.forEach((a, index) => {\n a.duration = a.duration.factorized;\n const currDen = a.duration.den;\n if (currDen != 1) {\n lcm *= currDen;\n if (gcd == 0) {\n gcd = a.duration.den;\n } else {\n gcd = TSU.Num.gcdof(gcd, currDen);\n lcm /= gcd;\n }\n }\n });\n\n // Easiest option is (without worrying about depths)\n // just adding this N number 1 / LCM sized spaces for\n // each note where N = (LCM / note.frac.den) - 1\n\n // eg in the case of something like (a beat with) the notes\n // A: 1/2, B: 1/4, C: 1/6\n // LCM (of dens) = 24\n // 12 (1/24) spaces, 6 (1/24)\n // A = (24 / 2) - 1 = 11 spaces after A\n // B = (24 / 4) - 1 = 5 spaces after B\n // C = (24 / 6) - 1 = 3 spaces after C\n // Total = 11 + 5 + 3 + 3 (for A + B + C) = 22 notes in the beat\n\n const baseDur = new TSU.Num.Fraction(1, lcm);\n let currOffset = this.offset;\n for (let i = 0; i < atoms.length; ) {\n const fa = atoms[i];\n const numSpaces = lcm == 1 ? fa.duration.num - 1 : lcm / fa.duration.den - 1;\n // reset its duration to 1 / LCM so we can add numSpaces after it\n fa.duration = baseDur;\n currOffset = currOffset.plus(baseDur);\n i++;\n for (let j = 0; j < numSpaces; j++, i++) {\n const space = new Space(baseDur);\n space.isContinuation = true;\n atoms.splice(i, 0, new FlatAtom(space));\n atoms.splice(i, 0, new FlatAtom(space));\n currOffset = currOffset.plus(baseDur);\n }\n }\n }\n}\n\n/**\n * Grouping of beats by their column based on the layout params.\n * The confusion is we have beats broken up and saved in columns\n * but we are loosing how a line is supposed to access it in its own way\n * we have beatsByRole for getting all beats for a role (in a line)\n * sequentially we have beatColumns for getting all beats in a particular\n * column across all lines and roles globally.\n *\n * What we want here is for a given line get all roles, their beats\n * in zipped way. eg for a Line with 3 roles and say 10 beats each\n * (with the breaks of 4, 1) we need:\n *\n * R1 B1 R1 B2 R1 B3 R1 B4\n * R2 B1 R2 B2 R2 B3 R2 B4\n * R3 B1 R3 B2 R3 B3 R3 B4\n *\n * R1 B5\n * R2 B5\n * R3 B5\n *\n * R1 B6 R1 B7 R1 B8 R1 B9\n * R2 B6 R2 B7 R2 B8 R2 B9\n * R3 B6 R3 B7 R3 B8 R3 B9\n *\n * R1 B10\n * R2 B10\n * R3 B10\n *\n *\n * Here we have 5 distinct beat columns:\n *\n * 1: R1B1, R2B1, R3B1, R1B6, R2B6, R3B6,\n * 2: R1B2, R2B2, R3B2, R1B7, R2B7, R3B7,\n * 3: R1B3, R2B3, R3B3, R1B8, R2B8, R3B8,\n * 4: R1B4, R2B4, R3B4, R1B9, R2B9, R3B9,\n * 5: R1B5, R2B5, R3B5, R1B10, R2B10, R3B10,\n *\n */\nexport class BeatLayout {\n // beatColumns[i][j] returns all beats in a particular layoutLine and\n // layoutColumn the purpose of beatColumns is to ensure horizontal alignment\n // of beats in a single column\n bcolNextList = new Map<string, Set<string>>();\n beatColumns = new Map<string, BeatColumn>();\n // bcolsStartingAt = new Map<string, BeatColumn[]>();\n // bcolsEndingAt = new Map<string, BeatColumn[]>();\n startingColumns: BeatColumn[] = [];\n\n // Mapping from beat -> BeatColumn where it resides\n columnForBeat = new Map<number, BeatColumn>();\n\n constructor(public readonly layoutParams: LayoutParams) {}\n\n /**\n * Gets the beat column of a given duration at the given offset.\n */\n getBeatColumn(offset: Fraction, duration: Fraction): BeatColumn {\n const key = BeatLayout.keyFor(offset, duration);\n let bcol = this.beatColumns.get(key) || null;\n if (!bcol) {\n bcol = new BeatColumn(offset, duration);\n this.beatColumns.set(key, bcol);\n if (bcol.offset.isZero) {\n // this is a \"starting\" column\n this.startingColumns.push(bcol);\n } else {\n const endOffset = offset.plus(duration);\n // Find all columns \"before\" this and add this as a neighbour to those\n // columsn before are such that their prev.offset + prev.duration == bcol.offset\n for (const other of this.beatColumns.values()) {\n if (other.offset.plus(other.duration).equals(offset)) {\n // mark us as a successor of other\n this.addSuccessor(other, bcol);\n } else if (other.offset.equals(endOffset)) {\n // mark other as a successor of us\n this.addSuccessor(bcol, other);\n }\n }\n\n // Similary find all columns who could \"next\" sets and add us to them\n }\n }\n return bcol;\n }\n\n protected static keyFor(offset: Fraction, duration: Fraction): string {\n return offset.factorized.toString() + \":\" + duration.factorized.toString();\n }\n\n protected addSuccessor(prev: BeatColumn, next: BeatColumn): void {\n TSU.assert(prev.offset.plus(prev.duration).equals(next.offset), \"BeatColumns are not adjacent to each other\");\n const prevKey = BeatLayout.keyFor(prev.offset, prev.duration);\n const nextKey = BeatLayout.keyFor(next.offset, next.duration);\n let nextset = this.bcolNextList.get(prevKey) || null;\n if (!nextset) {\n nextset = new Set<string>();\n this.bcolNextList.set(prevKey, nextset);\n }\n nextset.add(nextKey);\n }\n\n /**\n * Adds the beat to this layout and returns the BeatColumn to which this beat was added.\n */\n addBeat(beat: Beat): BeatColumn {\n // Get the beat column at this index (and line) and add to it.\n const lp = this.layoutParams;\n const [layoutLine, layoutColumn, rowOffset] = lp.getBeatLocation(beat);\n const bcol = this.getBeatColumn(rowOffset, beat.duration);\n\n bcol.add(beat);\n\n // TODO: see if beat exists in another column\n this.columnForBeat.set(beat.uuid, bcol);\n beat.layoutLine = layoutLine;\n beat.layoutColumn = layoutColumn;\n return bcol;\n }\n\n /**\n * Return all beat columns that start immediately after the given beat column.\n */\n neighborsOf(beatColumn: BeatColumn): BeatColumn[] {\n const out: BeatColumn[] = [];\n const endOffset = beatColumn.offset.plus(beatColumn.duration);\n for (const other of this.beatColumns.values()) {\n if (endOffset.equals(other.offset)) {\n out.push(other);\n }\n }\n return out;\n }\n\n readonly DEBUG = false;\n evalColumnSizes(beatViewDelegate: BeatViewDelegate): void {\n // Do a bread first traversal of the beat columns so those with earlier offsets\n // will be laid out and nudged so that later ones' offsets can be set only once.\n // TODO - should this be a priority queue - ie is there a need to sort these by\n // \"larger\" widths first?\n let queue: BeatColumn[] = [...this.startingColumns];\n const xForOffsets: TSU.StringMap<number> = {};\n while (queue.length > 0) {\n const nextQueue: BeatColumn[] = [];\n for (const bcol of queue) {\n const offset = bcol.offset.factorized;\n const colWidth = bcol.evalMaxWidth(beatViewDelegate);\n let currX = 0;\n if (!bcol.offset.isZero) {\n // this *must* be in xForOffsets as it would have been calculated by a previous bcol\n TSU.assert(offset.toString() in xForOffsets, \"Cannot find x for given offset\");\n currX = xForOffsets[offset.toString()];\n }\n bcol.setX(currX, beatViewDelegate);\n const endOffset = offset.plus(bcol.duration, true);\n xForOffsets[endOffset.toString()] = Math.max(\n xForOffsets[endOffset.toString()] || 0,\n currX + colWidth + bcol.paddingLeft + bcol.paddingRight,\n );\n // add all neighbours here\n // TODO - Use better lists of going through all beat cols\n // Also ensure we are adding in sorted order and avoiding duplicates\n for (const other of this.beatColumns.values()) {\n if (endOffset.equals(other.offset)) {\n nextQueue.push(other);\n }\n }\n }\n queue = nextQueue;\n }\n }\n\n // Spacing between each role in a single row\n roleSpacing = 10;\n\n // Spacing between each row (a row can consist of multiple roles).\n rowSpacing = 15;\n layoutBeatsForLine(line: Line, allRoleBeats: Beat[][], beatViewDelegate: BeatViewDelegate): void {\n // Instead of starting currLayoutLine at 0 - it should start at the line of the\n // first beat being rendered\n const lp = this.layoutParams;\n const currBeats = line.roles.map((l, index) => allRoleBeats[index][0]) as (Beat | null)[];\n let currY = this.roleSpacing;\n let numDone = 0;\n do {\n numDone = 0;\n // Lay one role at a time upto numBeatsInLine number of beats\n for (let currRole = 0; currRole < currBeats.length; currRole++) {\n let currBeat: Beat | null = currBeats[currRole];\n if (currBeat) {\n const temp = currBeat;\n const numBeatsInRow = lp.lineBreaks[currBeat.layoutLine];\n let maxHeight = 0;\n let currX = 15;\n for (\n let i = currBeat.layoutColumn;\n i < numBeatsInRow && currBeat;\n i++, currBeat = currBeat.nextBeat, numDone++\n ) {\n const beatView = beatViewDelegate.viewForBeat(currBeat);\n beatView.y = currY;\n if (this.DEBUG) {\n beatView.x = currX;\n beatView.refreshLayout();\n currX += beatView.width;\n }\n maxHeight = Math.max(maxHeight, beatView.minSize.height);\n }\n\n currBeat = temp;\n for (\n let i = currBeat.layoutColumn;\n i < numBeatsInRow && currBeat;\n i++, currBeat = currBeat.nextBeat, numDone++\n ) {\n const beatView = beatViewDelegate.viewForBeat(currBeat);\n beatView.height = maxHeight;\n }\n // Should line heights be \"fixed\"?\n // Set height of all views in this row to same height and Y\n currY += maxHeight;\n currY += this.roleSpacing;\n }\n currBeats[currRole] = currBeat;\n }\n\n // currLayoutLine = (currLayoutLine + 1) % lp.lineBreaks.length;\n currY += this.rowSpacing;\n } while (numDone > 0);\n }\n}\n\nexport class BeatRow {\n protected _y = 0;\n protected _maxHeight = 0;\n needsLayout = false;\n rowSpacing = 5;\n beats: Beat[] = [];\n constructor(public readonly layoutLine: number, public rowIndex: number) {}\n\n get y(): number {\n return this._y;\n }\n\n set y(val: number) {\n this._y = val;\n this.needsLayout = true;\n }\n\n add(beat: Beat): void {\n // Find line this view should be added to.\n // TODO - Should we check if this beat was already added to either this row or another row?\n this.beats.push(beat);\n this.needsLayout = true;\n }\n}\n\nexport class BeatColumn {\n protected _x = 0;\n protected _maxWidth = 0;\n needsLayout = false;\n atomSpacing = 5;\n paddingLeft = 15;\n paddingRight = 15;\n beats: Beat[] = [];\n constructor(public readonly offset: Fraction, public readonly duration: Fraction) {\n offset = offset.factorized;\n duration = duration.factorized;\n }\n\n get x(): number {\n return this._x;\n }\n\n setX(val: number, beatViewDelegate: BeatViewDelegate): void {\n this._x = val;\n for (const beat of this.beats) {\n const beatView = beatViewDelegate.viewForBeat(beat);\n beatView.x = val + this.paddingLeft;\n beatView.width = this._maxWidth;\n // console.log(\"ID, Setting x, width: \", beatView.beat.index, (beatView as any).x, (beatView as any).width);\n }\n }\n\n get maxWidth(): number {\n return this._maxWidth + this.paddingLeft + this.paddingRight;\n }\n\n setPadding(left: number, right: number): void {\n if (left >= 0) {\n this.paddingLeft = left;\n }\n if (right >= 0) {\n this.paddingRight = right;\n }\n }\n\n evalMaxWidth(beatViewDelegate: BeatViewDelegate): number {\n this._maxWidth = 0;\n for (const beat of this.beats) {\n const beatView = beatViewDelegate.viewForBeat(beat);\n // console.log( \"index, _minSize, refreshMinSize = \", beatView.beat.index, (beatView as any)._minSize, (beatView as any).refreshMinSize(),);\n const minSize = beatView.minSize;\n if (minSize.width > this._maxWidth) {\n this._maxWidth = minSize.width;\n }\n }\n return this._maxWidth;\n }\n\n /**\n * Adds a new beat to this column.\n * Returns true if the column's width has increased. This is an indicator\n * to the caller that a layout of all other views in this column is needed\n * so the refresh can be scheduled at some time.\n */\n add(beat: Beat): void {\n // Find line this view should be added to.\n // TODO - Should we check if this beat was already added?\n this.beats.push(beat);\n this.needsLayout = true;\n }\n}\n\nexport class BeatsBuilder {\n // All atoms divided into beats\n readonly beats: Beat[] = [];\n readonly startIndex: number;\n readonly beatOffset: Fraction;\n cycleIter: CycleIterator;\n windowIter: WindowIterator;\n\n // Callback for when an atom is added to this role.\n onAtomAdded: (atom: Atom, beat: Beat) => void;\n\n // Callback for when a new beat is added\n onBeatAdded: (beat: Beat) => void;\n // Callback for when a beat has been filled\n onBeatFilled: (beat: Beat) => void;\n\n constructor(\n public readonly role: Role,\n public readonly layoutParams: LayoutParams,\n public readonly startOffset: Fraction = ZERO,\n ) {\n const [, [bar, beat, instance], beatOffset, index] = layoutParams.cycle.getPosition(startOffset);\n this.cycleIter = layoutParams.cycle.iterateBeats(bar, beat, instance);\n this.windowIter = new WindowIterator();\n this.beatOffset = beatOffset;\n\n // evaluate the start beatindex - typically it would be 0 if things start at beginning\n // of a cycle. Butif the start offset is < 0 then the startIndex should also shift\n // accordingly\n this.startIndex = index;\n }\n\n protected addBeat(): Beat {\n const numBeats = this.beats.length;\n const lastBeat = numBeats == 0 ? null : this.beats[numBeats - 1];\n const nextCP: [CyclePosition, Fraction] = this.cycleIter.next().value;\n const apb = this.layoutParams.beatDuration;\n const newBeat = new Beat(\n lastBeat == null ? this.startIndex : lastBeat.index + 1,\n this.role,\n lastBeat == null ? this.startOffset.minus(this.beatOffset).timesNum(apb, true) : lastBeat.endOffset,\n nextCP[1].timesNum(apb),\n nextCP[0][0],\n nextCP[0][1],\n nextCP[0][2],\n lastBeat,\n null,\n );\n if (lastBeat == null && this.beatOffset.isGT(ZERO)) {\n // Add spaces to fill up empty beats\n newBeat.add(new Space(this.beatOffset.timesNum(apb)));\n }\n if (lastBeat) lastBeat.nextBeat = newBeat;\n this.beats.push(newBeat);\n if (this.onBeatAdded) this.onBeatAdded(newBeat);\n return newBeat;\n }\n\n addAtoms(...atoms: Atom[]): void {\n // First add all atoms to the atom Iterator so we can\n // fetch them as FlatAtoms. This is needed because atoms\n // passed here could be unflatted (via groups) or much larger\n // than what can fit in the given role/bar etc. So this\n // flattening and windowing is needed before we add them\n // to the views - and this is done by the durationIterators.\n this.windowIter.push(...atoms);\n while (this.windowIter.hasMore) {\n // get the last/current row and add a new one if it is full\n let currBeat = this.beats[this.beats.length - 1];\n\n // First add a row if last row is filled\n if (this.beats.length == 0 || currBeat.filled) {\n // what should be the beatlengths be here?\n currBeat = this.addBeat();\n }\n\n // For this beat get symbols in all roles\n const [remAtoms, filled] = this.windowIter.get(currBeat.remaining);\n TSU.assert(remAtoms.length > 0, \"Atleast one element should have been available here\");\n // render the atoms now\n for (const atom of remAtoms) {\n // console.log(\"Adding FA: \", flatAtom.debugValue(), flatAtom.atom);\n TSU.assert(currBeat.add(atom), \"Should return true as we are already using a duration iterator here\");\n if (this.onAtomAdded) this.onAtomAdded(atom, currBeat);\n }\n if (currBeat.filled) {\n if (this.onBeatFilled) this.onBeatFilled(currBeat);\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"beats.js","sourceRoot":"","sources":["../../src/beats.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,yBAAoD;AAEpD,2CAA6C;AAE7C,mCAAkF;AAGlF,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;AACnC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;AAEjC,MAAa,IAAI;IASf,YACkB,KAAa,EACb,IAAU,EACV,MAAgB,EAChB,QAAkB,EAClB,QAAgB,EAChB,SAAiB,EACjB,QAAgB,EAChB,QAAqB,EAC9B,QAAqB;QARZ,UAAK,GAAL,KAAK,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAM;QACV,WAAM,GAAN,MAAM,CAAU;QAChB,aAAQ,GAAR,QAAQ,CAAU;QAClB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,cAAS,GAAT,SAAS,CAAQ;QACjB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,aAAQ,GAAR,QAAQ,CAAa;QAC9B,aAAQ,GAAR,QAAQ,CAAa;QAhBrB,SAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QACjC,eAAU,GAAG,CAAC,CAAC,CAAC;QAChB,iBAAY,GAAG,CAAC,CAAC,CAAC;QAIR,sBAAiB,GAAG,KAAK,CAAC;IAWjC,CAAC;IAEJ,UAAU;QACR,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;YACpB,MAAM,EAAE,IAAI,CAAC,MAA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AClF,MAAM,IAAI,GAAG,IAAI,gBAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YACxC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvFD,4CAuFC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Group, Line, Atom, Space, Role } from \"./\";\nimport { CycleIterator, CyclePosition } from \"./cycle\";\nimport { WindowIterator } from \"./iterators\";\nimport { LayoutParams } from \"./layouts\";\nimport { GridModel, GridRow, GridCell, ColAlign, GridLayoutGroup } from \"./grids\";\n\ntype Fraction = TSU.Num.Fraction;\nconst ZERO = TSU.Num.Fraction.ZERO;\nconst ONE = TSU.Num.Fraction.ONE;\n\nexport class Beat {\n private static idCounter = 0;\n readonly uuid = Beat.idCounter++;\n layoutLine = -1;\n layoutColumn = -1;\n // Should this be as flat Atoms or should we keep it as atoms and breakdown\n // later?\n atom: Atom;\n protected atomIsPlaceholder = false;\n constructor(\n public readonly index: number,\n public readonly role: Role,\n public readonly offset: Fraction,\n public readonly duration: Fraction,\n public readonly barIndex: number,\n public readonly beatIndex: number,\n public readonly instance: number,\n public readonly prevBeat: null | Beat,\n public nextBeat: null | Beat,\n ) {}\n\n debugValue(): any {\n return {\n index: this.index,\n role: this.role.name,\n offset: this.offset.toString(),\n duration: this.duration.toString(),\n barIndex: this.barIndex,\n beatIndex: this.beatIndex,\n instance: this.instance,\n atom: this.atom.debugValue(),\n };\n }\n\n get endOffset(): Fraction {\n return this.offset.plus(this.duration);\n }\n get filled(): boolean {\n return this.remaining.isZero;\n }\n\n get remaining(): Fraction {\n return this.atom ? this.duration.minus(this.atom.duration, true) : this.duration;\n }\n\n add(atom: Atom): boolean {\n if (this.remaining.cmp(atom.duration) < 0) {\n return false;\n }\n if (!this.atom) {\n this.atom = atom;\n } else {\n if (!this.atomIsPlaceholder) {\n this.atomIsPlaceholder = true;\n this.atom = new Group(this.atom).setDuration(ONE, true);\n }\n (this.atom as Group).addAtoms(true, atom);\n }\n return true;\n }\n}\n\nexport class BeatsBuilder {\n // All atoms divided into beats\n readonly beats: Beat[] = [];\n readonly startIndex: number;\n readonly beatOffset: Fraction;\n cycleIter: CycleIterator;\n windowIter: WindowIterator;\n\n // Callback for when an atom is added to this role.\n onAtomAdded: (atom: Atom, beat: Beat) => void;\n\n // Callback for when a new beat is added\n onBeatAdded: (beat: Beat) => void;\n // Callback for when a beat has been filled\n onBeatFilled: (beat: Beat) => void;\n\n constructor(\n public readonly role: Role,\n public readonly layoutParams: LayoutParams,\n public readonly startOffset: Fraction = ZERO,\n ...atoms: Atom[]\n ) {\n const [, [bar, beat, instance], beatOffset, index] = layoutParams.cycle.getPosition(startOffset);\n this.cycleIter = layoutParams.cycle.iterateBeats(bar, beat, instance);\n this.windowIter = new WindowIterator();\n this.beatOffset = beatOffset;\n\n // evaluate the start beatindex - typically it would be 0 if things start\n // at beginning of a cycle. But if the start offset is < 0 then the\n // startIndex should also shift accordingly\n this.startIndex = index;\n this.addAtoms(...atoms);\n }\n\n addAtoms(...atoms: Atom[]): void {\n // First add all atoms to the atom Iterator so we can\n // fetch them as FlatAtoms. This is needed because atoms\n // passed here could be unflatted (via groups) or much larger\n // than what can fit in the given role/bar etc. So this\n // flattening and windowing is needed before we add them\n // to the views - and this is done by the durationIterators.\n this.windowIter.push(...atoms);\n while (this.windowIter.hasMore) {\n // get the last/current row and add a new one if it is full\n let currBeat = this.beats[this.beats.length - 1];\n\n // First add a row if last row is filled\n if (this.beats.length == 0 || currBeat.filled) {\n // what should be the beatlengths be here?\n currBeat = this.addBeat();\n }\n\n // For this beat get symbols in all roles\n const [remAtoms, filled] = this.windowIter.get(currBeat.remaining);\n TSU.assert(remAtoms.length > 0, \"Atleast one element should have been available here\");\n // render the atoms now\n for (const atom of remAtoms) {\n // console.log(\"Adding FA: \", flatAtom.debugValue(), flatAtom.atom);\n TSU.assert(currBeat.add(atom), \"Should return true as we are already using a duration iterator here\");\n if (this.onAtomAdded) this.onAtomAdded(atom, currBeat);\n }\n if (currBeat.filled) {\n if (this.onBeatFilled) this.onBeatFilled(currBeat);\n }\n }\n }\n\n protected addBeat(): Beat {\n const numBeats = this.beats.length;\n const lastBeat = numBeats == 0 ? null : this.beats[numBeats - 1];\n const nextCP: [CyclePosition, Fraction] = this.cycleIter.next().value;\n const apb = this.layoutParams.beatDuration;\n const newBeat = new Beat(\n lastBeat == null ? this.startIndex : lastBeat.index + 1,\n this.role,\n lastBeat == null ? this.startOffset.minus(this.beatOffset).timesNum(apb, true) : lastBeat.endOffset,\n nextCP[1].timesNum(apb),\n nextCP[0][0],\n nextCP[0][1],\n nextCP[0][2],\n lastBeat,\n null,\n );\n if (lastBeat == null && this.beatOffset.isGT(ZERO)) {\n // Add spaces to fill up empty beats\n newBeat.add(new Space(this.beatOffset.timesNum(apb)));\n }\n if (lastBeat) lastBeat.nextBeat = newBeat;\n this.beats.push(newBeat);\n if (this.onBeatAdded) this.onBeatAdded(newBeat);\n return newBeat;\n }\n}\n\nexport class BeatColumn extends ColAlign {\n atomSpacing = 5;\n readonly key: string;\n constructor(\n public readonly offset: Fraction,\n public readonly endOffset: Fraction,\n public readonly markerType: number,\n ) {\n super();\n offset = offset.factorized;\n endOffset = endOffset.factorized;\n this.key = BeatColumn.keyFor(offset, endOffset, markerType);\n }\n\n static keyFor(offset: Fraction, endOffset: Fraction, markerType = 0): string {\n offset = offset.factorized;\n endOffset = endOffset.factorized;\n if (markerType < 0) {\n // return the column for the marker \"before\" this col\n // int his case only the \"start offset\" is needed and length doesnt matter\n return \":\" + offset.toString();\n } else if (markerType > 0) {\n // return the column for the marker \"after\" this col\n // in this case only thd end offset matters\n return endOffset.toString() + \":\";\n } else {\n return offset.toString() + \":\" + endOffset.toString();\n }\n }\n}\n\n/**\n * Grouping of beats by their column based on the layout params.\n * The confusion is we have beats broken up and saved in columns\n * but we are loosing how a line is supposed to access it in its own way\n * we have beatsByRole for getting all beats for a role (in a line)\n * sequentially we have beatColumns for getting all beats in a particular\n * column across all lines and roles globally.\n *\n * What we want here is for a given line get all roles, their beats\n * in zipped way. eg for a Line with 3 roles and say 10 beats each\n * (with the breaks of 4, 1) we need:\n *\n * R1 B1 R1 B2 R1 B3 R1 B4\n * R2 B1 R2 B2 R2 B3 R2 B4\n * R3 B1 R3 B2 R3 B3 R3 B4\n *\n * R1 B5\n * R2 B5\n * R3 B5\n *\n * R1 B6 R1 B7 R1 B8 R1 B9\n * R2 B6 R2 B7 R2 B8 R2 B9\n * R3 B6 R3 B7 R3 B8 R3 B9\n *\n * R1 B10\n * R2 B10\n * R3 B10\n *\n *\n * Here we have 5 distinct beat columns:\n *\n * 1: R1B1, R2B1, R3B1, R1B6, R2B6, R3B6,\n * 2: R1B2, R2B2, R3B2, R1B7, R2B7, R3B7,\n * 3: R1B3, R2B3, R3B3, R1B8, R2B8, R3B8,\n * 4: R1B4, R2B4, R3B4, R1B9, R2B9, R3B9,\n * 5: R1B5, R2B5, R3B5, R1B10, R2B10, R3B10,\n *\n */\nexport class BeatColDAG {\n beatColumns = new Map<string, BeatColumn>();\n\n constructor(public readonly layoutGroup: GridLayoutGroup) {\n //\n }\n\n /**\n * Gets the beat column of a given duration at the given offset.\n */\n getBeatColumn(offset: Fraction, endOffset: Fraction, markerType = 0): BeatColumn {\n const [bcol, newcreated] = this.ensureBeatColumn(offset, endOffset, markerType);\n if (newcreated) {\n if (markerType == 0) {\n const [prevcol] = this.ensureBeatColumn(offset, endOffset, -1);\n const [nextcol] = this.ensureBeatColumn(offset, endOffset, 1);\n prevcol.addSuccessor(bcol);\n bcol.addSuccessor(nextcol);\n for (const other of this.beatColumns.values()) {\n // only join the \"marker\" columns\n if (other.markerType == -1 && endOffset.equals(other.offset)) {\n // our next col is a preecessor of other\n nextcol.addSuccessor(other);\n } else if (other.markerType == 1 && other.endOffset.equals(offset)) {\n // our prev col is a predecessor of other\n other.addSuccessor(prevcol);\n }\n }\n }\n }\n return bcol;\n }\n\n protected ensureBeatColumn(offset: Fraction, endOffset: Fraction, markerType = 0): [BeatColumn, boolean] {\n const key = BeatColumn.keyFor(offset, endOffset, markerType);\n let bcol = this.beatColumns.get(key) || null;\n const newcreated = bcol == null;\n if (!bcol) {\n bcol = new BeatColumn(offset, endOffset, markerType);\n this.beatColumns.set(key, bcol);\n }\n return [bcol, newcreated];\n }\n}\n\n/**\n * Manages the beat layouts for *all* lines in a notation.\n */\ntype LineId = number;\ntype LPID = number;\nexport class GlobalBeatLayout {\n gridModelsForLine = new Map<LineId, GridModel>();\n roleBeatsForLine = new Map<LineId, Beat[][]>();\n beatColDAGsByLP = new Map<LPID, BeatColDAG>();\n readonly gridLayoutGroup = new GridLayoutGroup();\n\n /**\n * Get the GridView associated with a particular line.\n */\n getGridModelForLine(lineid: LineId): GridModel {\n let out = this.gridModelsForLine.get(lineid) || null;\n if (!out) {\n out = new GridModel();\n this.gridLayoutGroup.addGridModel(out);\n this.gridModelsForLine.set(lineid, out);\n }\n return out;\n }\n\n protected beatColDAGForLP(lpid: LPID): BeatColDAG {\n let out = this.beatColDAGsByLP.get(lpid) || null;\n if (!out) {\n out = new BeatColDAG(this.gridLayoutGroup);\n this.beatColDAGsByLP.set(lpid, out);\n }\n return out;\n }\n\n /**\n * First lines are added to the BeatLayout object.\n * This ensures that a line is broken down into beats and added\n * into a dedicated GridModel per line.\n *\n * A line must also be given the layout params by which the beat\n * break down will happen. This LayoutParams object does not have\n * to be unique per line (this non-constraint allows to align\n * beats across lines!).\n */\n addLine(line: Line): void {\n const gridModel = this.getGridModelForLine(line.uuid) as GridModel;\n gridModel.eventHub?.startBatchMode();\n this.lineToRoleBeats(line, gridModel);\n gridModel.eventHub?.commitBatch();\n }\n\n protected lineToRoleBeats(line: Line, gridModel: GridModel): Beat[][] {\n const lp = line.layoutParams;\n const roleBeats = [] as Beat[][];\n this.roleBeatsForLine.set(line.uuid, roleBeats);\n const lineOffset = line.offset.divbyNum(lp.beatDuration);\n for (const role of line.roles) {\n const bb = new BeatsBuilder(role, lp, lineOffset, ...role.atoms);\n roleBeats.push(bb.beats);\n\n // Add these to the beat layout too\n for (const beat of bb.beats) {\n // beat.ensureUniformSpaces(layoutParams.beatDuration);\n this.addBeat(beat, gridModel);\n }\n }\n return roleBeats;\n }\n\n /**\n * Adds the beat to this layout and returns the BeatColumn to which\n * this beat was added.\n */\n protected addBeat(beat: Beat, gridModel: GridModel): GridCell {\n // Get the beat column at this index (and line) and add to it.\n const line = beat.role.line;\n const lp = line.layoutParams;\n const beatColDAG = this.beatColDAGForLP(lp.uuid);\n const [layoutLine, layoutColumn, rowOffset] = lp.getBeatLocation(beat);\n const colEnd = rowOffset.plus(beat.duration, true);\n const bcol = beatColDAG.getBeatColumn(rowOffset, colEnd, 0);\n\n // Since a beat's column has a \"pre\" and \"post\" col to, each\n // beat has 3 columns for it\n const roleIndex = beat.role.line.indexOfRole(beat.role.name);\n const realRow = line.roles.length * (layoutLine + Math.floor(beat.index / lp.totalBeats)) + roleIndex;\n const realCol = layoutColumn * 3;\n return gridModel.setValue(realRow, realCol, beat, (gridRow: GridRow, col: number) => {\n const cell = new GridCell(gridRow, col);\n cell.colAlign = bcol;\n return cell;\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ensureUniformSpaces = void 0;
|
|
27
|
+
const TSU = __importStar(require("@panyam/tsutils"));
|
|
28
|
+
const _1 = require("./");
|
|
29
|
+
const iterators_1 = require("./iterators");
|
|
30
|
+
function ensureUniformSpaces(currOffset, atoms, slotsPerBeat = 1) {
|
|
31
|
+
let lcm = 1;
|
|
32
|
+
let gcd = 0;
|
|
33
|
+
atoms.forEach((a, index) => {
|
|
34
|
+
a.duration = a.duration.factorized;
|
|
35
|
+
const currDen = a.duration.den;
|
|
36
|
+
if (currDen != 1) {
|
|
37
|
+
lcm *= currDen;
|
|
38
|
+
if (gcd == 0) {
|
|
39
|
+
gcd = a.duration.den;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
gcd = TSU.Num.gcdof(gcd, currDen);
|
|
43
|
+
lcm /= gcd;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const baseDur = new TSU.Num.Fraction(1, lcm);
|
|
48
|
+
for (let i = 0; i < atoms.length;) {
|
|
49
|
+
const fa = atoms[i];
|
|
50
|
+
const numSpaces = lcm == 1 ? fa.duration.num - 1 : lcm / fa.duration.den - 1;
|
|
51
|
+
fa.duration = baseDur;
|
|
52
|
+
currOffset = currOffset.plus(baseDur);
|
|
53
|
+
i++;
|
|
54
|
+
for (let j = 0; j < numSpaces; j++, i++) {
|
|
55
|
+
const space = new _1.Space(baseDur);
|
|
56
|
+
space.isContinuation = true;
|
|
57
|
+
atoms.splice(i, 0, new iterators_1.FlatAtom(space));
|
|
58
|
+
atoms.splice(i, 0, new iterators_1.FlatAtom(space));
|
|
59
|
+
currOffset = currOffset.plus(baseDur);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.ensureUniformSpaces = ensureUniformSpaces;
|
|
64
|
+
//# sourceMappingURL=beatutils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beatutils.js","sourceRoot":"","sources":["../../src/beatutils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,yBAA2B;AAC3B,2CAAuC;AAEvC,SAAgB,mBAAmB,CAAC,UAA4B,EAAE,KAAiB,EAAE,YAAY,GAAG,CAAC;IACnG,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QACzB,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC;QACnC,MAAM,OAAO,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC/B,IAAI,OAAO,IAAI,CAAC,EAAE;YAChB,GAAG,IAAI,OAAO,CAAC;YACf,IAAI,GAAG,IAAI,CAAC,EAAE;gBACZ,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;aACtB;iBAAM;gBACL,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;gBAClC,GAAG,IAAI,GAAG,CAAC;aACZ;SACF;IACH,CAAC,CAAC,CAAC;IAeH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAI;QAClC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,SAAS,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC;QAE7E,EAAE,CAAC,QAAQ,GAAG,OAAO,CAAC;QACtB,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC,EAAE,CAAC;QACJ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;YACvC,MAAM,KAAK,GAAG,IAAI,QAAK,CAAC,OAAO,CAAC,CAAC;YACjC,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;YAC5B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,oBAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACxC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,oBAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACxC,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACvC;KACF;AACH,CAAC;AA9CD,kDA8CC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Space } from \"./\";\nimport { FlatAtom } from \"./iterators\";\n\nexport function ensureUniformSpaces(currOffset: TSU.Num.Fraction, atoms: FlatAtom[], slotsPerBeat = 1): void {\n let lcm = 1;\n let gcd = 0;\n atoms.forEach((a, index) => {\n a.duration = a.duration.factorized;\n const currDen = a.duration.den;\n if (currDen != 1) {\n lcm *= currDen;\n if (gcd == 0) {\n gcd = a.duration.den;\n } else {\n gcd = TSU.Num.gcdof(gcd, currDen);\n lcm /= gcd;\n }\n }\n });\n\n // Easiest option is (without worrying about depths)\n // just adding this N number 1 / LCM sized spaces for\n // each note where N = (LCM / note.frac.den) - 1\n\n // eg in the case of something like (a beat with) the notes\n // A: 1/2, B: 1/4, C: 1/6\n // LCM (of dens) = 24\n // 12 (1/24) spaces, 6 (1/24)\n // A = (24 / 2) - 1 = 11 spaces after A\n // B = (24 / 4) - 1 = 5 spaces after B\n // C = (24 / 6) - 1 = 3 spaces after C\n // Total = 11 + 5 + 3 + 3 (for A + B + C) = 22 notes in the beat\n\n const baseDur = new TSU.Num.Fraction(1, lcm);\n for (let i = 0; i < atoms.length; ) {\n const fa = atoms[i];\n const numSpaces = lcm == 1 ? fa.duration.num - 1 : lcm / fa.duration.den - 1;\n // reset its duration to 1 / LCM so we can add numSpaces after it\n fa.duration = baseDur;\n currOffset = currOffset.plus(baseDur);\n i++;\n for (let j = 0; j < numSpaces; j++, i++) {\n const space = new Space(baseDur);\n space.isContinuation = true;\n atoms.splice(i, 0, new FlatAtom(space));\n atoms.splice(i, 0, new FlatAtom(space));\n currOffset = currOffset.plus(baseDur);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AtomView, Embelishment, ElementShape } from "./shapes";
|
|
2
|
+
import { GridCell, GridCellView } from "./grids";
|
|
3
|
+
import { Cycle } from "./cycle";
|
|
4
|
+
import { Beat } from "./beats";
|
|
5
|
+
export declare abstract class BeatView extends ElementShape<SVGGElement> implements GridCellView {
|
|
6
|
+
readonly cell: GridCell;
|
|
7
|
+
readonly beat: Beat;
|
|
8
|
+
readonly rootElement: SVGGraphicsElement;
|
|
9
|
+
readonly cycle: Cycle;
|
|
10
|
+
private _embelishments;
|
|
11
|
+
atomView: AtomView;
|
|
12
|
+
needsLayout: boolean;
|
|
13
|
+
constructor(cell: GridCell, beat: Beat, rootElement: SVGGraphicsElement, cycle: Cycle, config?: any);
|
|
14
|
+
get embelishments(): Embelishment[];
|
|
15
|
+
setStyles(config: any): void;
|
|
16
|
+
protected abstract createEmbelishments(): Embelishment[];
|
|
17
|
+
protected abstract createAtomView(): AtomView;
|
|
18
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.BeatView = void 0;
|
|
27
|
+
const TSU = __importStar(require("@panyam/tsutils"));
|
|
28
|
+
const shapes_1 = require("./shapes");
|
|
29
|
+
class BeatView extends shapes_1.ElementShape {
|
|
30
|
+
constructor(cell, beat, rootElement, cycle, config) {
|
|
31
|
+
super(TSU.DOM.createSVGNode("g", {
|
|
32
|
+
parent: rootElement,
|
|
33
|
+
attrs: {
|
|
34
|
+
class: "beatView",
|
|
35
|
+
beatId: "" + beat.uuid,
|
|
36
|
+
id: "" + beat.uuid,
|
|
37
|
+
roleName: beat.role.name,
|
|
38
|
+
layoutLine: "" + beat.layoutLine,
|
|
39
|
+
layoutColumn: "" + beat.layoutColumn,
|
|
40
|
+
beatIndex: "" + beat.index,
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
this.cell = cell;
|
|
44
|
+
this.beat = beat;
|
|
45
|
+
this.rootElement = rootElement;
|
|
46
|
+
this.cycle = cycle;
|
|
47
|
+
this.needsLayout = true;
|
|
48
|
+
this.atomView = this.createAtomView();
|
|
49
|
+
this.atomView.refreshLayout();
|
|
50
|
+
}
|
|
51
|
+
get embelishments() {
|
|
52
|
+
if (!this._embelishments) {
|
|
53
|
+
this._embelishments = this.createEmbelishments();
|
|
54
|
+
}
|
|
55
|
+
return this._embelishments;
|
|
56
|
+
}
|
|
57
|
+
setStyles(config) {
|
|
58
|
+
this.needsLayout = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.BeatView = BeatView;
|
|
62
|
+
//# sourceMappingURL=beatview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beatview.js","sourceRoot":"","sources":["../../src/beatview.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,qCAAgE;AAKhE,MAAsB,QAAS,SAAQ,qBAAyB;IAI9D,YACkB,IAAc,EACd,IAAU,EACV,WAA+B,EAC/B,KAAY,EAC5B,MAAY;QAEZ,KAAK,CACH,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE;YACzB,MAAM,EAAE,WAAW;YACnB,KAAK,EAAE;gBACL,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI;gBACtB,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI;gBAClB,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;gBACxB,UAAU,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU;gBAChC,YAAY,EAAE,EAAE,GAAG,IAAI,CAAC,YAAY;gBACpC,SAAS,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK;aAC3B;SACF,CAAC,CACH,CAAC;QAnBc,SAAI,GAAJ,IAAI,CAAU;QACd,SAAI,GAAJ,IAAI,CAAM;QACV,gBAAW,GAAX,WAAW,CAAoB;QAC/B,UAAK,GAAL,KAAK,CAAO;QAL9B,gBAAW,GAAG,IAAI,CAAC;QAsBjB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QACtC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,aAAa;QACf,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACxB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;SAClD;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,MAAW;QACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;CAIF;AA1CD,4BA0CC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { AtomView, Embelishment, ElementShape } from \"./shapes\";\nimport { GridCell, GridCellView } from \"./grids\";\nimport { Cycle } from \"./cycle\";\nimport { Beat } from \"./beats\";\n\nexport abstract class BeatView extends ElementShape<SVGGElement> implements GridCellView {\n private _embelishments: Embelishment[];\n atomView: AtomView;\n needsLayout = true;\n constructor(\n public readonly cell: GridCell,\n public readonly beat: Beat,\n public readonly rootElement: SVGGraphicsElement,\n public readonly cycle: Cycle,\n config?: any,\n ) {\n super(\n TSU.DOM.createSVGNode(\"g\", {\n parent: rootElement,\n attrs: {\n class: \"beatView\",\n beatId: \"\" + beat.uuid,\n id: \"\" + beat.uuid,\n roleName: beat.role.name,\n layoutLine: \"\" + beat.layoutLine,\n layoutColumn: \"\" + beat.layoutColumn,\n beatIndex: \"\" + beat.index,\n },\n }),\n );\n this.atomView = this.createAtomView();\n this.atomView.refreshLayout();\n }\n\n get embelishments(): Embelishment[] {\n if (!this._embelishments) {\n this._embelishments = this.createEmbelishments();\n }\n return this._embelishments;\n }\n\n setStyles(config: any): void {\n this.needsLayout = true;\n }\n\n protected abstract createEmbelishments(): Embelishment[];\n protected abstract createAtomView(): AtomView;\n}\n"]}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import * as TSU from "@panyam/tsutils";
|
|
2
|
-
import {
|
|
3
|
-
import { BeatView } from "./beatviews";
|
|
2
|
+
import { GridModel } from "../grids";
|
|
4
3
|
import { Line } from "../core";
|
|
5
4
|
export declare class LineView {
|
|
6
5
|
readonly rootElement: SVGSVGElement;
|
|
7
6
|
line: Line;
|
|
8
7
|
readonly config?: any;
|
|
9
|
-
|
|
10
|
-
beatLayout: BeatLayout;
|
|
8
|
+
gridModel: GridModel;
|
|
11
9
|
gElem: SVGGElement;
|
|
12
10
|
roleSpacing: number;
|
|
13
11
|
rowSpacing: number;
|
|
14
12
|
constructor(rootElement: SVGSVGElement, line: Line, config?: any);
|
|
15
|
-
protected loadChildViews(): void;
|
|
16
13
|
wrapToSize(): void;
|
|
17
14
|
get prefSize(): TSU.Geom.Size;
|
|
18
|
-
beatViews: Map<number, BeatView>;
|
|
19
|
-
viewForBeat(beat: Beat): BeatView;
|
|
20
15
|
}
|
|
@@ -24,19 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.LineView = void 0;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function LineView(rootElement, line, config) {
|
|
27
|
+
const TSU = __importStar(require("@panyam/tsutils"));
|
|
28
|
+
class LineView {
|
|
29
|
+
constructor(rootElement, line, config) {
|
|
31
30
|
this.rootElement = rootElement;
|
|
32
31
|
this.line = line;
|
|
33
32
|
this.config = config;
|
|
34
33
|
this.roleSpacing = 20;
|
|
35
34
|
this.rowSpacing = 10;
|
|
36
|
-
this.beatViews = new Map();
|
|
37
|
-
this.loadChildViews();
|
|
38
|
-
}
|
|
39
|
-
LineView.prototype.loadChildViews = function () {
|
|
40
35
|
this.gElem = TSU.DOM.createSVGNode("g", {
|
|
41
36
|
parent: this.rootElement,
|
|
42
37
|
attrs: {
|
|
@@ -44,30 +39,17 @@ var LineView = (function () {
|
|
|
44
39
|
id: "lineRoot" + this.line.uuid,
|
|
45
40
|
},
|
|
46
41
|
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
}
|
|
43
|
+
wrapToSize() {
|
|
44
|
+
const bbox = this.gElem.getBBox();
|
|
50
45
|
this.rootElement.setAttribute("width", "" + (4 + bbox.width));
|
|
51
46
|
this.rootElement.setAttribute("height", "" + (15 + bbox.height));
|
|
52
|
-
this.gElem.setAttribute("transform",
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
enumerable: false,
|
|
60
|
-
configurable: true
|
|
61
|
-
});
|
|
62
|
-
LineView.prototype.viewForBeat = function (beat) {
|
|
63
|
-
if (!this.beatViews.has(beat.uuid)) {
|
|
64
|
-
var b = new beatviews_1.BeatView(beat, this.gElem, this.beatLayout.layoutParams.cycle);
|
|
65
|
-
this.beatViews.set(beat.uuid, b);
|
|
66
|
-
return b;
|
|
67
|
-
}
|
|
68
|
-
return this.beatViews.get(beat.uuid);
|
|
69
|
-
};
|
|
70
|
-
return LineView;
|
|
71
|
-
}());
|
|
47
|
+
this.gElem.setAttribute("transform", `translate(${4 - bbox.x}, ${4 - bbox.y})`);
|
|
48
|
+
}
|
|
49
|
+
get prefSize() {
|
|
50
|
+
const bbox = this.rootElement.getBBox();
|
|
51
|
+
return new TSU.Geom.Size(4 + bbox.width, 4 + bbox.height);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
72
54
|
exports.LineView = LineView;
|
|
73
55
|
//# sourceMappingURL=LineView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineView.js","sourceRoot":"","sources":["../../../src/carnatic/LineView.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"LineView.js","sourceRoot":"","sources":["../../../src/carnatic/LineView.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AAIvC,MAAa,QAAQ;IAYnB,YAA4B,WAA0B,EAAS,IAAU,EAAkB,MAAY;QAA3E,gBAAW,GAAX,WAAW,CAAe;QAAS,SAAI,GAAJ,IAAI,CAAM;QAAkB,WAAM,GAAN,MAAM,CAAM;QALvG,gBAAW,GAAG,EAAE,CAAC;QAGjB,eAAU,GAAG,EAAE,CAAC;QAId,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE;YACtC,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,KAAK,EAAE;gBACL,KAAK,EAAE,UAAU;gBACjB,EAAE,EAAE,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI;aAChC;SACF,CAAgB,CAAC;IACpB,CAAC;IAED,UAAU;QACR,MAAM,IAAI,GAAI,IAAI,CAAC,KAAuB,CAAC,OAAO,EAAE,CAAC;QAErD,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9D,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAClF,CAAC;IAED,IAAI,QAAQ;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAExC,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;CACF;AApCD,4BAoCC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { GridModel } from \"../grids\";\nimport { Line } from \"../core\";\n\nexport class LineView {\n // The beat layout associated with the layout params of this Line\n // at this point beats have already been added to the right columns\n gridModel: GridModel;\n gElem: SVGGElement;\n\n // Space between two roles (within the same row)\n roleSpacing = 20;\n\n // Vertical space between two rows (of multiple roles)\n rowSpacing = 10;\n\n constructor(public readonly rootElement: SVGSVGElement, public line: Line, public readonly config?: any) {\n // create the gElem for wrapping and adjusting to size\n this.gElem = TSU.DOM.createSVGNode(\"g\", {\n parent: this.rootElement,\n attrs: {\n class: \"lineRoot\",\n id: \"lineRoot\" + this.line.uuid,\n },\n }) as SVGGElement;\n }\n\n wrapToSize(): void {\n const bbox = (this.gElem as SVGSVGElement).getBBox();\n // set the size of the svg\n this.rootElement.setAttribute(\"width\", \"\" + (4 + bbox.width));\n this.rootElement.setAttribute(\"height\", \"\" + (15 + bbox.height));\n this.gElem.setAttribute(\"transform\", `translate(${4 - bbox.x}, ${4 - bbox.y})`);\n }\n\n get prefSize(): TSU.Geom.Size {\n const bbox = this.rootElement.getBBox();\n // return new TSU.Geom.Size(4 + bbox.width + bbox.x, 4 + bbox.y + bbox.height);\n return new TSU.Geom.Size(4 + bbox.width, 4 + bbox.height);\n }\n}\n"]}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import * as TSU from "@panyam/tsutils";
|
|
2
2
|
import { LineView } from "./LineView";
|
|
3
3
|
import { Notation, RawBlock } from "../notation";
|
|
4
|
-
import {
|
|
4
|
+
import { GlobalBeatLayout } from "../beats";
|
|
5
|
+
import { GridCell } from "../grids";
|
|
5
6
|
import { Line } from "../core";
|
|
7
|
+
import { BeatView } from "./beatviews";
|
|
6
8
|
export declare class NotationView {
|
|
7
9
|
readonly rootElement: HTMLElement;
|
|
8
10
|
readonly config?: any;
|
|
9
11
|
headerElement: HTMLDivElement;
|
|
10
12
|
notation: Notation;
|
|
11
13
|
lineViews: LineView[];
|
|
12
|
-
beatsByLineRole: Map<number, Beat[][]>;
|
|
13
|
-
beatLayouts: Map<number, BeatLayout>;
|
|
14
14
|
currentSVGElement: SVGSVGElement | null;
|
|
15
15
|
tableElement: HTMLTableElement;
|
|
16
|
-
beatViews: Map<number, BeatView>;
|
|
17
16
|
markdownParser: (contents: string) => string;
|
|
17
|
+
_beatLayout: GlobalBeatLayout;
|
|
18
18
|
constructor(rootElement: HTMLElement, config?: any);
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
get beatLayout(): GlobalBeatLayout;
|
|
20
|
+
set beatLayout(beatLayout: GlobalBeatLayout);
|
|
21
21
|
loadChildViews(): void;
|
|
22
22
|
addNewRow(id: string, prefix: string, withAnnotation?: boolean): [HTMLElement, HTMLElement];
|
|
23
23
|
newLineRoot(parent: Element, line: Line): SVGSVGElement;
|
|
@@ -26,6 +26,7 @@ export declare class NotationView {
|
|
|
26
26
|
get currentLineView(): LineView;
|
|
27
27
|
clear(): void;
|
|
28
28
|
refreshLayout(): void;
|
|
29
|
-
renderLine(line: Line): LineView;
|
|
30
29
|
renderBlock(raw: RawBlock): void;
|
|
30
|
+
beatViews: Map<number, BeatView>;
|
|
31
|
+
viewForBeat(cell: GridCell): BeatView;
|
|
31
32
|
}
|