Architecture Overview

EarTrumpet is a Windows Presentation Foundation (WPF) application that provides enhanced audio control for Windows. This document provides a high-level overview of its internal architecture, based on the technical documentation found in the source code.

Key Components

The application is logically divided into several key components:

  1. Main Application Layer (EarTrumpet/): This is the WPF application itself. It consists of a notification area icon, a context menu, a primary flyout UI, and a standalone volume mixer window.

    • The flyout is created at startup and held in memory for quick display.
    • The volume mixer and settings windows are single-instance and created on demand.
  2. Data Models (EarTrumpet/DataModel/): This layer is responsible for abstracting the core logic and data of the application.

    • AppInformation: Handles retrieving application details (display name, icon, etc.) from a process ID (PID). It has distinct logic for classic Win32 apps and modern UWP apps.
    • Audio: Defines the core interfaces for audio management, such as IAudioDeviceManager, IAudioDevice, and IAudioDeviceSession.
    • WindowsAudio: The concrete implementation of the Audio interfaces, using the Windows Multimedia Device API (MMDevice API) to interact with the system's audio endpoints.
    • Storage: Manages persistence of user settings. It intelligently switches between using the registry (for non-packaged builds) and Windows Storage (for packaged/Store builds).
  3. Services (EarTrumpet/DataModel/): Background services that provide ongoing functionality.

    • ProcessWatcherService: Monitors running processes that have active audio sessions. When a process terminates, this service ensures its corresponding UI is removed from EarTrumpet.
  4. UI Layer (EarTrumpet/UI/): Contains all WPF Views, ViewModels, custom controls, and the theming engine.

    • ViewModels: Manages the state and logic for the UI, following the MVVM pattern.
    • Views: Defines the XAML structure of the windows and controls.
    • Themes: A custom theming engine that allows EarTrumpet to match the look and feel of Windows, including light/dark modes, accent colors, and transparency. More details can be found in the Theming Engine document.
  5. Extensibility (EarTrumpet/Extensibility/): A system for loading external add-on assemblies, allowing for third-party feature expansion.

Technical Documentation

For a more detailed breakdown of each component, refer to the technical documentation within the repository: