HeadsetControl.NET
0.0.5
dotnet add package HeadsetControl.NET --version 0.0.5
NuGet\Install-Package HeadsetControl.NET -Version 0.0.5
<PackageReference Include="HeadsetControl.NET" Version="0.0.5" />
<PackageVersion Include="HeadsetControl.NET" Version="0.0.5" />
<PackageReference Include="HeadsetControl.NET" />
paket add HeadsetControl.NET --version 0.0.5
#r "nuget: HeadsetControl.NET, 0.0.5"
#:package HeadsetControl.NET@0.0.5
#addin nuget:?package=HeadsetControl.NET&version=0.0.5
#tool nuget:?package=HeadsetControl.NET&version=0.0.5
HeadsetControl.NET
.NET 10 wrapper for the HeadsetControl C/C++ library. Sidetone, battery, equalizer, lights, chat-mix, the lot.
Native binaries are shipped for osx-arm64, osx-x64, linux-arm64,
linux-x64, win-x64. On Apple Silicon Macs make sure you're using a native
arm64 dotnet — Intel dotnet under Rosetta reports osx-x64 and will pull
the x64 binary instead.
Layout
src/HeadsetControl.NET.Native/ P/Invoke layer (internal)
src/HeadsetControl.NET/ public managed API
tests/HeadsetControl.NET.Tests/ xUnit, uses the built-in test device
samples/HeadsetControl.NET.Sample/
build/build-native.sh CMake driver per RID
headsetcontrollib/ git submodule with the native source
Build
git submodule update --init --recursive
dotnet test -c Release
Tests that need the native library Skip themselves if it wasn't built, so
dotnet test stays green even before step one.
Prerequisites for the native build: CMake, a C++20 compiler, hidapi
(brew install hidapi / apt install libhidapi-dev); on Windows the
upstream library uses vcpkg manifest mode.
Usage
using HeadsetControl.NET;
using HeadsetCollection headsets = HeadsetControlLibrary.Discover();
foreach (Headset headset in headsets)
{
Console.WriteLine($"{headset} caps={string.Join(",", headset.SupportedCapabilities)}");
if (headset.Supports(HeadsetCapability.BatteryStatus))
{
BatteryInfo battery = headset.GetBattery();
Console.WriteLine($" battery: {battery.Status} ({battery.LevelPercent}%)");
}
if (headset.Supports(HeadsetCapability.Sidetone))
{
headset.SetSidetone(64);
}
}
Run the sample against the synthetic test device:
dotnet run --project samples/HeadsetControl.NET.Sample -- --test
Errors
| Exception | Native code |
|---|---|
FeatureNotSupportedException |
HSC_RESULT_NOT_SUPPORTED |
DeviceOfflineException |
HSC_RESULT_DEVICE_OFFLINE |
DeviceTimeoutException |
HSC_RESULT_TIMEOUT |
HidCommunicationException |
HSC_RESULT_HID_ERROR |
HeadsetControlInvalidParameterException |
HSC_RESULT_INVALID_PARAM |
HeadsetControlException (base) |
any other failure |
License
GPL-3.0-only — see LICENSE. Matches upstream. This is copyleft, so
anything that links against HeadsetControl.NET (statically or dynamically)
inherits GPL-3.0. The bundled Windows hidapi.dll is BSD-3-Clause.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- HeadsetControl.NET.Native (>= 0.0.5)
-
net8.0
- HeadsetControl.NET.Native (>= 0.0.5)
-
net9.0
- HeadsetControl.NET.Native (>= 0.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.