Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | import React from "react"; import { PatternCell } from "shared/lib/uge/types"; import { PIANO_ROLL_CELL_SIZE, TOTAL_NOTES, TRACKER_PATTERN_LENGTH, } from "consts"; import { StyledPianoRollNote, StyledPatternChannelNotes } from "./style"; interface PatternChannelNotesProps { channelId: number; isActive: boolean; sequenceId: number; pattern: PatternCell[][]; selectedPatternCells: number[]; isDragging: boolean; } const ARPEGGIO_CODE = 0; const noteBottom = (note: number) => (note % TOTAL_NOTES) * PIANO_ROLL_CELL_SIZE; export const PatternChannelNotes = React.memo( ({ channelId, isActive, sequenceId, pattern, selectedPatternCells, isDragging, }: PatternChannelNotesProps) => { let instrument: number | null = null; return ( <StyledPatternChannelNotes $active={isActive}> {pattern?.map((column, columnIdx) => { const cell = column[channelId]; Iif (!cell || cell.note === null) return null; const absoluteColumn = sequenceId * TRACKER_PATTERN_LENGTH + columnIdx; const isSelected = isActive && selectedPatternCells.indexOf(absoluteColumn) !== -1; Iif (cell.instrument !== null) { instrument = cell.instrument; } const noteInstrument = instrument !== null && isActive ? instrument : undefined; const usingPreviousInstrument = cell.instrument === null && instrument !== null; const left = columnIdx * PIANO_ROLL_CELL_SIZE; const effect = cell.effectparam ?? 0; return ( <React.Fragment key={`note_${columnIdx}_${channelId}`}> <StyledPianoRollNote data-type="note" data-note={cell.note} data-column={columnIdx} $instrument={noteInstrument} $usingPreviousInstrument={usingPreviousInstrument} $isSelected={isSelected} $isDragging={isDragging} style={{ left, bottom: noteBottom(cell.note), }} /> {cell.effectcode === ARPEGGIO_CODE && ( <> <StyledPianoRollNote data-param={effect >> 4} $instrument={noteInstrument} $usingPreviousInstrument={usingPreviousInstrument} $isVirtual style={{ left, bottom: noteBottom(cell.note + (effect >> 4)), }} /> <StyledPianoRollNote data-param={effect & 0xf} $instrument={noteInstrument} $usingPreviousInstrument={usingPreviousInstrument} $isVirtual style={{ left, bottom: noteBottom(cell.note + (effect & 0xf)), }} /> </> )} </React.Fragment> ); })} </StyledPatternChannelNotes> ); }, ); |