EarTrumpet

repository·master·Indexed 11 days ago

https://github.com/file-new-project/eartrumpet

A Windows audio management application providing a granular volume mixer for individual apps and playback devices. Built with WPF, it features a modern UI, customizable hotkeys, and support for add-ons via the IAddonLifecycle interface. The documentation covers installation, compilation from source, a custom Theme:Brush system for XAML theming, and core data model interfaces like IAudioDeviceManager and IAppInfo.

Tokens
2.4K
Snippets
5
Records
13
Agent score
93%

What's inside EarTrumpet

  1. Overview of EarTrumpet features

    master

    EarTrumpet is an advanced audio management utility for Windows that provides fine-tuned control over app and system volumes. Key capabilities include:

    • Standalone Volume Mixer: A dedicated interface for managing audio levels.
    • Per-App Device Routing: The ability to move specific applications between different playback devices.
    • Playback Device Management: Manage default playback devices.
    • Visual Audio Feedback: Visualizes audio with multi-channel aware peaking.
    • Customization: Supports light/dark modes, all Windows accent colors, and configurable hotkeys.
    • Modern UI: Uses modern context menus and integrates with Windows themes.
    • Automatic Updates: Managed via the Microsoft Store.
  2. Overview of EarTrumpet

    master

    EarTrumpet is a Windows Presentation Foundation (WPF) application that provides an enhanced volume mixer experience. It features a notification area icon with a context menu, a flyout, and a volume mixer window.

    Key capabilities include:

    • Independent App Controls: Control volume for individual applications and devices.
    • Device Management: Change the default audio device directly from the context menu.
    • Customizable Hotkeys: Assign hotkeys in settings to trigger the flyout, volume mixer, or settings window.
    • Modern UI: Uses the Windows Multimedia Device API to provide a richer, more modern interface than the standard system volume controls.
  3. Extend EarTrumpet with Add-ons

    master

    EarTrumpet supports extensibility through add-on assemblies. To create an add-on, you must implement the IAddonLifecycle interface within an external assembly.

    Loading and Hosting:

    • The AddonManager uses an AddonResolver to load applicable add-ons into an AddonHost (accessible via AddonManager.Host).
    • Add-ons are located in the Versions\[EarTrumpet version] folder. An add-on package can support multiple EarTrumpet versions.
    • If a compatible EarTrumpet version is not found, the add-on will not be loaded.
    • Dependent assemblies are located using AppDomain.CurrentDomain.AssemblyResolve within the add-on directories.

    Cross-Add-on Communication: Add-ons can communicate using the ServiceBus. For example, one add-on can register at ApplicationLifecycleEvent.Startup and another can retrieve the service at ApplicationLifecycleEvent.Startup2.

  4. Install EarTrumpet

    master

    EarTrumpet can be installed via the Microsoft Store or through various command-line package managers.

    Microsoft Store

    Install directly from the Microsoft Store.

    Package Managers

    Use winget or Chocolatey for command-line installation.

    # Using winget
    winget install File-New-Project.EarTrumpet
    
    # Using Chocolatey
    choco install eartrumpet
  5. Use Theme:Brush for WPF Theming

    master

    EarTrumpet uses a custom Theme:Brush system to support Windows theme configurations (High Contrast, Light/Dark, Accent Color, and Transparency) in XAML. This allows UI elements to adapt dynamically at runtime.

    Basic Usage: Apply brush values directly to XAML elements:

    <TextBlock Theme:Brush.Foreground="SystemAccent" />

    Color Values:

    • Static Colors: Use names like Red, #FFaabbcc, or SystemAccentDark1.
    • Theme-Specific Values: Specify values for different modes using the format Light=Value, Dark=Value, HighContrast=Value or using the {Theme} variable:
      <!-- Using the {Theme} variable -->
      Theme={Theme}ChromeWhite, HighContrast=Highlight
    • Transparency: You can optionally modify the alpha channel using a value between 0.0-1.0. For example, Light=LightChromeWhite/0.8 makes the color 80% opaque in Light mode.

    Supported Color Sources:

    • System.Windows.Media.ColorConverter.ConvertFromString("*ColorName*") (e.g., #aa000000)
    • EarTrumpet.Interop.ImmersiveSystemColors.Lookup("*ColorName*") (e.g., SystemAccent1)
    • System.Windows.Media.Colors.*ColorName* (e.g., Red)
    • System.Windows.Media.SystemColors.*ColorName* (e.g., HotTrack)
    • <Theme:Ref Key="*ColorName*"> references defined in App.xaml.

    Advanced Theming (Rules and Scopes):

    • Theme:Options.Scope: Allows different colors for the flyout versus other UI surfaces. Example: Flyout:Theme=Red, Flyout:HighContrast=HotTrack, :Theme=Blue, :HighContrast=HotTrack (where : denotes the default scope).
    • Theme:Options.Source: Set at the top level window to App or System. Taskbar and flyout use System; other windows use App.
  6. Compile EarTrumpet from source

    master

    To build EarTrumpet locally, you must satisfy specific Windows development requirements and follow a sequence of installation and build steps using Visual Studio.

    Requirements

    • Visual Studio 2017 (or newer) with the following workloads installed:
      • .NET desktop development
      • Universal Windows Platform development
    • Git for Windows
    • Windows 10 Anniversary Update (or newer)
    • .NET Framework 4.6.2 Developer Pack
    • Windows 10 SDK (10.0.14393.0)

    Build Steps

    1. Install the required workloads and SDKs listed above.
    2. Clone the repository:
      git clone https://github.com/File-New-Project/EarTrumpet.git
    3. Open the EarTrumpet.vs15.sln solution file in Visual Studio.
    4. Set the target platform to x86.
    5. Build the EarTrumpet.Package project.
    git clone https://github.com/File-New-Project/EarTrumpet.git
  7. Supported operating systems

    master

    EarTrumpet is compatible with the following Windows versions:

    • Windows 10 1803 (April 2018 Update)
    • Windows 10 1809 (October 2018 Update)
    • Windows 10 1903 (May 2019 Update)
    • Windows 10 1909 (November 2019 Update)
    • Windows 10 2004 (May 2020 Update)
    • Windows 10 20H2 (October 2020 Update)
    • Windows 10 21H1 (May 2021 Update)
    • Windows 10 21H2 (November 2021 Update)
    • Windows 10 22H2 (October 2022 Update)
    • Windows 11
  8. Reference: EarTrumpet Data Model Interfaces

    master

    The following interfaces define the core audio and application data models used by EarTrumpet:

    • IAppInfo: Produced by AppInformationFactory from a process ID (PID). Contains display name, icon location, background color, etc.
    • IAudioDeviceManager: Manages an automatically updating observable collection of devices, including a default device.
    • IAudioDevice: Represents an individual audio device and its associated applications.
    • IAudioDeviceSession: Represents a specific application with an active audio session.
    • IAddonLifecycle: The required interface for implementing EarTrumpet add-ons.
  9. Reference: EarTrumpet Diagnosis and Debugging Tools

    master

    EarTrumpet includes several tools for error reporting and debugging:

    • Bugsnag: The primary error reporting service used for crash notifications.
    • ErrorReporter: Encapsulates the Bugsnag connection and manages metadata sent during notifications.
    • CircularBufferTraceListener: Maintains a small internal buffer of log messages viewable only upon user request.
    • LocalDataExporter: Transforms an IAudioDeviceManager into a string for debugging purposes.
    • SnapshotData: Contains metadata dictionaries populated during crashes or user requests.
    • VSDebug Mode: A specialized configuration that enables TemporaryAppItemViewModel (marked with a red background) and bypasses app identity checks to prevent startup exceptions.
  10. AppRef static identifiers

    master

    The AppRef class provides static string constants for targeting broad application scopes in EarTrumpet Actions:

    ConstantValueDescription
    EveryAppId"EarTrumpet.EveryApp"Targets all applications.
    ForegroundAppId"EarTrumpet.ForegroundApp"Targets the application currently in the foreground.
    public static readonly string EveryAppId = "EarTrumpet.EveryApp";
    public static readonly string ForegroundAppId = "EarTrumpet.ForegroundApp";