Frosthaven / voicemeeter-windows-volume

Tray app that allows you to sync windows volume and mute state to Voicemeeter volume controls
265 stars 9 forks source link

Volume will only be -60 or +12 #9

Closed ForthtuN closed 2 years ago

ForthtuN commented 2 years ago

Hi, on Windows 11, latest with latest voicemeeter banana.

When changing the volume with my media key, if windows volume is at 100%, then voicemeeter will be at full, +12, however if i go down to 99% in windows, it will just directly down to -60 in voicemeeter. I can't go anything in between +12 or -60, just those two it seems.

Frosthaven commented 2 years ago

I can't seem to replicate this on my Win11 machines.

Can you tell me what build version of Windows (dev/beta/stable) and Voicemeeter you are on?

And what options you have checked in this App?

ForthtuN commented 2 years ago

Im using latest Windows 11 update, no dev or beta, Windows 11 pro 21h2 OS 22000.348.

I haven't touched any settings but "limit max gain to 0-db"

Using latest Voicemeeter banana 2.0.6.1

So strange, tested rebooting system and reinstalling it without working, tested latest version also, same problem :/

Frosthaven commented 2 years ago

propper logging is still on the todo list, but in the meantime - can you:

  1. Exit voicemeeter windows volume
  2. Navigate to InstallDirectory/required/
  3. Right click VMWV.exe and click Run as Administrator

This will launch the application in a visual feedback mode. If you notice any errors there, a screenshot would be very helpful!

ForthtuN commented 2 years ago

Nope no error :/

Its just like Voicemeeter wont hook to changing volume with vwm, it will only go between -60 and +12, nothing in between even if i set my windows volume to like 40, its still at -60 in voicemeeter, until i go in windows to 100% then it jumps to +12 in voicemeeter, And when i lower to 99% in windows it jumps down to -60 again in voicemeeter. Ive tried with my media keys and also with dragging the windows slider for volume, nothing helps. It just wont hook between these values. So strange

Edit* Noticed however, anything between 1-99 in windows volume wont trigger "Mute" in Voicemeeter, only when i hit 0% windows volume it will trigger mute.

If i go into Audio settings on my computer, it will change the volume according to windows for "VoiceMeeter input", however, its just not hooking into voicemeeter banana for any inputs or outputs i try in "Bind windows volume to", other than changing it between the values above.

The error seems somehow that it just wont hook binds into Voicemeeter banana directly someh funkar ow

Frosthaven commented 2 years ago

Do me a favor if you can:

Open powershell and type Get-ExecutionPolicy, then hit enter. Does it say restricted?

If so, run Set-ExecutionPolicy unrestricted and restart vmwv.

This may not be the issue, but its worth ruling out.

ForthtuN commented 2 years ago

Okey, so it said "restricted" at first, i changed it with your command so now it says unrestricted, didn't help however, still same. Rebooted my pc also and tested just to be sure.

Frosthaven commented 2 years ago

So strange! Can you try opening settings.json and let me know what the "polling_rate" is set to? Or better yet, upload your settings.json here.

I'm going to obsess over the cause of this.

ForthtuN commented 2 years ago

Yes i don't know why it wont work, have been testing so many things now trying to get it to work but yet nothing :/

(Had to copy paste the text, json file upload is not allowed as attachment)

{ "polling_rate": 100, "gain_min": -60, "gain_max": 12, "start_with_windows": true, "limit_db_gain_to_0": false, "remember_volume": false, "disable_donate": false, "audiodg": { "priority": 128, "affinity": 2 }, "toggles": [ { "setting": "Strip_0", "value": false }, { "setting": "Strip_1", "value": false }, { "setting": "Strip_2", "value": false }, { "setting": "Strip_3", "value": false }, { "setting": "Strip_4", "value": false }, { "setting": "Strip_5", "value": false }, { "setting": "Strip_6", "value": false }, { "setting": "Strip_7", "value": false }, { "setting": "Bus_0", "value": true }, { "setting": "Bus_1", "value": false }, { "setting": "Bus_2", "value": false }, { "setting": "Bus_3", "value": false }, { "setting": "Bus_4", "value": false }, { "setting": "Bus_5", "value": false }, { "setting": "Bus_6", "value": false }, { "setting": "Bus_7", "value": false }, { "setting": "restart_audio_engine_on_device_change", "value": false }, { "setting": "restart_audio_engine_on_app_launch", "value": false }, { "setting": "start_with_windows", "value": false }, { "setting": "limit_db_gain_to_0", "value": false }, { "setting": "remember_volume", "value": false }, { "setting": "apply_volume_fix", "value": false }, { "setting": "apply_crackle_fix", "value": false } ] }

Frosthaven commented 2 years ago

try setting polling rate a bit higher, around 300-400

ForthtuN commented 2 years ago

Tried up to a 1000nd still the same

Frosthaven commented 2 years ago

alright lets try this. im going to give you two commands to copy and paste.

open powershell

copy/paste the following large code block into powershell and hit enter

Add-Type -TypeDefinition @'
using System.Runtime.InteropServices;
[Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IAudioEndpointVolume
{
    // f(), g(), ... are unused COM method slots. Define these if you care
    int f(); int g(); int h(); int i();
    int SetMasterVolumeLevelScalar(float fLevel, System.Guid pguidEventContext);
    int j();
    int GetMasterVolumeLevelScalar(out float pfLevel);
    int k(); int l(); int m(); int n();
    int SetMute([MarshalAs(UnmanagedType.Bool)] bool bMute, System.Guid pguidEventContext);
    int GetMute(out bool pbMute);
}
[Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IMMDevice
{
    int Activate(ref System.Guid id, int clsCtx, int activationParams, out IAudioEndpointVolume aev);
}
[Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IMMDeviceEnumerator
{
    int f(); // Unused
    int GetDefaultAudioEndpoint(int dataFlow, int role, out IMMDevice endpoint);
}
[ComImport, Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")] class MMDeviceEnumeratorComObject { }
public class Audio
{
    static IAudioEndpointVolume Vol()
    {
        var enumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator;
        IMMDevice dev = null;
        Marshal.ThrowExceptionForHR(enumerator.GetDefaultAudioEndpoint(/*eRender*/ 0, /*eMultimedia*/ 1, out dev));
        IAudioEndpointVolume epv = null;
        var epvid = typeof(IAudioEndpointVolume).GUID;
        Marshal.ThrowExceptionForHR(dev.Activate(ref epvid, /*CLSCTX_ALL*/ 23, 0, out epv));
        return epv;
    }
    public static float Volume
    {
        get { float v = -1; Marshal.ThrowExceptionForHR(Vol().GetMasterVolumeLevelScalar(out v)); return v; }
        set { Marshal.ThrowExceptionForHR(Vol().SetMasterVolumeLevelScalar(value, System.Guid.Empty)); }
    }
    public static bool Mute
    {
        get { bool mute; Marshal.ThrowExceptionForHR(Vol().GetMute(out mute)); return mute; }
        set { Marshal.ThrowExceptionForHR(Vol().SetMute(value, System.Guid.Empty)); }
    }
}
'@

and then, paste the following and hit enter:

[audio]::Volume

next change your windows volume and repeat a few times:

[audio]::Volume

let me know what the output is of the last command

ForthtuN commented 2 years ago

Thanks for the help! So, i tested. The output gives me correct windows volume when changing, example 77% in windows gives me 0,77 in powershell. However, no change in Voicemeeter banana

andjo commented 2 years ago

@Frosthaven I'm having the same issue (on Windows 10), but I figured it out by running your code from source. Turns out that the volume received here is formatted differently depending on the current locale and parseFloat() don't understand it: https://github.com/Frosthaven/voicemeeter-windows-volume/blob/b72120331ec818bcf50d21c91ff47930fc41ce40/src/lib/workers/windowsAudioScanner.js#L114 My data contains values like '0,96'

Frosthaven commented 2 years ago

@Frosthaven I'm having the same issue (on Windows 10), but I figured it out by running your code from source. Turns out that the volume received here is formatted differently depending on the current locale and parseFloat() don't understand it: https://github.com/Frosthaven/voicemeeter-windows-volume/blob/b72120331ec818bcf50d21c91ff47930fc41ce40/src/lib/workers/windowsAudioScanner.js#L114 My data contains values like '0,96'

Aha I should have considered locale differences in volume representation! Thanks for this catch! I'll try to put an update out soon to cover for this!

Frosthaven commented 2 years ago

alright grab the latest pre-release - this should no longer be an issue. If you run into any issues let me know :)

andjo commented 2 years ago

Works for me.

Frosthaven commented 2 years ago

Works for me.

Fantastic, thanks so much for jumping in on this :)