summaryrefslogtreecommitdiffstats
path: root/WhisperNet/API/CaptureDeviceId.cs
blob: 9636e534aa1d7ab95e8cf938f99d1144eeb7b2cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using Whisper.Internal;

namespace Whisper
{
	/// <summary>Identifiers for an audio capture device</summary>
	public record struct CaptureDeviceId
	{
		/// <summary>The display name is suitable for showing to the user, but might not be unique.</summary>
		public string displayName;

		/// <summary>Endpoint ID for an audio capture device.<br/>
		/// It uniquely identifies the device on the system, but is not a readable string.</summary>
		public string endpoint;

		internal CaptureDeviceId( in sCaptureDevice rsi )
		{
			displayName = rsi.displayName ?? "<display name unavailable>";
			endpoint = rsi.endpoint ?? throw new ApplicationException( "The device has no endpoint ID" );
		}

		/// <summary>Returns a String which represents the object instance</summary>
		public override string ToString() => $"Capture device: \"{displayName}\"";
	}
}