Skip to content

feat(#300): スペクトラムに透明度と角丸の設定キーを追加#302

Merged
GeneralD merged 7 commits into
mainfrom
feat/#300-spectrum-opacity-corner
Jul 5, 2026
Merged

feat(#300): スペクトラムに透明度と角丸の設定キーを追加#302
GeneralD merged 7 commits into
mainfrom
feat/#300-spectrum-opacity-corner

Conversation

@GeneralD

@GeneralD GeneralD commented Jul 4, 2026

Copy link
Copy Markdown
Owner

agent type breaking scope tests review

概要

#297 のフォローアップ。スペクトラムアナライザに bar_opacity(バーの不透明度)と bar_corner_radius(バーの角丸半径)の設定キーを追加する。どちらもデフォルトで既存の描画結果を保つ後方互換な追加。

変更内容

  • bar_opacity01、既定 1): バー全体の不透明度。背景描画の後・バー塗りの前に GraphicsContext.opacity としてバー層へ適用するので、bar_color 自身のアルファと乗算合成され、background_color とは独立して効く。不透明な bar_color と併用すれば「色」と「透明度」を分離指定できる。ConfigRepository0…1 にクランプ。
  • bar_corner_radius(既定 nil = 自動): バーの角丸半径(pt)。従来コード固定だった min(bar_width/4, 3) を純粋関数 autoCornerRadius(thickness:) に抽出してテスタブル化し、spectrumBarRects にオプショナルの cornerRadius: 引数を追加。指定時は per-bar で厚みの半分にクランプ(0 で角なし)。ConfigRepository0 下限にクランプ。
  • Config → Style → View の既存パイプライン(SpectrumConfig / SpectrumStyle / ConfigRepository / SpectrumView)に沿って伝搬。
  • README.md / .claude/CLAUDE.md を更新。
  • バージョンを 2.20.0 に更新。

背景・動機

#297 のクローズ時に残った軽微な設定化2項目を切り出したフォローアップ(#297#300)。「良い状態をデフォルトで見せつつ、必要なら調整できる」という本プロジェクトの方針に沿って、curated-default-but-configurable として追加する。

テスト計画

  • ConfigDecodingTests: セクション欠如で bar_opacity == 1 / bar_corner_radius == nil、明示指定のデコード
  • ConfigTemplateTests: TOML / JSON テンプレートのスナップショット更新
  • ConfigRepositoryTests: opacity の 0…1 クランプ、corner radius の 0 下限クランプ、パススルー
  • SpectrumBarRectsTests: autoCornerRadius(thickness:)cornerRadius の nil→自動 / 明示 / 0→角なし / 厚み半分クランプ / 負値フロア
  • 全テスト 1090 件パス、make lint クリーン

備考

  • デフォルトの描画結果は不変bar_opacity 既定 1.0 + bar_corner_radius 既定 = 従来の自動式と同一)。2つのノブはどちらも opt-in。
  • 視覚デモはデフォルトでは差分ゼロで、ノブの効果を映すにはスペクトラム有効化 + System Audio Recording の TCC 許可 + 実際の再生音源が要る。必要なら別途キャプチャして貼るので声かけてください。

Closes #300

Summary by CodeRabbit

  • New Features

    • Added optional [spectrum] tuning keys for bar appearance: bar_opacity and bar_corner_radius.
    • Spectrum bars now use derived corner rounding by default, with an explicit per-config override when set.
  • Bug Fixes

    • Improved spectrum style sanitization by clamping bar_opacity to 0…1 and ensuring bar_corner_radius is non-negative.
  • Documentation

    • Updated configuration docs and generated config templates to include the new spectrum options.
  • Tests

    • Expanded tests for spectrum config decoding, style sanitization, and corner-radius behavior.

GeneralD added 2 commits July 4, 2026 22:03
#297 フォローアップの軽微な設定化2項目。どちらもデフォルトで既存の見た目
を維持する後方互換。

- bar_opacity (0–1, 既定 1): バー全体の不透明度。背景描画の後に
  GraphicsContext.opacity としてバー層へ適用するので bar_color 自身の
  アルファと乗算合成され、background_color とは独立。不透明な bar_color
  と併用すれば色と透明度を分離できる。
- bar_corner_radius (既定 nil = 自動): バーの角丸半径。コード固定だった
  min(bar_width/4, 3) を純粋関数 autoCornerRadius(thickness:) へ抽出して
  テスタブル化し、spectrumBarRects にオプショナルの cornerRadius: 引数を
  追加 (per-bar で厚みの半分にクランプ、0 で角なし)。
- ConfigRepository で opacity を 0…1、corner radius を 0 下限にクランプ。

Config → Style → View の既存パイプラインに乗せ、SpectrumConfig /
SpectrumStyle / ConfigRepository / SpectrumView / README / CLAUDE.md を更新。
デコード・クランプ・幾何 (autoCornerRadius / cornerRadius クランプ) を
ユニットテストで検証。

Closes #300
Copilot AI review requested due to automatic review settings July 4, 2026 13:06
@GeneralD GeneralD self-assigned this Jul 4, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f45e7cbb-eed2-43b1-b93a-812755b07500

📥 Commits

Reviewing files that changed from the base of the PR and between 28fe7a7 and 289d820.

📒 Files selected for processing (1)
  • Tests/PresentersTests/SpectrumPresenterTests.swift

📝 Walkthrough

Walkthrough

Adds two backward-compatible Spectrum options, bar_opacity and bar_corner_radius, through config decoding, style loading, rendering, tests, docs, and a version bump.

Changes

Spectrum bar opacity and corner radius

Layer / File(s) Summary
Config schema and decoding
Sources/Entity/Config/SpectrumConfig.swift, Tests/ConfigDataSourceTests/*
Adds barOpacity and barCornerRadius to SpectrumConfig with defaults, coding keys, decode fallback, and updated decoding/template expectations.
Style struct and repository clamping
Sources/Entity/Style/SpectrumStyle.swift, Sources/ConfigRepository/ConfigRepositoryImpl.swift, Tests/ConfigRepositoryTests/ConfigRepositoryTests.swift
Adds matching SpectrumStyle fields and initializer parameters, then clamps opacity and corner radius when loading app style.
Bar rendering with opacity and corner radius
Sources/Views/Spectrum/SpectrumView.swift, Tests/ViewsTests/SpectrumBarRectsTests.swift
Applies style.barOpacity during drawing and routes barCornerRadius into bar rectangle generation, which now supports explicit or derived corner radii.
Documentation and version bump
README.md, .claude/CLAUDE.md, Sources/VersionHandler/Resources/version.txt
Documents the new [spectrum] keys and updates the stored version to 2.20.0.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • GeneralD/lyra#296: Introduces the spectrum overlay pipeline that this PR extends with bar_opacity and bar_corner_radius.
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Most changes are in scope, but the SpectrumPresenterTests tickUntil rewrite appears unrelated to the requested config feature. Remove or justify the SpectrumPresenterTests helper rewrite unless it is required for this PR's spectrum config work.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding independent opacity and corner-radius settings for the spectrum display.
Linked Issues check ✅ Passed The PR appears to implement both requested follow-ups, keeps them in [spectrum], preserves defaults, and updates docs, tests, and config plumbing.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#300-spectrum-opacity-corner

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two new opt-in spectrum appearance knobs—master bar opacity and configurable bar corner radius—wired through the existing Config → Style → View pipeline while keeping default rendering unchanged.

Changes:

  • Add [spectrum] config keys bar_opacity (0–1, default 1) and bar_corner_radius (optional; default auto).
  • Implement bar-layer opacity in SpectrumView and extract the default corner radius into autoCornerRadius(thickness:), with per-bar clamping.
  • Update docs, templates/snapshots, tests, and bump version to 2.20.0.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Tests/ViewsTests/SpectrumBarRectsTests.swift Adds unit tests for autoCornerRadius and spectrumBarRects corner-radius clamping behavior.
Tests/ConfigRepositoryTests/ConfigRepositoryTests.swift Verifies repository clamping for bar_opacity (0…1) and bar_corner_radius (floored at 0).
Tests/ConfigDataSourceTests/ConfigTemplateTests.swift Updates expected TOML/JSON templates to reflect the new default bar_opacity field.
Tests/ConfigDataSourceTests/ConfigDecodingTests.swift Adds decoding coverage for default and explicitly-specified bar_opacity / bar_corner_radius.
Sources/Views/Spectrum/SpectrumView.swift Applies barOpacity to the bar layer and threads barCornerRadius into geometry; introduces autoCornerRadius.
Sources/VersionHandler/Resources/version.txt Bumps version from 2.19.0 to 2.20.0.
Sources/Entity/Style/SpectrumStyle.swift Extends SpectrumStyle with barOpacity and barCornerRadius.
Sources/Entity/Config/SpectrumConfig.swift Extends SpectrumConfig Codable model with bar_opacity and bar_corner_radius keys + defaults.
Sources/ConfigRepository/ConfigRepositoryImpl.swift Clamps barOpacity and floors barCornerRadius when building SpectrumStyle.
README.md Documents the new spectrum keys and their behavior/defaults.
.claude/CLAUDE.md Updates architecture/feature notes to include the new spectrum knobs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Sources/Views/Spectrum/SpectrumView.swift Outdated
Comment thread .claude/CLAUDE.md Outdated
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
Sources/Views/Spectrum/SpectrumView.swift 61.53% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

GeneralD and others added 3 commits July 5, 2026 01:41
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- SpectrumConfig.barOpacity の doc コメント: グラデの各 stop の alpha 比率を
  保ったまま1ノブで全体をフェードできるエルゴノミクスを前面に出す
- README.md の bar_opacity 行: 同趣旨で書き換え(per-stop alpha を手計算不要
  という key value を一文で伝える)

「hex alpha と冗長では?」という誤解を防ぐための記述改善。

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

GeneralD added 2 commits July 5, 2026 04:05
CI 高負荷時、tickUntil の 3 秒壁時計デッドラインでは leaky integrator の
~4x overshoot から <1 まで落ちる tick 数が足りずフレーキーに失敗していた。
終了条件を秒数ではなく tick 数の予算に切り替え、負荷時は遅くなるだけで
デッドラインを踏まないようにした。1ms sleep は capturing フラグの
メインキュー配送を drain する用途で残置。
@GeneralD GeneralD merged commit 4e08d67 into main Jul 5, 2026
4 of 6 checks passed
@GeneralD GeneralD deleted the feat/#300-spectrum-opacity-corner branch July 5, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

スペクトラム表示: 透明度の独立キーと角丸の設定化 (#297 フォローアップ)

2 participants