Skip to content

Unity plugin for get and set main speaker volume on Windows

License

Notifications You must be signed in to change notification settings

Eryux/unity-win-volume

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unity-win-volume

Unity plugin to get and set main speaker volume on Windows.

Usage

For usage only you can download pre-compiled plugin in release section.

  • Add Plugins folder in Assets folder to your Unity project

  • Use this following lines for importing plugin methods to your script

[DllImport("wvolume")]
static extern float GetAudioVolume();

[DllImport("wvolume")]
static extern int SetAudioVolume(float v);
  • Now you can use this methods in your script for get and set speakers volume
void Start () {
  SetAudioVolume(50.0f)
  Debug.Log(GetAudioVolume()); // 0.5f
}

You can also take a look at Unity example inside unity-example folder.

Build requirements

  • Visual Studio 2015+ (minimun toolset v140)

Build

  • Open sln file with Visual Studio

  • Select desired platform and build the solution

License

MIT License

About

Unity plugin for get and set main speaker volume on Windows

Resources

License

Stars

Watchers

Forks

Packages

No packages published