using System;
namespace Unosquare.RaspberryIO.Computer {
///
/// Manage the volume of any sound device.
///
public readonly struct AudioState {
///
/// Initializes a new instance of the struct.
///
/// The card number.
/// Name of the control.
/// The volume level in percentaje.
/// The volume level in decibels.
/// if set to true the audio is mute.
public AudioState(Int32 cardNumber, String controlName, Int32 level, Single decibels, Boolean isMute) {
this.CardNumber = cardNumber;
this.ControlName = controlName;
this.Level = level;
this.Decibels = decibels;
this.IsMute = isMute;
}
///
/// Gets the card number.
///
public Int32 CardNumber {
get;
}
///
/// Gets the name of the current control.
///
public String ControlName {
get;
}
///
/// Gets the volume level in percentage.
///
public Int32 Level {
get;
}
///
/// Gets the volume level in decibels.
///
public Single Decibels {
get;
}
///
/// Gets a value indicating whether the audio is mute.
///
public Boolean IsMute {
get;
}
///
/// Returns a that represents the audio state.
///
///
/// A that represents the audio state.
///
public override String ToString() =>
"Device information: \n" +
$">> Name: {this.ControlName}\n" +
$">> Card number: {this.CardNumber}\n" +
$">> Volume (%): {this.Level}%\n" +
$">> Volume (dB): {this.Decibels:0.00}dB\n" +
$">> Mute: [{(this.IsMute ? "Off" : "On")}]\n\n";
}
}