Skip to content

Implement setChordDisplay and setChordPlayback API methods #207

@joekotvas

Description

@joekotvas

Summary

setChordDisplay() and setChordPlayback() are defined in api.types.ts and stubbed in src/hooks/api/chords.ts, but currently return NOT_IMPLEMENTED. The corresponding getters (getChordDisplay(), getChordPlayback()) work correctly and return the config from props.

Current behavior

score.setChordDisplay({ notation: 'roman' });
// → { ok: false, code: 'NOT_IMPLEMENTED', message: '...' }

Expected behavior

setChordDisplay should update the chord display configuration (notation system, symbol style) and trigger a re-render. setChordPlayback should update playback settings (enabled, velocity).

Implementation notes

The config is currently passed as a React prop (config.chord?.display), so the setters need a state management path to update it. Options:

  1. Lift config into a ConfigEngine (mirrors ScoreEngine/SelectionEngine pattern)
  2. Use a simpler useState in useScoreAPI that merges with the prop-provided config
  3. Emit config change events and let the parent component handle it

Files involved

  • src/api.types.ts — Interface (already defined, marked @status stub)
  • src/hooks/api/chords.ts — Stub implementations (~lines 720-780)
  • src/hooks/api/useScoreAPI.ts — Where config state management would live
  • docs/COOKBOOK.md — Recipe references these methods (has NOTE about stub status)
  • docs/features/chord-symbols/SRS.md — §4.5 API specification

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions