"C++ program obtein volume in windows" Code Answer's
You're definitely familiar with the best coding language C# that developers use to develop their projects and they get all their queries like "C++ program obtein volume in windows" answered properly. Developers are finding an appropriate answer about C++ program obtein volume in windows related to the C# coding language. By visiting this online portal developers get answers concerning C# codes question like C++ program obtein volume in windows. Enter your desired code related query in the search bar and get every piece of information about C# code related question on C++ program obtein volume in windows.
C++ program obtein volume in windows
using System.Runtime.InteropServices;
using UnityEngine;
public class VolumeManager : MonoBehaviour
{
//The Unit to use when getting and setting the volume
public enum VolumeUnit
{
//Perform volume action in decibels</param>
Decibel,
//Perform volume action in scalar
Scalar
}
/// <summary>
/// Gets the current volume
/// </summary>
/// <param name="vUnit">The unit to report the current volume in</param>
[DllImport("ChangeVolumeWindows")]
public static extern float GetSystemVolume(VolumeUnit vUnit);
/// <summary>
/// sets the current volume
/// </summary>
/// <param name="newVolume">The new volume to set</param>
/// <param name="vUnit">The unit to set the current volume in</param>
[DllImport("ChangeVolumeWindows")]
public static extern void SetSystemVolume(double newVolume, VolumeUnit vUnit);
// Use this for initialization
void Start()
{
//Get volume in Decibel
float volumeDecibel = GetSystemVolume(VolumeUnit.Decibel);
Debug.Log("Volume in Decibel: " + volumeDecibel);
//Get volume in Scalar
float volumeScalar = GetSystemVolume(VolumeUnit.Scalar);
Debug.Log("Volume in Scalar: " + volumeScalar);
//Set volume in Decibel
SetSystemVolume(-16f, VolumeUnit.Decibel);
//Set volume in Scalar
SetSystemVolume(0.70f, VolumeUnit.Scalar);
}
}
Source: stackoverflow.com
All those coders who are working on the C# based application and are stuck on C++ program obtein volume in windows can get a collection of related answers to their query. Programmers need to enter their query on C++ program obtein volume in windows related to C# code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about C++ program obtein volume in windows for the programmers working on C# code while coding their module. Coders are also allowed to rectify already present answers of C++ program obtein volume in windows while working on the C# language code. Developers can add up suggestions if they deem fit any other answer relating to "C++ program obtein volume in windows". Visit this developer's friendly online web community, CodeProZone, and get your queries like C++ program obtein volume in windows resolved professionally and stay updated to the latest C# updates.