From d4859bd7ab4ba482451bbffd439de8608f4bfa89 Mon Sep 17 00:00:00 2001 From: "prompt.ac/@jeffrey" Date: Thu, 30 Apr 2026 05:44:09 -0700 Subject: [PATCH] =?UTF-8?q?slab/menuband:=200.6=20=E2=80=94=20voice=20pale?= =?UTF-8?q?tte=20LCD=20+=20qwerty=20map=20+=20dark=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Voice palette - Voice title typeset in YWFT Processing Bold (bundled in Resources/, registered at launch via CTFontManagerRegisterFontsForURL). Adapts text color + drop shadow per appearance — dark voices brighten in dark mode, light voices darken in light mode, with a contrast shadow always present so the title pops on any backdrop. - Held notes are floating boxes (no surrounding bezel), centered above the visualizer in the voice's family color. Reserved row stays put when no notes are held so the layout doesn't wobble. - Voice-number subscript on the menubar music-note icon: tiny digits in the bottom-right corner, first digit anchored at the corner, multi-digit values flow rightward into a reserved 12 px pad. Hover pill + click hit area cover the whole icon + badge as one target. Skipped for program 0 (default Acoustic Grand) so unmodified state stays uncluttered. Menubar piano - Dark-mode aware: white keys flip to a soft macOS dark-gray (white 0.20 / 0.13), black keys flip to a brighter accent. Groove darkens. White-key letter labels flip too (light text on dark caps in dark mode). Lit (active) state stays accent across both modes. - Octave-shift slide: the WHOLE board scrolls left/right past the menubar slot in two phases (off → re-enter from opposite side) when the user shifts octave. Octave UP slides left (camera pans toward higher notes); DOWN slides right. 340 ms, linear. - Music-note glyph flashes (blends toward white) on every fresh note hit (peak 0.7) and on every octave change (peak 1.0), decaying over 180 ms. Reads as activity feedback without being noisy. QWERTY layout view - New panel above the arrow-keys cluster — three-row macOS keyboard drawn as keycaps. Each cap colored by its mapped piano note: white- mapped letters wear near-white caps with dark glyphs; black-mapped letters wear near-black caps with white glyphs. Octave-shifter letters get a muted accent fill (notepat = ,/. ; Ableton = z/x). Held key codes light to accent. Inverts piano-key color conventions intentionally so the keymap reads as "which physical keys play piano keys." Arrow keys cluster - MacBook-style four-keycap D-pad in the bottom-right of the palette panel. ↑ alone on top, ◀▼▶ in the bottom row. Hover rollover highlights individual keys; click drives the same selection path the keyboard arrows do (preview note while held, commit on release). Per-direction lighting from physical arrow keys too. Visualizer - RMS-per-bar (was peak) + asymmetric temporal smoothing kills the rolling motion. Segmented LED-meter look: 10 stacked LED segments per bar in a dark bezel housing, per-segment glow, full-fill spells "MIDI" in dot-matrix when MIDI mode is on (system accent color). Bezel border tracks the chosen voice's hue (or accent in MIDI). Hold-to-ramp octave shift - ,/. keys shift octave; holding either ramps after a 280 ms hesitation at 160 ms intervals. Each step plays a percussive Tambourine click whose velocity scales with the new octave so the audible weight of each notch is distinct without being tonal. Layout / labels - "Ableton MIDI Keys" → "Ableton Computer Keyboard", canonical Ableton logo (drawn from the SVG path the kidlisp.com editor uses). - Notepat.com mode button uses the live notepat.com favicon (NotepatFavicon: lazy-fetched + cached in Application Support, refreshed every 24h, observers re-bind via NotificationCenter). - "Keyboard Shortcuts" → "Layout"; Layout block lives below the voice palette + arrow keys instead of above. - About paragraph: "Menu Band brings the built-in macOS instruments into the menu bar." (bold "Menu Band"). - Voice palette cells are chiclet keycaps with family-tinted outlines + per-program shading (each of 128 voices a distinct shade within its family). Drag stays seamless (no gaps); click commits + auto-disables MIDI so the audition note sounds. - Arrow-key navigation on the voice grid (auto-repeat suppressed — one tap = one cell). Non-arrow keys forwarded to handleLocalKey so notepat letter keys still play notes while the popover holds key focus. Misc - LocalKeyCapture: panel doesn't steal key when popover is already the key window — popover stays visually active (controls don't dim into inactive state) while letter capture still works via app-level local monitor. - QWERTY-position panning ported from notepat native: physical keyboard column → MIDI CC10 pan. Sent to local synth + outbound MIDI before each note-on. - Stable kMIDIPropertyUniqueID on the virtual MIDI source so DAW routing survives reinstalls. - Letter ghost rewritten as physics: per-cell alphas smooth toward targets every tick (asymmetric attack/decay rates). No snap on fresh keypress mid-decay. Co-Authored-By: Claude Opus 4.7 (1M context) --- slab/menuband/Info.plist | 52 +-- slab/menuband/Package.swift | 5 +- .../Sources/MenuBand/AbletonLogo.swift | 35 ++ .../Sources/MenuBand/AppDelegate.swift | 171 ++++++- .../Sources/MenuBand/ArrowKeysIndicator.swift | 125 +++-- .../MenuBand/KeyboardIconRenderer.swift | 147 +++++- .../Sources/MenuBand/LocalKeyCapture.swift | 13 +- .../Sources/MenuBand/MenuBandController.swift | 92 ++++ .../Sources/MenuBand/MenuBandMIDI.swift | 13 + .../Sources/MenuBand/MenuBandPopover.swift | 438 +++++++++++++++--- .../Sources/MenuBand/NotepatFavicon.swift | 79 ++++ .../Sources/MenuBand/QwertyLayoutView.swift | 241 ++++++++++ .../Resources/ywft-processing-bold.ttf | Bin 0 -> 38304 bytes .../Resources/ywft-processing-regular.ttf | Bin 0 -> 36012 bytes .../Sources/MenuBand/WaveformView.swift | 65 ++- 15 files changed, 1328 insertions(+), 148 deletions(-) create mode 100644 slab/menuband/Sources/MenuBand/AbletonLogo.swift create mode 100644 slab/menuband/Sources/MenuBand/NotepatFavicon.swift create mode 100644 slab/menuband/Sources/MenuBand/QwertyLayoutView.swift create mode 100644 slab/menuband/Sources/MenuBand/Resources/ywft-processing-bold.ttf create mode 100644 slab/menuband/Sources/MenuBand/Resources/ywft-processing-regular.ttf diff --git a/slab/menuband/Info.plist b/slab/menuband/Info.plist index 89c1d2e6ec..af970f8c9b 100644 --- a/slab/menuband/Info.plist +++ b/slab/menuband/Info.plist @@ -2,31 +2,31 @@ - CFBundleIdentifier - computer.aestheticcomputer.menuband - CFBundleExecutable - MenuBand - CFBundleName - Menu Band - CFBundleDisplayName - Menu Band - CFBundlePackageType - APPL - CFBundleVersion - 5 - CFBundleShortVersionString - 0.5 - CFBundleInfoDictionaryVersion - 6.0 - CFBundleIconFile - AppIcon - LSMinimumSystemVersion - 11.0 - LSUIElement - - NSHighResolutionCapable - - NSHumanReadableCopyright - By aesthetic.computer + CFBundleDisplayName + Menu Band + CFBundleExecutable + MenuBand + CFBundleIconFile + AppIcon + CFBundleIdentifier + computer.aestheticcomputer.menuband + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Menu Band + CFBundlePackageType + APPL + CFBundleShortVersionString + 0.6 + CFBundleVersion + 6 + LSMinimumSystemVersion + 11.0 + LSUIElement + + NSHighResolutionCapable + + NSHumanReadableCopyright + By aesthetic.computer diff --git a/slab/menuband/Package.swift b/slab/menuband/Package.swift index 99d4e092a1..e6323abc07 100644 --- a/slab/menuband/Package.swift +++ b/slab/menuband/Package.swift @@ -7,7 +7,10 @@ let package = Package( targets: [ .executableTarget( name: "MenuBand", - path: "Sources/MenuBand" + path: "Sources/MenuBand", + resources: [ + .process("Resources"), + ] ), ] ) diff --git a/slab/menuband/Sources/MenuBand/AbletonLogo.swift b/slab/menuband/Sources/MenuBand/AbletonLogo.swift new file mode 100644 index 0000000000..0f1545d053 --- /dev/null +++ b/slab/menuband/Sources/MenuBand/AbletonLogo.swift @@ -0,0 +1,35 @@ +import AppKit + +/// Programmatically draws the canonical Ableton logo (the same SVG +/// glyph the kidlisp.com editor uses for its Ableton boot screen): +/// four 3×24 vertical bars on the left, four 24×3 horizontal bars +/// on the right, total 51×24. Returns it as a template-rendered +/// NSImage so AppKit tints it with the surrounding label color. +enum AbletonLogo { + /// Build a fresh NSImage at the requested height, preserving the + /// 51:24 aspect ratio. Used for the popover's "Layout" mode + /// button. + static func image(height: CGFloat) -> NSImage { + let aspect: CGFloat = 51.0 / 24.0 + let size = NSSize(width: height * aspect, height: height) + let img = NSImage(size: size) + img.lockFocusFlipped(true) + NSColor.labelColor.setFill() + let scale = height / 24.0 + // Vertical bars: 3 wide, 24 tall, at x = 0, 6, 12, 18. + for x in stride(from: 0.0, through: 18.0, by: 6.0) { + NSRect(x: x * scale, y: 0, + width: 3 * scale, height: 24 * scale).fill() + } + // Horizontal bars: 24 wide, 3 tall, at y = 0, 7, 14, 21, + // anchored to x = 27. lockFocusFlipped(true) means y=0 is + // the TOP of the image — same orientation as the SVG. + for y in stride(from: 0.0, through: 21.0, by: 7.0) { + NSRect(x: 27 * scale, y: y * scale, + width: 24 * scale, height: 3 * scale).fill() + } + img.unlockFocus() + img.isTemplate = true + return img + } +} diff --git a/slab/menuband/Sources/MenuBand/AppDelegate.swift b/slab/menuband/Sources/MenuBand/AppDelegate.swift index 3ac1ddbfe2..430cefba08 100644 --- a/slab/menuband/Sources/MenuBand/AppDelegate.swift +++ b/slab/menuband/Sources/MenuBand/AppDelegate.swift @@ -44,6 +44,20 @@ final class AppDelegate: NSObject, NSApplicationDelegate { /// retreats inward (far cells fade first, the pivot last). private var letterPivot: UInt8 = 60 private var letterFadeTimer: Timer? + + // Menubar-icon "activity" animation: a brief horizontal slide of + // the piano + a flash of the music-note glyph whenever the user + // shifts octave or plays a note. Driven by a single 60 Hz timer + // that runs only while either effect is in progress. + private var lastKnownOctaveShift: Int = 0 + private var lastLitCount: Int = 0 + private var slideDirection: Int = 0 + private var slideStartedAt: CFTimeInterval = 0 + private var flashStrength: CGFloat = 0 + private var flashStartedAt: CFTimeInterval = 0 + private var iconAnimTimer: Timer? + private static let slideDuration: CFTimeInterval = 0.34 + private static let flashDuration: CFTimeInterval = 0.18 /// Per-MIDI displayed alpha. Each tick we smooth this value /// toward the cell's target — so transitions are organic /// regardless of when keys are pressed (no snap when the user @@ -69,15 +83,49 @@ final class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ notification: Notification) { debugLog("applicationDidFinishLaunching pid=\(ProcessInfo.processInfo.processIdentifier)") + Self.registerBundledFonts() Timer.scheduledTimer(withTimeInterval: 5.0, repeats: true) { _ in debugLog("heartbeat") } menuBand.onChange = { [weak self] in - DispatchQueue.main.async { self?.updateIcon() } + DispatchQueue.main.async { + guard let self = self else { return } + // Trigger the slide + flash whenever the octave shift + // changes — acts as the visual feedback for the + // ,/. keys (or popover stepper). Direction matches + // the change so up=right, down=left. + let cur = self.menuBand.octaveShift + if cur != self.lastKnownOctaveShift { + // Octave UP → piano slides LEFT (the camera is + // panning right toward higher notes). Octave DOWN + // → piano slides RIGHT (camera pans left). Reads + // like the player physically dragged the + // keyboard sideways under their hand. + let dir = (cur > self.lastKnownOctaveShift) ? -1 : 1 + self.lastKnownOctaveShift = cur + self.kickIconAnim(slide: dir, flash: 1.0) + } + self.updateIcon() + // Refresh the popover too so live state changes + // (octave shift via , / . , MIDI mode flip, etc.) + // reflect immediately while the popover is open. + if self.popover.isShown { + self.popoverVC?.syncFromController() + } + } } menuBand.onLitChanged = { [weak self] in - self?.updateIcon() - self?.popoverVC?.refreshHeldNotes() + guard let self = self else { return } + // Subtle flash on every fresh note hit so the icon + // pulses with playing activity. Only on count + // increment — releases don't re-fire the flash. + let cur = self.menuBand.litNotes.count + if cur > self.lastLitCount { + self.kickIconAnim(slide: 0, flash: 0.7) + } + self.lastLitCount = cur + self.updateIcon() + self.popoverVC?.refreshHeldNotes() } menuBand.bootstrap() @@ -264,6 +312,119 @@ final class AppDelegate: NSObject, NSApplicationDelegate { menuBand.shutdown() } + /// Register the YWFT Processing font files we ship in the SPM + /// bundle so AppKit can find them by PostScript name. Called + /// once at launch — the system caches the registration for the + /// process lifetime. Failures are logged but non-fatal; the + /// caller should fall back to the system font. + private static func registerBundledFonts() { + let bundle = Bundle.module + for name in ["ywft-processing-regular", "ywft-processing-bold"] { + guard let url = bundle.url(forResource: name, withExtension: "ttf") else { + NSLog("MenuBand: bundled font missing — \(name).ttf") + continue + } + var error: Unmanaged? + if !CTFontManagerRegisterFontsForURL(url as CFURL, .process, &error) { + NSLog("MenuBand: font register failed for \(name): \(error?.takeRetainedValue().localizedDescription ?? "?")") + } + } + } + + // MARK: - Icon animation (slide + flash) + + /// Kick off the icon's transient animation. `slide` ∈ {-1, 0, +1}: + /// −1 scrolls the piano left, +1 right, 0 leaves it alone. `flash` + /// is the peak brightness boost on the music-note glyph (0…1). + /// Either parameter can re-trigger an already-running animation + /// — most recent value wins. + private func kickIconAnim(slide: Int, flash: CGFloat) { + let now = CACurrentMediaTime() + if slide != 0 { + slideDirection = slide + slideStartedAt = now + } + if flash > 0.001 { + flashStrength = max(flashStrength, flash) + flashStartedAt = now + } + startIconAnimTimerIfNeeded() + updateIcon() + } + + private func startIconAnimTimerIfNeeded() { + guard iconAnimTimer == nil else { return } + iconAnimTimer = Timer.scheduledTimer( + withTimeInterval: 1.0/60.0, repeats: true + ) { [weak self] _ in + self?.tickIconAnim() + } + } + + private func tickIconAnim() { + let now = CACurrentMediaTime() + var slideActive = false + var flashActive = false + if slideDirection != 0 { + if (now - slideStartedAt) >= Self.slideDuration { + slideDirection = 0 + } else { + slideActive = true + } + } + if flashStrength > 0.01 { + if (now - flashStartedAt) >= Self.flashDuration { + flashStrength = 0 + } else { + flashActive = true + } + } + if !slideActive && !flashActive { + iconAnimTimer?.invalidate() + iconAnimTimer = nil + } + updateIcon() + } + + /// Computed slide offset for the current frame. Two-phase + /// "masked scroll" so the whole board reads as physically + /// scrolling past the menubar slot: + /// phase 1: image slides off in `slideDirection` until it's + /// fully off the slot (offset = ±imageWidth) + /// phase 2: image enters from the OPPOSITE side and settles + /// back at offset 0 + /// Result: instead of a back-and-forth shove, the user gets a + /// physical sense of the piano scrolling — like dragging a long + /// keyboard sideways and seeing one octave's worth slide past. + private func currentSlideOffset() -> CGFloat { + guard slideDirection != 0 else { return 0 } + let elapsed = CACurrentMediaTime() - slideStartedAt + if elapsed >= Self.slideDuration { return 0 } + let t = elapsed / Self.slideDuration // 0…1 + let w = KeyboardIconRenderer.imageSize.width + let dir = CGFloat(slideDirection) + if t < 0.5 { + // Linear slide off — keeps speed constant so the scroll + // reads as a real surface moving past. + let phase = CGFloat(t / 0.5) + return phase * w * dir + } else { + // Re-entry from the opposite side, easing into rest. + let phase = CGFloat((t - 0.5) / 0.5) + return -(1 - phase) * w * dir + } + } + + /// Computed flash strength for the current frame. Linear decay + /// from the peak value down to 0 over `flashDuration`. + private func currentFlashStrength() -> CGFloat { + guard flashStrength > 0.01 else { return 0 } + let elapsed = CACurrentMediaTime() - flashStartedAt + if elapsed >= Self.flashDuration { return 0 } + let t = CGFloat(elapsed / Self.flashDuration) + return flashStrength * (1 - t) + } + private func updateIcon() { guard let button = statusItem.button else { return } // Use *effective* keymap/typeMode so popover hover-preview can @@ -287,7 +448,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate { hovered: hoveredElement, letterAlpha: { [weak self] midi in self?.letterAlpha(for: midi) ?? 0 - } + }, + slideOffsetX: currentSlideOffset(), + settingsFlash: currentFlashStrength() ) // Force a synchronous redraw — the click drag-loop runs the runloop // in `eventTracking` mode and has been swallowing the next CA flush diff --git a/slab/menuband/Sources/MenuBand/ArrowKeysIndicator.swift b/slab/menuband/Sources/MenuBand/ArrowKeysIndicator.swift index 9b002d78a9..ce14d368af 100644 --- a/slab/menuband/Sources/MenuBand/ArrowKeysIndicator.swift +++ b/slab/menuband/Sources/MenuBand/ArrowKeysIndicator.swift @@ -2,18 +2,23 @@ import AppKit /// MacBook-style arrow-keys cluster, drawn as four little keycaps /// in the classic inverted-T arrangement: ↑ alone on top row, then -/// ← ↓ → in a row below. Each keycap can light up independently — -/// pressed direction fills with the accent color, the rest stay -/// white-outlined. -/// -/// Drawn entirely with NSBezierPath so the keys read as physical -/// chiclet shapes (rounded squares + centered arrow glyph), not -/// abstract chevrons. +/// ← ↓ → in a row below. Doubles as a clickable D-pad — mousing +/// over a cap lights it up (rollover), pressing fires the same +/// action a real arrow keystroke would. /// /// Direction indices match `InstrumentMapView.onArrowKey`: /// 0 = ← 1 = → 2 = ↓ 3 = ↑ final class ArrowKeysIndicator: NSView { private var pressed: Set = [] + private var hovered: Int? + private var trackingArea: NSTrackingArea? + + /// Fires when one of the keycaps is clicked. Same semantics as a + /// physical arrow keystroke — `isDown` is true on mouseDown, + /// false on mouseUp. The popover wires this to the same path the + /// keyboard arrows drive (preview note while held, commit on + /// release). + var onClick: ((Int, Bool) -> Void)? static let intrinsicSize = NSSize(width: 46, height: 30) override var intrinsicContentSize: NSSize { Self.intrinsicSize } @@ -24,8 +29,19 @@ final class ArrowKeysIndicator: NSView { } required init?(coder: NSCoder) { fatalError() } - /// Light up (or dim) one of the four direction keycaps. Multiple - /// directions can be lit at once. + override func updateTrackingAreas() { + super.updateTrackingAreas() + if let ta = trackingArea { removeTrackingArea(ta) } + let ta = NSTrackingArea(rect: bounds, + options: [.mouseEnteredAndExited, .mouseMoved, + .activeAlways, .inVisibleRect], + owner: self, userInfo: nil) + addTrackingArea(ta) + trackingArea = ta + } + + /// Pressed-state setter — used by the keyboard path so on-screen + /// keycaps light up while a real arrow key is held. func setHighlight(direction: Int, on: Bool) { if on { pressed.insert(direction) } else { pressed.remove(direction) } @@ -34,50 +50,101 @@ final class ArrowKeysIndicator: NSView { override var isFlipped: Bool { false } - override func draw(_ dirtyRect: NSRect) { - super.draw(dirtyRect) + // MARK: - Geometry + + /// Compute the four keycap rects in the same layout as `draw`. + /// Returned in direction index order: 0=←, 1=→, 2=↓, 3=↑. + private func keyRects() -> [NSRect] { let r = bounds - // Modern MacBook arrow ratios: all four keys are the same - // full-size square keycap, arranged in an inverted-T. Up - // sits alone on top, ◀ ▼ ▶ in a row below. 1 px gap between - // caps. let key: CGFloat = 13 let gap: CGFloat = 1 - let radius: CGFloat = 2.5 let centerX = r.midX - let bottomY = r.minY + 1 // bottom row baseline - let topY = bottomY + key + gap // top row sits above - // Bottom row: left, down, right (centered around centerX). + let bottomY = r.minY + 1 + let topY = bottomY + key + gap let downRect = NSRect(x: centerX - key / 2, y: bottomY, width: key, height: key) let leftRect = NSRect(x: downRect.minX - key - gap, y: bottomY, width: key, height: key) let rightRect = NSRect(x: downRect.maxX + gap, y: bottomY, width: key, height: key) - // Top row: up alone, full-size, centered over down. let upRect = NSRect(x: downRect.minX, y: topY, width: key, height: key) + return [leftRect, rightRect, downRect, upRect] + } + + private func direction(at point: NSPoint) -> Int? { + for (idx, kr) in keyRects().enumerated() where kr.contains(point) { + return idx + } + return nil + } + // MARK: - Mouse + + override func mouseEntered(with event: NSEvent) { + updateHover(at: convert(event.locationInWindow, from: nil)) + } + override func mouseMoved(with event: NSEvent) { + updateHover(at: convert(event.locationInWindow, from: nil)) + } + override func mouseExited(with event: NSEvent) { + if hovered != nil { hovered = nil; needsDisplay = true } + } + private func updateHover(at point: NSPoint) { + let d = direction(at: point) + if d != hovered { hovered = d; needsDisplay = true } + } + + override func mouseDown(with event: NSEvent) { + let pt = convert(event.locationInWindow, from: nil) + guard let dir = direction(at: pt) else { return } + pressed.insert(dir) + needsDisplay = true + onClick?(dir, true) + } + override func mouseUp(with event: NSEvent) { + // Fire keyUp for every pressed cap so we can't get stuck if + // the cursor leaves the cap during the drag. + for dir in pressed { + onClick?(dir, false) + } + pressed.removeAll() + needsDisplay = true + } + + // MARK: - Drawing + + override func draw(_ dirtyRect: NSRect) { + super.draw(dirtyRect) + let radius: CGFloat = 2.5 let glyphs = ["←", "→", "↓", "↑"] - let rects = [leftRect, rightRect, downRect, upRect] - for (idx, kr) in rects.enumerated() { + for (idx, kr) in keyRects().enumerated() { let lit = pressed.contains(idx) - // Keycap. + let isHover = (!lit && hovered == idx) let path = NSBezierPath(roundedRect: kr, xRadius: radius, yRadius: radius) if lit { NSColor.controlAccentColor.withAlphaComponent(0.85).setFill() path.fill() + } else if isHover { + // Rollover wash — soft accent tint behind the glyph, + // no fill on the rest of the cap so it reads as a + // "ready to click" state, not "selected". + NSColor.controlAccentColor.withAlphaComponent(0.18).setFill() + path.fill() } - (lit ? NSColor.controlAccentColor : NSColor.labelColor.withAlphaComponent(0.55)) - .setStroke() + let stroke: NSColor = lit + ? NSColor.controlAccentColor + : isHover + ? NSColor.controlAccentColor.withAlphaComponent(0.75) + : NSColor.labelColor.withAlphaComponent(0.55) + stroke.setStroke() path.lineWidth = 0.8 path.stroke() - // Arrow glyph centered in the keycap. - let glyphColor: NSColor = lit ? .black : NSColor.labelColor + let glyphColor: NSColor = lit + ? .black + : (isHover ? .controlAccentColor : NSColor.labelColor) let attrs: [NSAttributedString.Key: Any] = [ .font: NSFont.systemFont(ofSize: 10, weight: .heavy), .foregroundColor: glyphColor, ] let s = NSAttributedString(string: glyphs[idx], attributes: attrs) let size = s.size() - // Slight y-offset to optically center the unicode arrow - // (their natural baseline puts them a bit high in the box). s.draw(at: NSPoint(x: kr.midX - size.width / 2, y: kr.midY - size.height / 2 - 0.5)) } diff --git a/slab/menuband/Sources/MenuBand/KeyboardIconRenderer.swift b/slab/menuband/Sources/MenuBand/KeyboardIconRenderer.swift index bee528c92e..d3923a98f4 100644 --- a/slab/menuband/Sources/MenuBand/KeyboardIconRenderer.swift +++ b/slab/menuband/Sources/MenuBand/KeyboardIconRenderer.swift @@ -92,6 +92,12 @@ enum KeyboardIconRenderer { static let settingsW: CGFloat = 18.0 static let settingsH: CGFloat = 21.0 static let settingsGap: CGFloat = 12.0 + /// Reserved space on the right of the icon for the voice-number + /// badge to flow into when the program has 2+ digits. The music + /// note + settingsHitRect stay anchored where they were; this + /// pad just gives multi-digit numbers somewhere to grow without + /// clipping at the image edge. + static let voiceBadgeRightPad: CGFloat = 12.0 enum HitResult: Equatable { case openSettings @@ -142,7 +148,7 @@ enum KeyboardIconRenderer { } static var imageSize: NSSize { - let totalW = ceil(pad + pianoWidth + settingsGap + settingsW + pad) + let totalW = ceil(pad + pianoWidth + settingsGap + settingsW + pad + voiceBadgeRightPad) let totalH = ceil(whiteH + pad * 2) return NSSize(width: totalW, height: totalH) } @@ -158,7 +164,9 @@ enum KeyboardIconRenderer { typeMode: Bool = false, melodicProgram: UInt8 = 0, hovered: HitResult? = nil, - letterAlpha: ((UInt8) -> CGFloat)? = nil) -> NSImage { + letterAlpha: ((UInt8) -> CGFloat)? = nil, + slideOffsetX: CGFloat = 0, + settingsFlash: CGFloat = 0) -> NSImage { let whites = whiteList() var whiteIndex: [Int: Int] = [:] for (i, m) in whites.enumerated() { whiteIndex[m] = i } @@ -166,18 +174,52 @@ enum KeyboardIconRenderer { let img = NSImage(size: size, flipped: false) { _ in + // Octave slide: translate the WHOLE icon (piano + settings + // chip) by the requested offset so the entire menubar + // board scrolls left/right as one unit when the user + // changes octave. This is intentionally OUTSIDE any + // sub-save state so it affects every subsequent draw. + if abs(slideOffsetX) > 0.01 { + let xform = NSAffineTransform() + xform.translateX(by: slideOffsetX, yBy: 0) + xform.concat() + } // Piano. NSGraphicsContext.saveGraphicsState() - // Touched / active = a brighter version of the user's accent - // color (controlAccentColor lightened ~25% toward white) so the - // pressed state pops without leaving the accent palette. + // Dark-mode awareness: in light mode the piano reads as + // a real piano (white keys white, black keys dark + // accent). In dark mode we swap the relationship — white + // keys go a soft macOS dark-gray, black keys flip to a + // brighter accent so they still pop above the white + // keys. Lit (active) state always rides the accent + // palette so a pressed key contrasts both modes. + let isDark = NSApp.effectiveAppearance.bestMatch( + from: [.aqua, .darkAqua]) == .darkAqua let lit = NSColor.controlAccentColor.highlight(withLevel: 0.30) ?? NSColor.controlAccentColor - let groove = NSColor.black.withAlphaComponent(0.55) - let whiteHi = NSColor.white - let whiteLo = NSColor(white: 0.88, alpha: 1.0) - let blackHi = NSColor.controlAccentColor.shadow(withLevel: 0.30) ?? NSColor.controlAccentColor - let blackLo = NSColor.controlAccentColor.shadow(withLevel: 0.55) ?? NSColor.controlAccentColor + let groove = NSColor.black.withAlphaComponent(isDark ? 0.85 : 0.55) + let whiteHi: NSColor + let whiteLo: NSColor + let blackHi: NSColor + let blackLo: NSColor + if isDark { + // Soft macOS dark-gray for the "white" keys. + whiteHi = NSColor(white: 0.20, alpha: 1.0) + whiteLo = NSColor(white: 0.13, alpha: 1.0) + // Brighter accent for the "black" keys so they + // stand out above the dark grays. + blackHi = NSColor.controlAccentColor.highlight(withLevel: 0.10) + ?? NSColor.controlAccentColor + blackLo = NSColor.controlAccentColor.highlight(withLevel: 0.30) + ?? NSColor.controlAccentColor + } else { + whiteHi = NSColor.white + whiteLo = NSColor(white: 0.88, alpha: 1.0) + blackHi = NSColor.controlAccentColor.shadow(withLevel: 0.30) + ?? NSColor.controlAccentColor + blackLo = NSColor.controlAccentColor.shadow(withLevel: 0.55) + ?? NSColor.controlAccentColor + } // "Edges" of the *active* range — used for the rounded outer // corners. Active range may be right-aligned (Ableton) so the @@ -278,7 +320,9 @@ enum KeyboardIconRenderer { // MIDI off → `slider.horizontal.3` in label color (generic). drawSettingsChip(in: settingsRect, hoverRect: settingsHitRect, midiOn: enabled, - hovered: hovered == .openSettings) + hovered: hovered == .openSettings, + flash: settingsFlash, + voiceNumber: Int(melodicProgram)) return true } img.isTemplate = false @@ -290,8 +334,12 @@ enum KeyboardIconRenderer { /// up directly below the music note glyph. static var settingsRectPublic: NSRect { settingsIconRect } - // Settings button hit area extends from piano's right edge to the image - // edge so the entire right-side region is one big click target. + // Settings button hit area extends from the piano's right edge + // all the way to the image's right edge — including the voice- + // badge pad — so clicking either the music-note glyph OR the + // badge digits opens the popover. The icon is positioned via + // `settingsIconRect` directly (not via this hit rect) so the + // glyph stays put even though the hit zone now covers the pad. private static var settingsHitRect: NSRect { let leftX = pianoOriginX + pianoWidth let rightX = imageSize.width @@ -305,8 +353,13 @@ enum KeyboardIconRenderer { private static var settingsIconRect: NSRect { let w = settingsW let h = settingsH - let cx = settingsHitRect.maxX - w / 2 - pad - let cy = settingsHitRect.midY + // Anchor the icon to the image's "old" right edge — i.e. + // before the voice-badge pad was added. Otherwise the + // music-note glyph would drift right whenever the badge pad + // claims its slice of the image. + let oldRight = imageSize.width - voiceBadgeRightPad + let cx = oldRight - w / 2 - pad + let cy = imageSize.height / 2 return NSRect(x: cx - w / 2, y: cy - h / 2, width: w, height: h) } @@ -449,7 +502,17 @@ enum KeyboardIconRenderer { private static func drawWhiteLabel(_ text: String, in rect: NSRect, lit: Bool, alpha: CGFloat = 1.0) { guard alpha > 0.01 else { return } - let base: NSColor = lit ? .white : NSColor(white: 0.28, alpha: 1.0) + // Lit cells always wear pure-white labels (over the bright + // accent fill). Unlit cells need to flip with the + // appearance: dark-text in light mode (over a near-white + // keycap) becomes light-text in dark mode (over a dark-gray + // keycap). + let isDark = NSApp.effectiveAppearance.bestMatch( + from: [.aqua, .darkAqua]) == .darkAqua + let unlitBase = isDark + ? NSColor(white: 0.85, alpha: 1.0) + : NSColor(white: 0.28, alpha: 1.0) + let base: NSColor = lit ? .white : unlitBase let attrs: [NSAttributedString.Key: Any] = [ .font: NSFont.systemFont(ofSize: 9.0, weight: .heavy), .foregroundColor: base.withAlphaComponent(alpha), @@ -512,23 +575,69 @@ enum KeyboardIconRenderer { /// Alternates considered: "music.quarternote.3", "pianokeys", /// "music.note", "scroll", "speaker.wave.2", "waveform". private static func drawSettingsChip(in _: NSRect, hoverRect _: NSRect, - midiOn: Bool, hovered: Bool) { + midiOn: Bool, hovered: Bool, + flash: CGFloat = 0, + voiceNumber: Int = 0) { // Standard systray pill: hover/click paints a soft rounded // backdrop centered on the icon glyph (NOT the full hit area, so // the piano-side empty space stays unhighlighted). Same look as // any other status-bar item. let iconBox = settingsIconRect if hovered { - let pill = iconBox.insetBy(dx: -1, dy: 1) + // Pill encompasses the music note AND the voice-badge + // pad as one target — hovering either part highlights + // the same chip, so the user gets unified feedback. + let pill = NSRect( + x: iconBox.minX - 1, + y: iconBox.minY + 1, + width: (iconBox.width + Self.voiceBadgeRightPad + 1), + height: iconBox.height - 2 + ) let path = NSBezierPath(roundedRect: pill, xRadius: 4, yRadius: 4) NSColor.labelColor.withAlphaComponent(0.12).setFill() path.fill() } let alpha: CGFloat = hovered ? 1.0 : (midiOn ? 1.0 : 0.78) - let color: NSColor = midiOn + let baseColor: NSColor = midiOn ? NSColor.controlAccentColor : NSColor.labelColor.withAlphaComponent(alpha) + // Blend toward pure white based on `flash` (0..1). Used to + // signal "activity" when the user taps an octave key or + // plays a note — the music note icon briefly gets brighter + // before settling back. + let f = max(0, min(1, flash)) + let color = (f > 0.001) + ? baseColor.blended(withFraction: f, of: .white) ?? baseColor + : baseColor drawTintedSymbol("music.note.list", in: iconBox, pointSize: 13.0, color: color) + // Voice-number subscript: tiny digits in the bottom-right + // corner. The first digit sits where the single-digit case + // looked good; additional digits FLOW RIGHT from there + // (instead of growing leftward across the music-note glyph). + // Single digit is the visual anchor; multi-digit values + // extend toward / past the menubar slot's right edge. + // Skipped for program 0 (default Acoustic Grand) so the + // unmodified state stays uncluttered. + if voiceNumber > 0 { + let label = String(voiceNumber) + // Negative kerning tightens the digits so multi-digit + // values feel more like a tag than spaced text. + let attrs: [NSAttributedString.Key: Any] = [ + .font: NSFont.monospacedDigitSystemFont(ofSize: 7, weight: .heavy), + .foregroundColor: color, + .kern: -0.4, + ] + let str = NSAttributedString(string: label, attributes: attrs) + // Width of a single "0" — anchor for the first digit. + let oneDigit = NSAttributedString(string: "0", attributes: [ + .font: NSFont.monospacedDigitSystemFont(ofSize: 7, weight: .heavy), + ]).size() + // Nudge the first digit a small tad LEFT so it visually + // hugs the music-note glyph; remaining digits flow + // rightward into the reserved badge pad. + let leftX = iconBox.maxX - oneDigit.width - 1 + str.draw(at: NSPoint(x: leftX, y: iconBox.minY - 1)) + } } private static func drawInstrumentLabel(in rect: NSRect, hoverRect: NSRect, diff --git a/slab/menuband/Sources/MenuBand/LocalKeyCapture.swift b/slab/menuband/Sources/MenuBand/LocalKeyCapture.swift index d1294cc7f2..d8aa8ff2e6 100644 --- a/slab/menuband/Sources/MenuBand/LocalKeyCapture.swift +++ b/slab/menuband/Sources/MenuBand/LocalKeyCapture.swift @@ -34,7 +34,18 @@ final class LocalKeyCapture { // instead of the previously-foreground app. Without `activate`, our // panel can't become key and keys go elsewhere. NSApp.activate(ignoringOtherApps: true) - panel.makeKeyAndOrderFront(nil) + // If another window in our app is already key (e.g. the + // popover), DON'T steal key — `addLocalMonitorForEvents` + // catches keys at the app level regardless of which specific + // window is key, so the panel doesn't need to be key for + // capture to work. Keeping the popover key prevents its + // controls from rendering in the inactive/grey state. + let otherKey = NSApp.windows.contains { $0.isKeyWindow && $0 !== panel } + if otherKey { + panel.orderFront(nil) + } else { + panel.makeKeyAndOrderFront(nil) + } if monitor == nil { monitor = NSEvent.addLocalMonitorForEvents(matching: [.keyDown, .keyUp]) { [weak self] event in guard let self = self else { return event } diff --git a/slab/menuband/Sources/MenuBand/MenuBandController.swift b/slab/menuband/Sources/MenuBand/MenuBandController.swift index bed4e1ef69..2e1aa18e1b 100644 --- a/slab/menuband/Sources/MenuBand/MenuBandController.swift +++ b/slab/menuband/Sources/MenuBand/MenuBandController.swift @@ -59,6 +59,14 @@ final class MenuBandController { return "\(octave)\(pitches[pc])" } + /// Snapshot of hardware key codes currently held. Used by the + /// popover's QWERTY layout view to highlight which physical + /// keys are sounding right now. + func heldKeyCodes() -> Set { + heldLock.lock(); defer { heldLock.unlock() } + return Set(heldNotes.keys) + } + /// Snapshot of currently-held MIDI note names for popover display. /// Empty when nothing is sounding. func heldNoteNames() -> [String] { @@ -178,6 +186,68 @@ final class MenuBandController { execute: work) } + // MARK: - Octave hold-to-ramp + + /// The keyCode currently driving the octave-hold timer. nil when + /// no octave key is held. + private var octaveHoldKey: UInt16? + private var octaveHoldTimer: Timer? + private static let octaveHoldDelay: TimeInterval = 0.28 + private static let octaveHoldInterval: TimeInterval = 0.16 + + /// Apply a single octave step + percussive click + UI refresh. + /// Clamps to ±4 octaves; no-ops once the user is at the limit so + /// the click stops giving false feedback while held against the + /// stop. + private func octaveStepOnce(delta: Int) { + let next = max(-4, min(4, octaveShift + delta)) + if next == octaveShift { return } + octaveShift = next + playOctaveClick(for: next) + } + + private func startOctaveHold(keyCode: UInt16, delta: Int) { + octaveHoldKey = keyCode + octaveHoldTimer?.invalidate() + octaveHoldTimer = Timer.scheduledTimer( + withTimeInterval: Self.octaveHoldDelay, repeats: false + ) { [weak self] _ in + guard let self = self, + self.octaveHoldKey == keyCode else { return } + // After the initial hesitation, fire on a steady tempo + // until the user lets go. + self.octaveHoldTimer = Timer.scheduledTimer( + withTimeInterval: Self.octaveHoldInterval, repeats: true + ) { [weak self] _ in + guard let self = self, + self.octaveHoldKey == keyCode else { return } + self.octaveStepOnce(delta: delta) + } + } + } + + private func stopOctaveHold(forKeyCode keyCode: UInt16) { + guard octaveHoldKey == keyCode else { return } + octaveHoldTimer?.invalidate() + octaveHoldTimer = nil + octaveHoldKey = nil + } + + /// Tiny percussive click for octave shifts. Uses a high-mid drum + /// (Tambourine, GM key 54) on the drum channel so it reads as + /// punctual rather than tonal — but the velocity is mapped from + /// the new octave so each step has its own audible weight, + /// scaling brighter / sharper as you move up. + private func playOctaveClick(for newShift: Int) { + // Velocity range so all octaves are distinct but none are + // jarring: −4 → ~50, 0 → ~85, +4 → ~120. + let v = max(40, min(127, 85 + newShift * 9)) + synth.noteOn(54, velocity: UInt8(v), channel: 9) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { [weak self] in + self?.synth.noteOff(54, channel: 9) + } + } + func auditionCurrentProgram() { let note = lastPlayedNote debugLog("audition: synth.noteOn \(note) (program \(melodicProgram))") @@ -710,6 +780,28 @@ final class MenuBandController { return true } + // Octave shift: notepat uses , (43) / . (47); Ableton uses z (6) / + // x (7) since those are unmapped in Live's M-mode keymap and the + // comma/period live next to mapped notes there. Acts globally — + // works the same in TYPE mode and via the popover's local-key + // forwarding. Hold-to-ramp: a single tap moves one octave; + // holding the key sets up our own metronome (~280 ms initial + // delay, then ~160 ms between repeats) so the octave notches + // predictably while the key is held — independent of the OS's + // key-repeat settings. + let (octDownKC, octUpKC) = MenuBandLayout.octaveKeyCodes(for: keymap) + if keyCode == octDownKC || keyCode == octUpKC { + let delta = (keyCode == octDownKC) ? -1 : +1 + if isDown { + if isRepeat { return true } // we drive our own repeats + octaveStepOnce(delta: delta) + startOctaveHold(keyCode: keyCode, delta: delta) + } else { + stopOctaveHold(forKeyCode: keyCode) + } + return true + } + let shift = octaveShift // a single UserDefaults read; cheap if isDown { diff --git a/slab/menuband/Sources/MenuBand/MenuBandMIDI.swift b/slab/menuband/Sources/MenuBand/MenuBandMIDI.swift index cbb7743828..ada40f2c1c 100644 --- a/slab/menuband/Sources/MenuBand/MenuBandMIDI.swift +++ b/slab/menuband/Sources/MenuBand/MenuBandMIDI.swift @@ -121,6 +121,19 @@ enum MenuBandLayout { return panByKeyCode[Int(keyCode)] } + /// Hardware key codes used as octave-down / octave-up shifters in + /// the given keymap. Notepat reserves , (43) and . (47); Ableton + /// remaps to z (6) and x (7) because those sit unmapped in Live's + /// M-mode layout (where comma and period are right next to mapped + /// notes and would steal accidental presses). + @inline(__always) + static func octaveKeyCodes(for keymap: Keymap) -> (down: UInt16, up: UInt16) { + switch keymap { + case .ableton: return (6, 7) + case .notepat: return (43, 47) + } + } + @inline(__always) static func midiNote(forKeyCode keyCode: UInt16, octaveShift: Int, diff --git a/slab/menuband/Sources/MenuBand/MenuBandPopover.swift b/slab/menuband/Sources/MenuBand/MenuBandPopover.swift index 22a8158a7b..16edd4cb6b 100644 --- a/slab/menuband/Sources/MenuBand/MenuBandPopover.swift +++ b/slab/menuband/Sources/MenuBand/MenuBandPopover.swift @@ -72,6 +72,12 @@ final class MenuBandPopoverViewController: NSViewController { private var instrumentLabel: NSTextField! private var instrumentTitleRow: NSStackView! private var arrowsHint: ArrowKeysIndicator! + private var qwertyMap: QwertyLayoutView! + /// Horizontal stack of small floating boxes, one per currently- + /// held note. Sits above the visualizer; empty (zero-height) at + /// rest so the layout doesn't wobble when notes come and go. + private var heldNotesStack: NSStackView! + private var heldNotesContainer: NSView! private var instrumentSeparator: NSView! private var octaveStepper: NSStepper! private var octaveLabel: NSTextField! @@ -81,6 +87,7 @@ final class MenuBandPopoverViewController: NSViewController { private var updateBanner: NSView! private var updateLabel: NSTextField! private var waveformView: WaveformView! + private var waveformBezel: NSView! override func loadView() { // Plain solid-color background — no NSVisualEffectView. The visual @@ -256,10 +263,12 @@ final class MenuBandPopoverViewController: NSViewController { // Hovering a segment previews that mode in the menubar piano (range // shrinks/grows, letter labels appear) and lets you tap keys for a // quick demo without committing. - let inputLabel = NSTextField(labelWithString: "Keyboard Shortcuts") + // Layout block — built here, but appended to the stack + // *below* the palettePanel so the Layout choice reads as a + // configuration knob you reach for after picking a voice. + let inputLabel = NSTextField(labelWithString: "Layout") inputLabel.font = NSFont.systemFont(ofSize: 11, weight: .semibold) inputLabel.textColor = .labelColor - stack.addArrangedSubview(inputLabel) // Vertical mode buttons — full labels fit without truncation, each // button is the full content width with an SF Symbol leading the @@ -270,9 +279,17 @@ final class MenuBandPopoverViewController: NSViewController { // local capture (click menubar piano → type to play, no Accessibility // needed) that mode is handled implicitly by simply not triggering // global capture. The popover now just picks the keymap layout. - let modeSpecs: [(label: String, symbol: String)] = [ - ("Notepat.com", "keyboard"), - ("Ableton MIDI Keys", "pianokeys"), + // Custom branding: Notepat.com uses the live favicon + // (`NotepatFavicon.image`, lazily fetched + cached); Ableton + // gets the canonical logo we render programmatically. + let modeSpecs: [(label: String, image: NSImage?)] = [ + ("Notepat.com", + NotepatFavicon.image + ?? NSImage(systemSymbolName: "keyboard", + accessibilityDescription: "Notepat.com")? + .withSymbolConfiguration(modeSymbolConfig)), + ("Ableton Computer Keyboard", + AbletonLogo.image(height: 11)), ] modeButtons = [] let modeStack = NSStackView() @@ -290,9 +307,7 @@ final class MenuBandPopoverViewController: NSViewController { b.alignment = .left b.imagePosition = .imageLeading b.imageHugsTitle = true - b.image = NSImage(systemSymbolName: spec.symbol, - accessibilityDescription: spec.label)? - .withSymbolConfiguration(modeSymbolConfig) + b.image = spec.image b.translatesAutoresizingMaskIntoConstraints = false b.widthAnchor.constraint( equalToConstant: InstrumentListView.preferredWidth @@ -300,7 +315,6 @@ final class MenuBandPopoverViewController: NSViewController { modeButtons.append(b) modeStack.addArrangedSubview(b) } - stack.addArrangedSubview(modeStack) modeStack.widthAnchor.constraint( equalToConstant: InstrumentListView.preferredWidth ).isActive = true @@ -309,7 +323,10 @@ final class MenuBandPopoverViewController: NSViewController { "⌃⌥⌘P toggles last keystrokes mode") inputHint.font = NSFont.systemFont(ofSize: 10) inputHint.textColor = .secondaryLabelColor - stack.addArrangedSubview(inputHint) + // Layout label / mode buttons / hint are inserted into the + // popover stack farther down — see the `palettePanel` + // insertion point. + let layoutBlock = (label: inputLabel, picker: modeStack, hint: inputHint) // Live segmented LED meter of the local synth output. Hidden in // MIDI mode (DAW handles audio there; our local mixer is silent @@ -324,12 +341,13 @@ final class MenuBandPopoverViewController: NSViewController { waveformView.menuBand = menuBand waveformView.translatesAutoresizingMaskIntoConstraints = false - let waveformBezel = NSView() + waveformBezel = NSView() waveformBezel.wantsLayer = true waveformBezel.layer?.cornerRadius = 6 waveformBezel.layer?.backgroundColor = NSColor(white: 0.06, alpha: 1.0).cgColor - waveformBezel.layer?.borderColor = NSColor.labelColor.withAlphaComponent(0.18).cgColor waveformBezel.layer?.borderWidth = 1 + // Border color is set in `updateInstrumentReadout` so the + // housing tracks the chosen voice's family hue. waveformBezel.translatesAutoresizingMaskIntoConstraints = false waveformBezel.addSubview(waveformView) let bezelInset: CGFloat = 5 @@ -339,12 +357,30 @@ final class MenuBandPopoverViewController: NSViewController { waveformView.topAnchor.constraint(equalTo: waveformBezel.topAnchor, constant: bezelInset), waveformView.bottomAnchor.constraint(equalTo: waveformBezel.bottomAnchor, constant: -bezelInset), ]) + // Held-notes goes ABOVE the visualizer so the actively- + // sounding pitches read like a label on the meter housing. + // Build the floating-boxes container HERE so the ivar is + // populated before we add it to the stack. + heldNotesStack = NSStackView() + heldNotesStack.orientation = .horizontal + heldNotesStack.alignment = .centerY + heldNotesStack.spacing = 4 + heldNotesStack.translatesAutoresizingMaskIntoConstraints = false + heldNotesContainer = NSView() + heldNotesContainer.translatesAutoresizingMaskIntoConstraints = false + heldNotesContainer.addSubview(heldNotesStack) + NSLayoutConstraint.activate([ + heldNotesStack.centerXAnchor.constraint(equalTo: heldNotesContainer.centerXAnchor), + heldNotesStack.centerYAnchor.constraint(equalTo: heldNotesContainer.centerYAnchor), + ]) + stack.addArrangedSubview(heldNotesContainer) + heldNotesContainer.widthAnchor.constraint(equalToConstant: InstrumentListView.preferredWidth).isActive = true + heldNotesContainer.heightAnchor.constraint(equalToConstant: 22).isActive = true + stack.addArrangedSubview(waveformBezel) waveformBezel.widthAnchor.constraint(equalToConstant: InstrumentListView.preferredWidth).isActive = true waveformBezel.heightAnchor.constraint(equalToConstant: 64).isActive = true - stack.addArrangedSubview(makeSeparator()) - // (MIDI switch lives in the title row above — see octave + MIDI block.) // MIDI self-test status — populated by the controller after each @@ -354,8 +390,12 @@ final class MenuBandPopoverViewController: NSViewController { // label color in the title row instead (green = ok, red = failed). midiSelfTestLabel = NSTextField(labelWithString: "") + // No divider above the Voice row — the visualizer's lit + // bezel below is enough visual separation. Allocate the ivar + // anyway so the dim/animation hooks below don't crash; just + // never add it to the stack. instrumentSeparator = makeSeparator() - stack.addArrangedSubview(instrumentSeparator) + instrumentSeparator.isHidden = true // Instrument named-list. All 128 GM programs in a scrollable list, // family-colored stripe on the left, name on the right. Hover plays @@ -367,33 +407,47 @@ final class MenuBandPopoverViewController: NSViewController { // Title row: "Instrument:" left, "078 Whistle" right (greyed). The // readout used to live under the grid; promoting it to the title // row keeps the eye on a single line while browsing cells. - instrumentLabel = NSTextField(labelWithString: "Voice:") - instrumentLabel.font = NSFont.systemFont(ofSize: 9.5, weight: .semibold) - instrumentLabel.textColor = .labelColor + // No leading "Voice:" label — the family-tinted chip itself + // *is* the voice title now. Bigger, bolder, sits like a + // chapter heading under the LED meter. + instrumentLabel = NSTextField(labelWithString: "") + instrumentLabel.isHidden = true instrumentReadout = NSTextField(labelWithString: "") - instrumentReadout.font = NSFont.monospacedSystemFont(ofSize: 9.5, weight: .regular) + // Big, bold, family-colored title with a soft drop shadow — + // no chip backdrop. Text color carries the GM family hue + // (set/refreshed in updateInstrumentReadout); the shadow gives + // it presence without the rectangular bg framing it had before. + instrumentReadout.font = NSFont.systemFont(ofSize: 18, weight: .black) instrumentReadout.textColor = .labelColor - // Chip backdrop — colored to match the GM-family hue that - // `InstrumentListView.colorForProgram` uses for the cell. The - // bg is set/refreshed in `updateInstrumentReadout` so picking - // a new instrument visually moves the chip into the same color - // tier as the cell that was clicked. instrumentReadout.drawsBackground = false instrumentReadout.wantsLayer = true - instrumentReadout.layer?.cornerRadius = 4 instrumentReadout.lineBreakMode = .byTruncatingTail - instrumentTitleRow = NSStackView(views: [instrumentLabel, instrumentReadout]) + instrumentReadout.alignment = .center + let titleShadow = NSShadow() + titleShadow.shadowColor = NSColor.black.withAlphaComponent(0.55) + titleShadow.shadowBlurRadius = 3 + titleShadow.shadowOffset = NSSize(width: 0, height: -1) + instrumentReadout.shadow = titleShadow + // Center the chip in its row by flanking it with greedy + // spacers — without these, .fill distribution lets the + // (now-shrunken) text hug the leading edge. + let titleLeftSpacer = NSView() + let titleRightSpacer = NSView() + titleLeftSpacer.setContentHuggingPriority(.defaultLow, for: .horizontal) + titleRightSpacer.setContentHuggingPriority(.defaultLow, for: .horizontal) + instrumentTitleRow = NSStackView(views: [titleLeftSpacer, instrumentReadout, titleRightSpacer]) instrumentTitleRow.orientation = .horizontal - instrumentTitleRow.alignment = .firstBaseline - instrumentTitleRow.spacing = 6 - // Hugging high on the label, low on the readout, so the readout - // expands to fill the trailing space and truncates cleanly. + instrumentTitleRow.alignment = .centerY + instrumentTitleRow.distribution = .fill + instrumentTitleRow.spacing = 0 instrumentLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal) - instrumentReadout.setContentHuggingPriority(.defaultLow, for: .horizontal) - instrumentReadout.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + instrumentReadout.setContentHuggingPriority(.defaultHigh, for: .horizontal) + instrumentReadout.setContentCompressionResistancePriority(.required, for: .horizontal) + titleLeftSpacer.widthAnchor.constraint(equalTo: titleRightSpacer.widthAnchor).isActive = true stack.addArrangedSubview(instrumentTitleRow) - // (Held-notes / chord LED panel removed — the empty-pill resting - // state added more visual noise than the feature was worth.) + + // (held-notes floating-boxes container is built ABOVE the + // visualizer — see the block before `waveformBezel`.) // GarageBand backend toggle was prototyped here (see // GarageBandLibrary + GarageBandPatchView), then deprecated @@ -437,10 +491,16 @@ final class MenuBandPopoverViewController: NSViewController { return } let famColor = InstrumentListView.colorForProgram(safe) - self.instrumentReadout.stringValue = " \(nameForChip) " - self.instrumentReadout.layer?.backgroundColor = - famColor.withAlphaComponent(0.32).cgColor - self.waveformView.setBaseColor(famColor) + self.instrumentReadout.stringValue = nameForChip + self.instrumentReadout.textColor = famColor + // Don't retint the LED bezel during hover-drag while + // MIDI mode is on — it stays accent-colored as a status + // badge. + if let m = self.menuBand, !m.midiMode { + self.waveformView.setBaseColor(famColor) + self.waveformBezel?.layer?.borderColor = + famColor.withAlphaComponent(0.55).cgColor + } } // Wrap the grid in a panel that adds an extra strip BELOW the // 8×16 cells where the arrow-keys hint glyph lives. The hint @@ -453,17 +513,44 @@ final class MenuBandPopoverViewController: NSViewController { arrowsHint = ArrowKeysIndicator() arrowsHint.toolTip = "Arrow keys move the selection." arrowsHint.translatesAutoresizingMaskIntoConstraints = false + arrowsHint.onClick = { [weak self] dir, isDown in + // Drive the same selection path the physical arrow keys + // do — preview while pressed, commit on release. + self?.simulateArrow(direction: dir, isDown: isDown) + } palettePanel.addSubview(arrowsHint) let cornerInset: CGFloat = 4 - // Strip below the grid sized to fit the 30 px keycap cluster - // plus a generous gap above so the arrows feel like a separate - // ornament — not crammed up under the bottom row of voices. - let strip: CGFloat = 46 + // Strip below the grid: full-width QWERTY keymap on top of + // the strip, arrow-keys cluster anchored to its bottom-right + // corner. Reads like a tiny laptop keyboard glued to the + // base of the voice grid. + let strip: CGFloat = 100 + qwertyMap = QwertyLayoutView() + qwertyMap.translatesAutoresizingMaskIntoConstraints = false + // Pointer-driven play: clicks/drags on caps route through the + // same handleLocalKey path the physical keyboard uses, so notes + // light up, octave keys shift, and lit-state updates round-trip + // back into the layout view automatically. + qwertyMap.onKey = { [weak self] kc, isDown in + _ = self?.menuBand?.handleLocalKey( + keyCode: kc, isDown: isDown, isRepeat: false, flags: [] + ) + } + palettePanel.addSubview(qwertyMap) NSLayoutConstraint.activate([ instrumentList.topAnchor.constraint(equalTo: palettePanel.topAnchor), instrumentList.leadingAnchor.constraint(equalTo: palettePanel.leadingAnchor), instrumentList.trailingAnchor.constraint(equalTo: palettePanel.trailingAnchor), instrumentList.heightAnchor.constraint(equalToConstant: InstrumentListView.preferredHeight), + qwertyMap.centerXAnchor.constraint(equalTo: palettePanel.centerXAnchor), + // Anchor the QWERTY map to the BOTTOM of the strip + // (just above the arrow keys) instead of the top — + // visually clusters it with the arrow-keys cluster as + // one keyboard ornament, and frees space above for the + // grid to breathe. + qwertyMap.bottomAnchor.constraint(equalTo: arrowsHint.topAnchor, constant: -4), + qwertyMap.widthAnchor.constraint(equalToConstant: QwertyLayoutView.intrinsicSize.width), + qwertyMap.heightAnchor.constraint(equalToConstant: QwertyLayoutView.intrinsicSize.height), arrowsHint.trailingAnchor.constraint(equalTo: palettePanel.trailingAnchor, constant: -cornerInset), arrowsHint.bottomAnchor.constraint(equalTo: palettePanel.bottomAnchor, constant: -cornerInset), ]) @@ -471,13 +558,17 @@ final class MenuBandPopoverViewController: NSViewController { palettePanel.widthAnchor.constraint(equalToConstant: InstrumentListView.preferredWidth).isActive = true palettePanel.heightAnchor.constraint(equalToConstant: InstrumentListView.preferredHeight + strip).isActive = true - let bottomSeparator = makeSeparator() - stack.addArrangedSubview(bottomSeparator) - // Extra breathing room between the visualizer/instruments above and - // the brand/about/quit footer below. The default 6 px stack gap - // crammed everything together — this gives the bottom block its - // own visual section. - stack.setCustomSpacing(12, after: bottomSeparator) + // Layout block (built earlier, appended here so it sits below + // the voice grid + arrow keys). + stack.setCustomSpacing(8, after: palettePanel) + stack.addArrangedSubview(layoutBlock.label) + stack.addArrangedSubview(layoutBlock.picker) + stack.addArrangedSubview(layoutBlock.hint) + + // No divider above the about/brand block — the palette + Layout + // section above gives plenty of separation. Custom airspace + // before the about block. + stack.setCustomSpacing(14, after: layoutBlock.hint) // About + Crash logs in a side-by-side row. About has low hugging // so it expands when the crash column is hidden (no reports) — @@ -497,12 +588,23 @@ final class MenuBandPopoverViewController: NSViewController { // No heading — the prose itself is the about content. The bold // "Menu Band" header on top read as a duplicate of the menubar // identity above and ate vertical space. - let aboutBody = NSTextField(wrappingLabelWithString: - "A political project to bring the built-in macOS instruments — " + - "the ones GarageBand uses — into the menu bar. Free + open source.") + let aboutBody = NSTextField(wrappingLabelWithString: "") aboutBody.font = NSFont.systemFont(ofSize: 10.5) aboutBody.textColor = .secondaryLabelColor aboutBody.maximumNumberOfLines = 0 + aboutBody.lineBreakMode = .byWordWrapping + // "Menu Band" stays bold + label-colored; the rest of the + // sentence is regular weight in secondary color so the eye + // catches the brand first. + let aboutText = NSMutableAttributedString() + let bodyFont = NSFont.systemFont(ofSize: 10.5) + let boldFont = NSFont.systemFont(ofSize: 10.5, weight: .bold) + aboutText.append(NSAttributedString(string: "Menu Band", + attributes: [.font: boldFont, .foregroundColor: NSColor.labelColor])) + aboutText.append(NSAttributedString( + string: " brings the built-in macOS instruments into the menu bar.", + attributes: [.font: bodyFont, .foregroundColor: NSColor.secondaryLabelColor])) + aboutBody.attributedStringValue = aboutText aboutBody.preferredMaxLayoutWidth = InstrumentListView.preferredWidth aboutCol.setContentHuggingPriority(.defaultLow, for: .horizontal) aboutCol.addArrangedSubview(aboutBody) @@ -608,11 +710,24 @@ final class MenuBandPopoverViewController: NSViewController { super.viewDidAppear() guard isViewLoaded, let menuBand = waveformView.menuBand else { return } syncFromController() - waveformView.isLive = !menuBand.midiMode + applyVisualizerForMidiMode(menuBand.midiMode) // Make the voice grid first responder on every popover open so // arrow keys always step the selection — even before the user // has clicked into the grid this session. view.window?.makeFirstResponder(instrumentList) + // Refresh the Notepat mode button if a freshly-cached + // favicon has landed since loadView() ran. One-shot observer + // re-installs each time the popover appears so we don't leak + // listeners. + NotificationCenter.default.removeObserver(self, + name: .notepatFaviconLoaded, object: nil) + NotificationCenter.default.addObserver(forName: .notepatFaviconLoaded, + object: nil, queue: .main) { [weak self] _ in + guard let self = self, + self.modeButtons.indices.contains(0), + let img = NotepatFavicon.image else { return } + self.modeButtons[0].image = img + } } override func viewDidDisappear() { @@ -620,15 +735,95 @@ final class MenuBandPopoverViewController: NSViewController { waveformView.isLive = false } - /// Held-notes readout removed. AppDelegate's onLitChanged still - /// calls this for back-compat — left as a no-op so we don't have - /// to thread the removal through every callsite. - func refreshHeldNotes() {} + /// Drive the voice grid's selection from the on-screen arrow + /// keycaps as if the physical arrow key had been pressed — + /// `isDown` triggers the move + preview note, the matching `up` + /// commits the cell. Mirrors `InstrumentMapView.keyDown` / + /// `keyUp`'s logic so click-on-the-D-pad and arrow-key-on-the- + /// keyboard share one code path. + private func simulateArrow(direction dir: Int, isDown: Bool) { + guard let list = instrumentList else { return } + if isDown { + let cur = Int(list.selectedProgram) + var next = cur + switch dir { + case 0: next = cur - 1 // ← + case 1: next = cur + 1 // → + case 2: next = cur + InstrumentListView.cols // ↓ + case 3: next = cur - InstrumentListView.cols // ↑ + default: return + } + next = max(0, min(127, next)) + arrowsHint.setHighlight(direction: dir, on: true) + if next != cur { + list.selectedProgram = UInt8(next) + list.onHover?(next) + } + } else { + arrowsHint.setHighlight(direction: dir, on: false) + list.onHover?(nil) + list.onCommit?(Int(list.selectedProgram)) + } + } + + /// Refresh the active-notes LCD from the controller. Hidden when + /// nothing is held; otherwise lit with the held note names in + /// the GM family color of the current voice (so the LCD readout + /// reads as part of the same instrument). + func refreshHeldNotes() { + guard isViewLoaded, let m = menuBand else { return } + // Mirror the controller's held key codes onto the QWERTY + // map so the physical keys light up as the user plays. + qwertyMap?.litKeyCodes = m.heldKeyCodes() + let names = m.heldNoteNames() + // Rebuild the floating-box stack from scratch — at most a + // few notes held at any moment, so reusing views isn't worth + // the bookkeeping. When nothing is held, the stack has no + // arranged subviews and the reserved 22 px row is empty + // (no visible chrome). + for v in heldNotesStack.arrangedSubviews { + heldNotesStack.removeArrangedSubview(v) + v.removeFromSuperview() + } + let safe = max(0, min(127, Int(m.melodicProgram))) + let famColor = m.midiMode + ? NSColor.controlAccentColor + : InstrumentListView.colorForProgram(safe) + for name in names { + heldNotesStack.addArrangedSubview(makeHeldNoteBox(name: name, + color: famColor)) + } + } + + /// Small floating note badge — rounded layer-painted box with + /// the note name in heavy mono. No surrounding bezel; the boxes + /// just appear above the visualizer when you press keys. + private func makeHeldNoteBox(name: String, color: NSColor) -> NSView { + let box = NSView() + box.wantsLayer = true + box.layer?.cornerRadius = 4 + box.layer?.backgroundColor = color.withAlphaComponent(0.85).cgColor + box.translatesAutoresizingMaskIntoConstraints = false + let label = NSTextField(labelWithString: name) + label.font = NSFont.monospacedSystemFont(ofSize: 10, weight: .heavy) + label.textColor = .black + label.drawsBackground = false + label.translatesAutoresizingMaskIntoConstraints = false + box.addSubview(label) + NSLayoutConstraint.activate([ + label.leadingAnchor.constraint(equalTo: box.leadingAnchor, constant: 5), + label.trailingAnchor.constraint(equalTo: box.trailingAnchor, constant: -5), + label.topAnchor.constraint(equalTo: box.topAnchor, constant: 1), + label.bottomAnchor.constraint(equalTo: box.bottomAnchor, constant: -1), + ]) + return box + } /// Refresh control state from the controller — call right before showing. func syncFromController() { guard isViewLoaded, let n = menuBand else { return } midiSwitch.state = n.midiMode ? .on : .off + refreshHeldNotes() octaveStepper.integerValue = n.octaveShift updateOctaveLabel(n.octaveShift) let segIdx = inputModeSegment(keymap: n.keymap) @@ -637,6 +832,14 @@ final class MenuBandPopoverViewController: NSViewController { } instrumentList.selectedProgram = n.melodicProgram updateInstrumentReadout() + // Keep the QWERTY layout's keymap + tint synced with the + // controller. Voice color picks up the family hue for the + // current voice; keymap variant follows the controller. + let safe = max(0, min(127, Int(n.melodicProgram))) + qwertyMap?.keymap = n.keymap + qwertyMap?.voiceColor = n.midiMode + ? .controlAccentColor + : InstrumentListView.colorForProgram(safe) updateSelfTestLabel(state: n.midiMode ? n.midiSelfTest : .unknown) refreshCrashStatus() refreshUpdateBanner() @@ -688,15 +891,59 @@ final class MenuBandPopoverViewController: NSViewController { private func updateInstrumentReadout() { guard let m = menuBand else { return } let safe = max(0, min(127, Int(m.melodicProgram))) - instrumentReadout.stringValue = " \(GeneralMIDI.programNames[safe]) " + let title = GeneralMIDI.programNames[safe] let famColor = InstrumentListView.colorForProgram(safe) - instrumentReadout.layer?.backgroundColor = famColor - .withAlphaComponent(0.32).cgColor - // Retint the LED meter to the same hue so the visualizer - // signals which instrument is the audible voice at a glance. - waveformView.setBaseColor(famColor) + // Dark hues (Bass / Strings / Percussive) wash out against + // the dark popover background; light hues (Piano ivory) wash + // out in light mode. Adjust per-appearance so the title + // always has presence. + let isDark = view.effectiveAppearance.bestMatch( + from: [.aqua, .darkAqua]) == .darkAqua + let textColor: NSColor = isDark + ? (famColor.highlight(withLevel: 0.35) ?? famColor) + : (famColor.shadow(withLevel: 0.25) ?? famColor) + // Soft drop shadow opposite the system appearance so the + // glyph anchors on the bg without a chip backdrop. + let shadow = NSShadow() + shadow.shadowColor = (isDark ? NSColor.black : NSColor.white) + .withAlphaComponent(0.55) + shadow.shadowOffset = NSSize(width: 0, height: -1) + shadow.shadowBlurRadius = 2 + // Try YWFT Processing first (bundled in Resources/), fall + // back through the Processing-IDE family, then the system + // black-weight as a last resort. + let titleFont = NSFont(name: "YWFTProcessing-Bold", size: 18) + ?? NSFont(name: "YWFTProcessing-Regular", size: 18) + ?? NSFont(name: "Processing-Sans-Pro-Bold", size: 18) + ?? NSFont.systemFont(ofSize: 18, weight: .black) + instrumentReadout.attributedStringValue = NSAttributedString( + string: title, + attributes: [ + .font: titleFont, + .foregroundColor: textColor, + .shadow: shadow, + ] + ) + // The visualizer is the only piece of chrome that does NOT + // track the voice color in MIDI mode — there it reads as a + // status badge ("MIDI" dot-matrix in system accent), so we + // skip the retint when MIDI is on. + if m.midiMode { + waveformView.setBaseColor(.controlAccentColor) + waveformBezel?.layer?.borderColor = NSColor.controlAccentColor + .withAlphaComponent(0.55).cgColor + } else { + waveformView.setBaseColor(famColor) + waveformBezel?.layer?.borderColor = famColor + .withAlphaComponent(0.55).cgColor + } } + // Appearance changes (light/dark toggle) refresh on next popover + // open via syncFromController — viewDidChangeEffectiveAppearance + // isn't on NSViewController in macOS so we don't try to hook it + // mid-session. + /// Reflect the MIDI loopback self-test status as the inline "MIDI" /// label's color. No textual chrome — the color is the indicator. private func updateSelfTestLabel(state: MenuBandController.MIDISelfTest) { @@ -901,11 +1148,44 @@ final class MenuBandPopoverViewController: NSViewController { // means the popover's geometry stays stable and the user can see // exactly what's available without MIDI engaged. if let m = menuBand { - waveformView.isLive = !m.midiMode + applyVisualizerForMidiMode(m.midiMode) applyInstrumentPaletteVisibility(midiMode: m.midiMode) } } + /// 16-bar × 10-segment dot-matrix pattern that spells "MIDI" + /// across the full height of the LED bezel. Each letter is 3 + /// bars wide, with a 1-bar gap between them: 3+1+3+1+3+1+3 = 15 + /// bars, with a 1-bar right margin. Letters span every segment + /// (bits 0–9) so the readout fills the whole display. + static let midiDotPattern: [UInt32] = { + var p = [UInt32](repeating: 0, count: 16) + let FULL : UInt32 = 0x3FF // segs 0..9 (all rows) + let TOP_BOT: UInt32 = 0x201 // segs 0, 9 only + let TOP_ROW: UInt32 = 0x100 // seg 8 (M's middle peak) + let MID_BAR: UInt32 = 0x1FE // segs 1..8 (D's right edge) + // M (3 cols): full left + middle peak + full right. + p[0] = FULL + p[1] = TOP_ROW + p[2] = FULL + // gap p[3] + // I (3 cols) + p[4] = TOP_BOT + p[5] = FULL + p[6] = TOP_BOT + // gap p[7] + // D (3 cols): full left, top+bottom middle, mid-only right. + p[8] = FULL + p[9] = TOP_BOT + p[10] = MID_BAR + // gap p[11] + // I (3 cols) + p[12] = TOP_BOT + p[13] = FULL + p[14] = TOP_BOT + return p + }() + private func applyInstrumentPaletteVisibility(midiMode: Bool, animated: Bool = false) { // Greyed-out, not hidden: keep the rows in place so the popover // doesn't reflow when MIDI flips. We dim alpha rather than touching @@ -963,6 +1243,12 @@ final class MenuBandPopoverViewController: NSViewController { updateInstrumentReadout() debugLog("instrument commit prog=\(program) midiAutoOff=\(wasMidiOn)") if wasMidiOn { + // Auto-off implicitly re-enables the local-synth audio + // path; bring the visualizer back to live VU + voice + // color in the same step. Single source of truth: the + // controller's `midiMode` boolean drives both the synth + // routing AND the meter visual state. + applyVisualizerForMidiMode(false) m.auditionCurrentProgram() } // Otherwise no post-release audition: the press-gated rollover @@ -971,6 +1257,30 @@ final class MenuBandPopoverViewController: NSViewController { // through onHover(nil) first which stops the preview cleanly. } + /// Single source-of-truth wiring between `midiMode` and the + /// visualizer's three modes (live VU vs MIDI dot-matrix) plus + /// its base color (voice family vs system accent). Called from + /// every place that flips midiMode — keeps the meter from + /// getting stuck in a stale state when MIDI is auto-disabled by + /// picking a new voice. + func applyVisualizerForMidiMode(_ midiOn: Bool) { + guard let m = menuBand else { return } + waveformView.isLive = !midiOn + if midiOn { + waveformView.setDotMatrix(Self.midiDotPattern) + waveformView.setBaseColor(.controlAccentColor) + waveformBezel?.layer?.borderColor = NSColor.controlAccentColor + .withAlphaComponent(0.55).cgColor + } else { + waveformView.setDotMatrix(nil) + let safe = max(0, min(127, Int(m.melodicProgram))) + let famColor = InstrumentListView.colorForProgram(safe) + waveformView.setBaseColor(famColor) + waveformBezel?.layer?.borderColor = famColor + .withAlphaComponent(0.55).cgColor + } + } + @objc private func octaveChanged(_ sender: NSStepper) { menuBand?.octaveShift = sender.integerValue updateOctaveLabel(sender.integerValue) diff --git a/slab/menuband/Sources/MenuBand/NotepatFavicon.swift b/slab/menuband/Sources/MenuBand/NotepatFavicon.swift new file mode 100644 index 0000000000..478138e2a8 --- /dev/null +++ b/slab/menuband/Sources/MenuBand/NotepatFavicon.swift @@ -0,0 +1,79 @@ +import AppKit + +/// Lazily-loaded notepat.com favicon, cached on disk. The Notepat +/// mode button in the popover uses this as its glyph so the brand +/// is always live — whatever favicon the site is reporting today is +/// what shows up on the button. +/// +/// Cache strategy: +/// 1. On first access we synchronously return whatever's on disk +/// (or `nil` if we haven't fetched yet). +/// 2. In parallel, we kick off an async refresh from the network. +/// When it lands, the file is overwritten and observers fire. +/// 3. Subsequent app launches read the cached file immediately, +/// refreshing in the background if it's older than the TTL. +enum NotepatFavicon { + private static let url = URL(string: "https://notepat.com/favicon.ico")! + /// 24h refresh interval — the favicon doesn't change often, but + /// a long-running session shouldn't drift forever. + private static let refreshInterval: TimeInterval = 24 * 3600 + + /// Cached image (in-memory). Refreshes automatically on first + /// access if the disk cache is missing or stale. + static var image: NSImage? { + if let cached = cachedImage { return cached } + // First access — load from disk and trigger refresh. + loadFromDisk() + triggerRefreshIfNeeded() + return cachedImage + } + + private static var cachedImage: NSImage? + private static var lastDiskMTime: Date? + private static var refreshInFlight = false + + private static var cacheURL: URL { + let fm = FileManager.default + let base = (try? fm.url(for: .applicationSupportDirectory, + in: .userDomainMask, + appropriateFor: nil, + create: true)) ?? fm.temporaryDirectory + let dir = base.appendingPathComponent("MenuBand", isDirectory: true) + try? fm.createDirectory(at: dir, withIntermediateDirectories: true) + return dir.appendingPathComponent("notepat-favicon.ico") + } + + private static func loadFromDisk() { + guard let data = try? Data(contentsOf: cacheURL) else { return } + cachedImage = NSImage(data: data) + let attrs = try? FileManager.default.attributesOfItem(atPath: cacheURL.path) + lastDiskMTime = attrs?[.modificationDate] as? Date + } + + private static func triggerRefreshIfNeeded() { + let stale = (lastDiskMTime.map { Date().timeIntervalSince($0) } ?? .infinity) + > refreshInterval + guard stale, !refreshInFlight else { return } + refreshInFlight = true + let task = URLSession.shared.dataTask(with: url) { data, _, _ in + defer { refreshInFlight = false } + guard let data = data, NSImage(data: data) != nil else { return } + try? data.write(to: cacheURL, options: .atomic) + DispatchQueue.main.async { + cachedImage = NSImage(data: data) + lastDiskMTime = Date() + NotificationCenter.default.post(name: .notepatFaviconLoaded, + object: nil) + } + } + task.resume() + } + + /// Posted on the main queue when a fresh favicon lands. Observers + /// (e.g. the popover) can re-bind their image to the latest cache. + static let didLoadNotification = Notification.Name.notepatFaviconLoaded +} + +extension Notification.Name { + static let notepatFaviconLoaded = Notification.Name("NotepatFaviconLoaded") +} diff --git a/slab/menuband/Sources/MenuBand/QwertyLayoutView.swift b/slab/menuband/Sources/MenuBand/QwertyLayoutView.swift new file mode 100644 index 0000000000..3b7aa8220c --- /dev/null +++ b/slab/menuband/Sources/MenuBand/QwertyLayoutView.swift @@ -0,0 +1,241 @@ +import AppKit + +/// Tiny QWERTY keyboard map drawn into the popover. Three rows of +/// keycaps in the macOS layout (top row offset 0, home row 0.5, bottom +/// row 1.0) — same row-offset logic the QWERTY-pan uses. Note-mapped +/// keys are tinted with the current voice's family color so the user +/// can see at a glance which physical keys play notes; currently-held +/// keys light up with the accent color. +final class QwertyLayoutView: NSView { + /// Hardware key codes currently held by the user. Driven from the + /// controller's `heldKeyCodes` snapshot. Updating triggers a + /// redraw. + var litKeyCodes: Set = [] { + didSet { needsDisplay = true } + } + /// Keymap variant — controls which key codes are colored as + /// "note-mapped" (Notepat = 2-octave layout, Ableton = Live's + /// M-mode QWERTY). + var keymap: Keymap = .notepat { + didSet { needsDisplay = true } + } + /// Current voice's family color — used to tint note-mapped + /// keycaps so the keymap reads as part of the chosen instrument. + var voiceColor: NSColor = .controlAccentColor { + didSet { needsDisplay = true } + } + + /// Pointer-driven key event. Fires on mouseDown over a cap (isDown=true), + /// when the cursor drags off that cap onto another (isDown=false for the + /// old, true for the new), and on mouseUp (isDown=false). The popover + /// wires this to `MenuBandController.handleLocalKey` so taps/drags on + /// the layout map play the same notes the physical keyboard would. + var onKey: ((_ keyCode: UInt16, _ isDown: Bool) -> Void)? + + /// Hardware key code currently held by the pointer, if any. Lets us + /// release-then-press when a drag crosses into a new cap and clean + /// up on mouseUp. + private var heldByPointer: UInt16? + + static let intrinsicSize = NSSize(width: 180, height: 46) + override var intrinsicContentSize: NSSize { Self.intrinsicSize } + + override init(frame frameRect: NSRect) { + super.init(frame: frameRect) + setFrameSize(Self.intrinsicSize) + } + required init?(coder: NSCoder) { fatalError() } + + override var isFlipped: Bool { false } + + /// Three-row macOS QWERTY layout — keys identified by `kVK_*` + /// codes, mirroring `MenuBandLayout.panByKeyCode` so the visual + /// position reflects the keypad-driven pan. + private static let rows: [[(kc: UInt16, label: String)]] = [ + // Top row: q w e r t y u i o p ] + [(12, "q"), (13, "w"), (14, "e"), (15, "r"), (17, "t"), + (16, "y"), (32, "u"), (34, "i"), (31, "o"), (35, "p"), (30, "]")], + // Home row: a s d f g h j k l ; ' + [(0, "a"), (1, "s"), (2, "d"), (3, "f"), (5, "g"), + (4, "h"), (38, "j"), (40, "k"), (37, "l"), (41, ";"), (39, "'")], + // Bottom row: z x c v b n m + [(6, "z"), (7, "x"), (8, "c"), (9, "v"), (11, "b"), + (45, "n"), (46, "m")], + ] + private static let rowOffsets: [CGFloat] = [0, 0.5, 1.0] + private static let keySize: CGFloat = 14 + private static let keyGap: CGFloat = 1 + private static let cornerRadius: CGFloat = 2.5 + + override func draw(_ dirtyRect: NSRect) { + super.draw(dirtyRect) + forEachVisibleCap { cap, rect in + let st = semitone(cap.kc) + let octaves = MenuBandLayout.octaveKeyCodes(for: keymap) + let isOctaveKey = (cap.kc == octaves.down || cap.kc == octaves.up) + let black = (st.map { Self.isBlackKey(semitone: $0) }) ?? false + let isLit = litKeyCodes.contains(cap.kc) + drawKeycap(rect: rect, label: cap.label, + mapped: st != nil, isBlack: black, lit: isLit, + isOctaveKey: isOctaveKey) + } + } + + /// Walk the visible caps in draw-order, handing each its layout + /// rect. Hit testing and drawing share this so a cap rendered on + /// screen is exactly the cap a click on that pixel resolves to. + /// Skips unmapped Ableton keys (matching the draw-time hide rule) + /// so a click on empty space doesn't accidentally trigger a key + /// that isn't there. + private func forEachVisibleCap(_ body: (_ cap: (kc: UInt16, label: String), _ rect: NSRect) -> Void) { + let r = bounds + let totalRows = CGFloat(Self.rows.count) + let rowSpan = totalRows * Self.keySize + (totalRows - 1) * Self.keyGap + let topY = r.midY + rowSpan / 2 - Self.keySize + let homeRowSpan = CGFloat(Self.rows[1].count) * Self.keySize + + CGFloat(Self.rows[1].count - 1) * Self.keyGap + + Self.rowOffsets[1] * Self.keySize + let leftX = r.midX - homeRowSpan / 2 + let octaves = MenuBandLayout.octaveKeyCodes(for: keymap) + for (rIdx, row) in Self.rows.enumerated() { + let y = topY - CGFloat(rIdx) * (Self.keySize + Self.keyGap) + let xOffset = Self.rowOffsets[rIdx] * Self.keySize + for (cIdx, cap) in row.enumerated() { + let st = semitone(cap.kc) + let isOctaveKey = (cap.kc == octaves.down || cap.kc == octaves.up) + if keymap == .ableton && st == nil && !isOctaveKey { continue } + let x = leftX + xOffset + CGFloat(cIdx) * (Self.keySize + Self.keyGap) + let kr = NSRect(x: x, y: y, width: Self.keySize, height: Self.keySize) + body(cap, kr) + } + } + } + + /// Hit-test a point in view coordinates against the visible caps. + /// Returns the matching key code or nil if the point misses every + /// cap (gaps between keys, empty area around the layout). + private func keyCode(at point: NSPoint) -> UInt16? { + var hit: UInt16? + forEachVisibleCap { cap, rect in + if hit == nil && rect.contains(point) { hit = cap.kc } + } + return hit + } + + // MARK: - Pointer events + // + // mouseDown / mouseDragged / mouseUp fire onKey so a tap on a cap + // plays the same note the matching physical key would. Drag rolls + // across caps with proper release-then-press so chords don't get + // stuck and notes glissando smoothly. + + override func mouseDown(with event: NSEvent) { + let p = convert(event.locationInWindow, from: nil) + guard let kc = keyCode(at: p) else { return } + heldByPointer = kc + onKey?(kc, true) + } + + override func mouseDragged(with event: NSEvent) { + let p = convert(event.locationInWindow, from: nil) + let kc = keyCode(at: p) + if kc == heldByPointer { return } + if let prev = heldByPointer { onKey?(prev, false) } + heldByPointer = kc + if let new = kc { onKey?(new, true) } + } + + override func mouseUp(with event: NSEvent) { + if let prev = heldByPointer { onKey?(prev, false) } + heldByPointer = nil + } + + /// Returns the semitone offset for a key in the active keymap, or + /// nil if unmapped. Used to know whether the key plays a note + + /// whether that note is a white or black piano key. + private func semitone(_ kc: UInt16) -> Int? { + guard kc < 128 else { return nil } + let table = (keymap == .ableton) + ? MenuBandLayout.semitoneByKeyCodeAbleton + : MenuBandLayout.semitoneByKeyCode + let v = table[Int(kc)] + return (v == Int8.min) ? nil : Int(v) + } + + /// Black keys = sharps/flats: pitch classes 1, 3, 6, 8, 10 + /// (C#, D#, F#, G#, A#). White = the rest. We mod by 12 against + /// middle C (semitone 0 → C natural) so the mapping holds across + /// octave shifts. + private static func isBlackKey(semitone: Int) -> Bool { + let pc = ((semitone % 12) + 12) % 12 + switch pc { + case 1, 3, 6, 8, 10: return true + default: return false + } + } + + private func drawKeycap(rect: NSRect, label: String, + mapped: Bool, isBlack: Bool, lit: Bool, + isOctaveKey: Bool = false) { + let path = NSBezierPath(roundedRect: rect, + xRadius: Self.cornerRadius, + yRadius: Self.cornerRadius) + // Fills mirror the menubar piano: white-key-mapped letters + // get a near-white cap, black-key-mapped letters get a + // near-black cap. Octave-shift keys get a muted accent fill + // so they read as "control" rather than note. Unmapped + // letters stay outline-only. Lit overrides everything with + // accent color so the user can see what they're playing in + // real time. The instrument's family color stays out of the + // picture so the keymap reads as "this is which physical + // keys play piano keys" rather than another voice-colored + // ornament. + if lit { + NSColor.controlAccentColor.withAlphaComponent(0.85).setFill() + path.fill() + } else if isOctaveKey && !mapped { + NSColor.controlAccentColor.withAlphaComponent(0.18).setFill() + path.fill() + } else if mapped && isBlack { + NSColor(white: 0.08, alpha: 1.0).setFill() + path.fill() + } else if mapped { + NSColor(white: 0.92, alpha: 1.0).setFill() + path.fill() + } + let stroke: NSColor + if lit { + stroke = NSColor.controlAccentColor + } else if isOctaveKey && !mapped { + stroke = NSColor.controlAccentColor.withAlphaComponent(0.65) + } else { + stroke = NSColor.labelColor.withAlphaComponent(mapped ? 0.45 : 0.30) + } + stroke.setStroke() + path.lineWidth = 0.7 + path.stroke() + // Letter glyph centered in the cap, color follows the piano- + // key convention: white caps get black text, black caps get + // white text. Octave-shift caps wear the accent color. + let textColor: NSColor + if lit { + textColor = .black + } else if isOctaveKey && !mapped { + textColor = .controlAccentColor + } else if mapped && isBlack { + textColor = .white + } else if mapped { + textColor = NSColor(white: 0.10, alpha: 1.0) + } else { + textColor = NSColor.labelColor.withAlphaComponent(0.55) + } + let attrs: [NSAttributedString.Key: Any] = [ + .font: NSFont.systemFont(ofSize: 8.5, weight: .heavy), + .foregroundColor: textColor, + ] + let s = NSAttributedString(string: label, attributes: attrs) + let size = s.size() + s.draw(at: NSPoint(x: rect.midX - size.width / 2, + y: rect.midY - size.height / 2 - 0.5)) + } +} diff --git a/slab/menuband/Sources/MenuBand/Resources/ywft-processing-bold.ttf b/slab/menuband/Sources/MenuBand/Resources/ywft-processing-bold.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0e617fe152a0cdef1fed675ebdfecb1c60ce8eb9 GIT binary patch literal 38304 zcmZNyWME(rVq{=oVNh^$3-L|s+N;38z^KE(z#!x9;_AjI#=yeB!05riz@XqB;2%8w z-JB8z2F45q21XJ0;83R>|9AXjU|_0YU|=xt57sxz%AK6Xz`(SIfq@|*IXAJuDtY!F z1_ovx1_s7W$z>%9Mm%hO3=Av>7#J8F(hAaZyCzPEWME)rU|`@bNKY&-U|?VnU|FQ&hVB>!2IeI>`N@fXcXIwSF!VDpFfd-pO{^$js^<}4V3=?P^yXZWKJ}G(6 z3`Acvwvhts<6~f80I6hPU}9ioU}Si~zz7OG1}3OZE(QYzF9s$TH=hs&zMRC8JO(MS zJj4J0VErs0)4*&-2Bz%PqC5sZFew7o4~i)eW@2Dt;Deee0Hr$^7#WhlX7MtpFz7MZ zK%oyu^1Vc8Dtm~8I-{4xfpa9^iaY?0_+b^n1E6x z0|SHw3K}Nn(~J{9iG|gebru5yqdbIWzRr-sBmlCAgBhd@jM>39gP9Br0cox&30V-RBk zV+CU^SOwGn*Z*JrfBFB#|L6ao{eSxZ(f^14`~Nrp&;6hIzy@q5)a|$^Mm7cpMrIaP zHg*n9E>H>sVPwUO3=G^nynOrufkx|hxv2pPUiAl*R zscGpMnGDO8uUx%($G*ddjvPCB{N(9VXU?8Kcj4ltE0?cczjpi9ox2RvdwTmB<{X>~ z3Oj}syBKCLF!ap^J96TDh7&gzc25RzCM{s-TC{Zg!$%+v1H%o52TvJZfZ1~y7#NnU zS-f`D`VAY`ZQaJOWzXK-3=9m@z>-*rX$;et+87oxOl6q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Rep-n=+gaw3MgtLSf3EvPA5U~=e5?Lp5MU+R>MRcC%4KX1xH?bJ831aWW6~v>& z8^kw=f00m=2$1NII3)2;(nzvMa)abGDLyF=sTQdnQg@^oq&1}7q^qRYNk5U1lL?UN zk=Y^hL{>!BMm9}$hU`5#2{|LVD!D820rK{C3TRHkgEoT0o%g-Jz6 zB}`?8s)}lX>Lk@&s*luU)J~|gsXx(}qOnV3m!^m26RifVL)tRhX4(PTecESq_;dnv z>U3`Cs_C}r9@7)k+oB(%KTH3bfslcYL5aZ@!!pA=MrKAwjM+GRb*hRJ4v%>i3ya7p}< z!38u42VPC-#Sq0%%)r2Kk-Gp=G&6`Zg70gDl;dy`QnoXK)i8re2%CigeB(M;gpGlL zL56{ufsuuifq|g}&Sqp_VweCGXJTMtm;_}rGcYksfwEZ`n854!L3&vk6c}be#n~8` z7!yP#|i1{p>*D4UZ(g3$@e=3*#ejDoVc8LSx3LD@VER!kgFwg7`16HL7z z0|!$ARQv>k2~!4?eUia|X%2+VxP(E5=}cvLT8VB!QGRl2adBo|x^7Z_PKrW!YLZ)i zUI~LULq0ohI9r6 z1}BDmh8%_z1_g#p29RBe3v?7M$rBEeCNxM$&k#D!H~$1 z3ihEhLncEWL*jsh9w?4V7z!Ay81xzR8Op&>kD(GAH|5|s$!16c(YjJtibYC z3?>Zb(6ngCV2U>lg4=xH{EUn6-obDpC}JZcV_)P3#+@7t91O_?8yQ%gHc2xwXn`1; zdAJxkAS?+sFpJG;7qbKCx-hMc4D3$37!E+#%nU9YRTw)0BQ`j6L~LYEaoMN_;_c#S oU|?i%=tvHU*vQP_5*Zm8xmkdNkwi_@% literal 0 HcmV?d00001 diff --git a/slab/menuband/Sources/MenuBand/Resources/ywft-processing-regular.ttf b/slab/menuband/Sources/MenuBand/Resources/ywft-processing-regular.ttf new file mode 100644 index 0000000000000000000000000000000000000000..84edfa67a0eecfb72f36ff26fd3b9a77b550626d GIT binary patch literal 36012 zcmZNyWME(rVq{=oVNh^$3-L|s+V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^~P+*u1WwS9bG3cl6NQQ6*H--=f1%?2IB8Gg1WCoB~ART!O=?n@CK@6!3=?tX|ISh#mMGOiInG7Hs z6B!g3N*Ib55*bp!ZUf0>Gbk|RGo%sp1wKFeGGsC&Gh{F%GNgk2>CBMHkjIcXAYllK zsS<_)1}g@A27QKdFw|qH1jkT0IA*dL(!g{HJcg1P@)>f$aZH|0{IP)=7x=r8a4~W~SQ2bt7Ms&9W(NjF z22QPw4D3$37!E+#%nU9YRTw)0BQ`j6L~LYEaoMN_;_c#SU|?i%=tvHU*vQP_5*Zm8 YxmkdNkw 0.5) && (((mask >> segIndex) & 1u) != 0u); + bool levelLit = y01 < in.level; + bool lit = maskLit || levelLit; float3 color = lit ? (tier + bloom * 0.40) : tier; float a = lit ? u.color.a : (u.color.a * UNLIT_ALPHA); return float4(min(color, 1.0), a); @@ -353,6 +401,10 @@ private struct BarUniforms { var stride: Float = 0 var minHeight: Float = 1.5 var color: SIMD4 = SIMD4(0, 1, 1, 1) + /// Set to 1 when the bars should render the dot-matrix pattern + /// (see `dotMasks`) instead of the continuous-level VU. Used in + /// MIDI mode to spell "MIDI" out of the LED segments. + var dotMatrix: Float = 0 } extension WaveformView: MTKViewDelegate { @@ -396,6 +448,11 @@ extension WaveformView: MTKViewDelegate { length: MemoryLayout.size * n, index: 1) } + dotMasks.withUnsafeBufferPointer { ptr in + enc.setVertexBytes(ptr.baseAddress!, + length: MemoryLayout.size * n, + index: 2) + } enc.drawPrimitives(type: .triangle, vertexStart: 0, vertexCount: 6, -- knotmirror 0.0.1