Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8691605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:09:09+00:00 2026-06-13T00:09:09+00:00

Background: In Windows Vista and above, using an expanded Core Audio API (by Ray

  • 0

Background: In Windows Vista and above, using an expanded Core Audio API (by Ray Molenkamp and Xavier Flix) to enforce volume levels by subscribing to the DefaultAudioEndpoint’s OnVolumeNotification and setting the volume when it changes.

Problem: Functionally successful, but as soon as a subscription to OnVolumeNotification is registered, the CPU tends to get pegged at 30-50% depending on the power of your CPU. After much digging with Process Explorer & Process Monitor it was revealed that explorer.exe and sometimes svchost.exe would become consumed by registry read calls. I am uncertain of which registry key. I don’t believe I am subscribing to this event in a harmful way as I manage subscription carefully — it’s only being fired once.

Logical process of enforcing volume

  1. Unsubscribe from endpoint OnVolumeNotification
  2. Set endpoint volume scalar property (effective immediately)
  3. Subscribe to endpoint OnVolumeNotification

The underlying win32 methods involved in the Core Audio API are RegisterControlChangeNotify and UnregisterControlChangeNotify. Is it possible the issue is caused by these or the implementation of the event subscription?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:09:10+00:00Added an answer on June 13, 2026 at 12:09 am

    Rather than:

    1. Unsubscribing
    2. Change volume / set mute
    3. Re-Subscribe

    I modified my logic to essentially use logic in properties with backing fields to manage when to update. It isn’t perfect, but it’s pretty damn close and it doesn’t eat up any CPU and it allows for external input from a slider with full support for INPC.

    public EndpointVolumeEnforcer() {
      try {
        mmDeviceEnumerator = new MMDeviceEnumerator();
        mmDevice = mmDeviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
        audioEndpointVolume = mmDevice.AudioEndpointVolume;
        audioEndpointVolume.OnVolumeNotification += data => {
          VolumePercent = Convert.ToInt16(data.MasterVolume*100);
          DeviceIsMuted = data.Muted;
        };
        DesiredVolume = 65;
      }
      catch (Exception ex) {
        // Logging logic here
      }
    }
    
    public int DesiredVolume {
      get { return _desiredVolume; }
      private set {
        if (_desiredVolume == value) return;
        _desiredVolume = value;
        NotifyOfPropertyChange();
        Enforce(_desiredVolume);
      }
    }
    
    public int VolumePercent {
      get { return volumePercent; }
      private set {
        if (volumePercent == value) return;
        volumePercent = value;
        if (volumePercent != _desiredVolume) {
          volumePercent = _desiredVolume;
          Enforce(volumePercent);
        }
      }
    }
    
    public void Enforce(int pct, bool mute = false) {
      var adjusted = Convert.ToInt16(audioEndpointVolume.MasterVolumeLevelScalar*100);
      if (adjusted != DesiredVolume) {
        audioEndpointVolume.MasterVolumeLevelScalar = pct/100f;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A little background... I use Windows XP, Vista, and 7 quite frequently. As such,
As told here Qt: Erase background (Windows Aero Glass) , I'm using WA_TranslucentBackground to
I'm using Windows Vista and C#.net 3.5, but I had my friend run the
I'm having problems using the DWM functionality of Windows Vista/7 on Java windows. I
I have a java program that is running in the background(Windows). I would like
I'm a linux newbie coming from a Windows background and I am trying to
I am porting an application which runs as a background service in windows at
Background: I'm a windows developer at MegaCorp(tm) and I am getting new hardware soon.
Background info: I have a windows application (in c#) that handles a custom file
Some background: we have a windows application (c#) that locate in the system try.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.