Skip to content

Implement IAudioHardwareProvider interface consolidation #24

@danieljsinclair

Description

@danieljsinclair

Issue Type

Implementation - Architecture Refactoring

Severity

High - Critical path for Option B implementation

Problem Statement

Current architecture has platform-specific code scattered across AudioPlayer and lacks proper hardware abstraction. Need consolidated IAudioHardwareProvider interface.

Current State

  • Audio hardware lifecycle mixed in AudioPlayer (8 responsibilities)
  • Platform code scattered (CoreAudioPlatform exists but not integrated)
  • IAudioPlatform interface exists but unused
  • Cannot swap hardware implementations
  • Tight coupling to macOS CoreAudio

Target State

Single IAudioHardwareProvider interface for all hardware operations:

  • initialize() - hardware initialization
  • configure() - format and buffer setup
  • start() / stop() - playback control
  • setVolume() - volume control
  • cleanup() - resource cleanup
  • registerCallback() - audio callback registration

Implementation Tasks

  1. Design IAudioHardwareProvider interface
  2. Create IAudioHardwareProvider.h with proper documentation
  3. Define platform-specific implementations (CoreAudioHardwareProvider)
  4. Abstract platform-specific types

Acceptance Criteria

  • IAudioHardwareProvider.h interface created with clear method documentation
  • Interface abstracts all hardware operations (no platform-specific types)
  • Platform implementations isolated in src/audio/platform/
  • No macOS CoreAudio types in interface
  • Clear injection points for DI
  • Interface location: src/audio/IAudioHardwareProvider.h

Testing Requirements

  • Interface can be mocked for unit tests
  • Platform implementations can be swapped
  • No circular dependencies with AudioPlayer
  • Mock hardware provider works for testing

Related Issues

References

  • ARCHITECTURE_FILE_CLASS_AUDIT.md - Platform coupling violations
  • AUDIO_MODULE_ARCHITECTURE.md - Cross-platform requirements
  • PLATFORM_AUDIO_RESEARCH.md - iOS/ESP32 requirements

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