feat: honor MIDI input notes' velocity during recording

This commit is contained in:
Xiaohan-Tian
2026-05-04 19:34:54 -07:00
parent 066946ea64
commit d089456676
7 changed files with 101 additions and 35 deletions
@@ -13,6 +13,7 @@ import { useNoteOperations } from '../../hooks/useNoteOperations';
import { useNoteSelection } from '../../hooks/useNoteSelection';
import type { KeySignature } from '../../core/KGProject';
import type { KGAudioRegion } from '../../core/region/KGAudioRegion';
import { velocityToColor } from '../../util/velocityColor';
interface PianoRollContentProps {
contentRef: React.MutableRefObject<HTMLDivElement | null>;
@@ -259,6 +260,8 @@ const PianoRollContent: React.FC<PianoRollContentProps> = ({
top: (107 - note.pitch) * noteHeight,
width: Math.max((note.endBeat - note.startBeat) * beatWidth, 4),
height: noteHeight,
backgroundColor: velocityToColor(note.velocity, 0.35),
borderColor: velocityToColor(note.velocity, 0.85),
}}
/>
));
@@ -311,4 +314,4 @@ const PianoRollContent: React.FC<PianoRollContentProps> = ({
);
};
export default PianoRollContent;
export default PianoRollContent;