SOLVED

SRS V2 Default startup volume

%3CLINGO-SUB%20id%3D%22lingo-sub-263428%22%20slang%3D%22en-US%22%3ESRS%20V2%20Default%20startup%20volume%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-263428%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20change%20the%20default%20startup%20volume%20from%20the%20SRS%20V2%20application%2C%20as%20this%20is%20set%20back%20to%20the%20default%20value%20of%2050%25%20after%20the%20nightly%20reboot.%3C%2FP%3E%3CP%3EWindows%20build%3A%201709%3C%2FP%3E%3CP%3ESRS%20build%20version%3A%204.0.19.0%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-263428%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeployment%20%26amp%3B%20Operations%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-268751%22%20slang%3D%22en-US%22%3ERe%3A%20SRS%20V2%20Default%20startup%20volume%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-268751%22%20slang%3D%22en-US%22%3E%3CP%3EHere%20is%20the%20script%20in%20a%20.docx%20file.%20Hopefully%20for%20better%20formatting.%20It%20would%20not%20let%20me%20attach%20a%20.ps1%20or%20a%20.txt%20of%20the%20script.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-267068%22%20slang%3D%22en-US%22%3ERe%3A%20SRS%20V2%20Default%20startup%20volume%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-267068%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20the%20following%20PowerShell%20script%20run%20on%20startup%20to%20set%20the%20volume%20to%20100%25.%20(Hopefully%20the%20formatting%20doesn't%20get%20too%20messed%20up%20posting%20it%20here)%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EAdd-Type%3C%2FFONT%3E%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-TypeDefinition%3C%2FFONT%3E%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%40'%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eusing%20System.Runtime.InteropServices%3B%3C%2FP%3E%3CP%3E%5BGuid(%225CDF2C82-841E-4546-9722-0CF74078229A%22)%2C%20InterfaceType(ComInterfaceType.InterfaceIsIUnknown)%5D%3C%2FP%3E%3CP%3Einterface%20IAudioEndpointVolume%20%7B%3C%2FP%3E%3CP%3E%2F%2F%20f()%2C%20g()%2C%20...%20are%20unused%20COM%20method%20slots.%20Define%20these%20if%20you%20care%3C%2FP%3E%3CP%3Eint%20f()%3B%20int%20g()%3B%20int%20h()%3B%20int%20i()%3B%3C%2FP%3E%3CP%3Eint%20SetMasterVolumeLevelScalar(float%20fLevel%2C%20System.Guid%20pguidEventContext)%3B%3C%2FP%3E%3CP%3Eint%20j()%3B%3C%2FP%3E%3CP%3Eint%20GetMasterVolumeLevelScalar(out%20float%20pfLevel)%3B%3C%2FP%3E%3CP%3Eint%20k()%3B%20int%20l()%3B%20int%20m()%3B%20int%20n()%3B%3C%2FP%3E%3CP%3Eint%20SetMute(%5BMarshalAs(UnmanagedType.Bool)%5D%20bool%20bMute%2C%20System.Guid%20pguidEventContext)%3B%3C%2FP%3E%3CP%3Eint%20GetMute(out%20bool%20pbMute)%3B%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%5BGuid(%22D666063F-1587-4E43-81F1-B948E807363F%22)%2C%20InterfaceType(ComInterfaceType.InterfaceIsIUnknown)%5D%3C%2FP%3E%3CP%3Einterface%20IMMDevice%20%7B%3C%2FP%3E%3CP%3Eint%20Activate(ref%20System.Guid%20id%2C%20int%20clsCtx%2C%20int%20activationParams%2C%20out%20IAudioEndpointVolume%20aev)%3B%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%5BGuid(%22A95664D2-9614-4F35-A746-DE8DB63617E6%22)%2C%20InterfaceType(ComInterfaceType.InterfaceIsIUnknown)%5D%3C%2FP%3E%3CP%3Einterface%20IMMDeviceEnumerator%20%7B%3C%2FP%3E%3CP%3Eint%20f()%3B%20%2F%2F%20Unused%3C%2FP%3E%3CP%3Eint%20GetDefaultAudioEndpoint(int%20dataFlow%2C%20int%20role%2C%20out%20IMMDevice%20endpoint)%3B%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%5BComImport%2C%20Guid(%22BCDE0395-E52F-467C-8E3D-C4579291692E%22)%5D%20class%20MMDeviceEnumeratorComObject%20%7B%20%7D%3C%2FP%3E%3CP%3Epublic%20class%20Audio%20%7B%3C%2FP%3E%3CP%3Estatic%20IAudioEndpointVolume%20Vol()%20%7B%3C%2FP%3E%3CP%3Evar%20enumerator%20%3D%20new%20MMDeviceEnumeratorComObject()%20as%20IMMDeviceEnumerator%3B%3C%2FP%3E%3CP%3EIMMDevice%20dev%20%3D%20null%3B%3C%2FP%3E%3CP%3EMarshal.ThrowExceptionForHR(enumerator.GetDefaultAudioEndpoint(%2F*eRender*%2F%200%2C%20%2F*eMultimedia*%2F%201%2C%20out%20dev))%3B%3C%2FP%3E%3CP%3EIAudioEndpointVolume%20epv%20%3D%20null%3B%3C%2FP%3E%3CP%3Evar%20epvid%20%3D%20typeof(IAudioEndpointVolume).GUID%3B%3C%2FP%3E%3CP%3EMarshal.ThrowExceptionForHR(dev.Activate(ref%20epvid%2C%20%2F*CLSCTX_ALL*%2F%2023%2C%200%2C%20out%20epv))%3B%3C%2FP%3E%3CP%3Ereturn%20epv%3B%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3Epublic%20static%20float%20Volume%20%7B%3C%2FP%3E%3CP%3Eget%20%7Bfloat%20v%20%3D%20-1%3B%20Marshal.ThrowExceptionForHR(Vol().GetMasterVolumeLevelScalar(out%20v))%3B%20return%20v%3B%7D%3C%2FP%3E%3CP%3Eset%20%7BMarshal.ThrowExceptionForHR(Vol().SetMasterVolumeLevelScalar(value%2C%20System.Guid.Empty))%3B%7D%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3Epublic%20static%20bool%20Mute%20%7B%3C%2FP%3E%3CP%3Eget%20%7B%20bool%20mute%3B%20Marshal.ThrowExceptionForHR(Vol().GetMute(out%20mute))%3B%20return%20mute%3B%20%7D%3C%2FP%3E%3CP%3Eset%20%7B%20Marshal.ThrowExceptionForHR(Vol().SetMute(value%2C%20System.Guid.Empty))%3B%20%7D%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E'%40%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%5B%3C%2FFONT%3E%3CFONT%20color%3D%22%23008080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3Eaudio%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%5D%3A%3A%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EVolume%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3D%3C%2FFONT%3E%26nbsp%3B1%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Regular Visitor

Hello All,

 

Is there a way to change the default startup volume from the SRS V2 application, as this is set back to the default value of 50% after the nightly reboot.

Windows build: 1709

SRS build version: 4.0.19.0

 

Thanks in advance.

2 Replies
Best Response confirmed by Joachim Peeters (Regular Visitor)
Solution

 

I have the following PowerShell script run on startup to set the volume to 100%. (Hopefully the formatting doesn't get too messed up posting it here)

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)); }

}

}

'@

[audio]::Volume = 1

 

Here is the script in a .docx file. Hopefully for better formatting. It would not let me attach a .ps1 or a .txt of the script.