Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f05f717
Reorganized the mess
DataNext27 Apr 24, 2025
113232b
Renamed a lot of things
DataNext27 Apr 24, 2025
5c34470
Created 3 Managers
DataNext27 Apr 24, 2025
836ec5e
Added VolumeSettingsManager as a category
DataNext27 Apr 24, 2025
6c65325
Added ConfigurationManager and removed old method from Http managers
DataNext27 Apr 25, 2025
a48d533
Forgot to rename a variable
DataNext27 Apr 25, 2025
d88c05d
Added PlaybackDeviceManager
DataNext27 Apr 25, 2025
72fa1f7
Remove useless parameter
DataNext27 Apr 25, 2025
9f4e5c6
Merge pull request #1 from DataNext27/rework/seperate-workflow
DataNext27 Apr 25, 2025
eca1224
Removed the WaitUntilSonarStart in the constructor so it only depends…
DataNext27 Apr 25, 2025
2a4518a
Renamed event i forgot
DataNext27 Apr 25, 2025
a81d035
Made GG check running better, created a method to wait for GG to star…
DataNext27 Apr 25, 2025
56694ae
Created HttpFetcher class instead of HttpPut and HttpProvider
DataNext27 Apr 25, 2025
0984fa3
Change of SteelSeries GG was detected as running
DataNext27 Apr 25, 2025
ea91f70
Created NotRunning exceptions for Sonar and Steelseries
DataNext27 Apr 25, 2025
86d4846
Created SonarListenerNotConnected.cs and updated SonarSocket.cs
DataNext27 Apr 25, 2025
271b281
Added exceptions for master and mic channel and for audio configs
DataNext27 Apr 25, 2025
8c3c948
Merge pull request #2 from DataNext27/feature/exceptions
DataNext27 Apr 25, 2025
775d3c8
Added ChatMix manager
DataNext27 Apr 25, 2025
c030924
Forgot "Exception" at the end of the exceptions name
DataNext27 Apr 25, 2025
9e16e25
Added Manager for routed processes
DataNext27 Apr 25, 2025
d17c926
Made the managers interfaces internal
DataNext27 Apr 25, 2025
9a61522
Added Mode manager
DataNext27 Apr 25, 2025
e38dc3f
Added Redirection State Manager
DataNext27 Apr 25, 2025
c1971e3
Added Audience Monitoring Manager and removed old Sonar http command …
DataNext27 Apr 25, 2025
ba5b6a8
Renamed HttpFetcher to simply Fetcher
DataNext27 Apr 26, 2025
1f73e54
Made the HandleEvent method internal
DataNext27 Apr 26, 2025
bf937c6
Reworked RedirectionStateManager and renamed it to MixManager
DataNext27 Apr 26, 2025
bf9b893
Reworked entirely the Routed Processes system and added events for it
DataNext27 Apr 27, 2025
d48e411
Revamped events
DataNext27 Apr 27, 2025
5c68c5c
Merge pull request #3 from DataNext27/rework/more-managers
DataNext27 Apr 27, 2025
a92a137
Revamped Mode Manager
DataNext27 Apr 27, 2025
66ee788
Revamped VolumeSettings Manager
DataNext27 Apr 27, 2025
21dde97
Revamped ChatMix manager
DataNext27 Apr 27, 2025
4edf86c
Reworked Configuration manager
DataNext27 Apr 27, 2025
01b8da6
Revamped Audience Monitoring Manager
DataNext27 Apr 27, 2025
7f120f0
Reworked entirely the Playback device manager
DataNext27 Apr 27, 2025
f277596
renamed volumesettings volume variables
DataNext27 Apr 27, 2025
1010832
Merge pull request #4 from DataNext27/reworking
DataNext27 Apr 28, 2025
3c47ec2
Added XML Doc and made the listerner windows only (since it is window…
DataNext27 Apr 28, 2025
4abbd88
Made so there is only one instance of sonar socket
DataNext27 Apr 28, 2025
a25d9c0
Made the _sonarSocket readonly
DataNext27 Apr 28, 2025
ef97342
Made the RoutedProcess State internally mutable so it can follow its …
DataNext27 Apr 28, 2025
f20a8c9
Renamed Monitoring mix to Personal mix
DataNext27 Apr 28, 2025
fd5521d
Remade an entire test script usable by everyone
DataNext27 Apr 28, 2025
2fb0c3d
Revamped Sample project
DataNext27 Apr 28, 2025
298c4b8
Update README.md
DataNext27 Apr 28, 2025
b99eaf2
Removed unused Exception
DataNext27 Apr 28, 2025
51f8f3f
Some event variable weren't renamed
DataNext27 Apr 28, 2025
938631f
Renamed event var correctly
DataNext27 Apr 29, 2025
b797aef
Changed the version
DataNext27 Apr 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,47 @@
> This library is **NOT** affiliated in any way with **SteelSeries**
> I've made it because it was interesting and funny to do, also I wanted to share this project for people to use it for their own projects

This library allows you to take control over the SteelSeries GG app.
This library allows you to take control over the SteelSeries GG app (only Sonar for now).

The API is available via a [nuget package](https://www.nuget.org/packages/Steelseries-NET-API).
The library is available via a [nuget package](https://www.nuget.org/packages/Steelseries-NET-API).
It is also available in the [Releases](https://github.com/mpaperno/SteelSeries-NET-API/releases) tab as a .zip archive for each supported .NET version.

## Features
- Full Sonar control
- Mode
- Volume
- Mute
- ChatMix
- Configs (Can't edit a config)
- Playback Devices
- Streamer mode Personal & Stream Mixes
- Streamer mode Audience Monitoring

## Getting Started
To get started, you only need to create a Sonar Object.
`````csharp
// Create Sonar object
SonarBridge sonarManager = new SonarBridge();

// Wait for GG to start before continuing
sonarManager.WaitUntilSteelSeriesStarted();

// Wait for sonar to start before continuing
sonarManager.WaitUntilSonarStarted();

// Start listening to Sonar Events (optional and require admin rights)
sonarManager.StartListener();
sonarManager.SonarEventManager.OnSonarModeChange += OnModeChangeHandler; // Register event

Mode currentMode = sonarManager.GetMode(); // Returns the current mode
sonarManager.SetVolume(0.5, Device.Game); // Set the Game Device volume
Mode currentMode = sonarManager.Mode.Get(); // Returns the current mode
sonarManager.VolumeSettings.SetVolume(0.5, Device.Game); // Set the Game Device volume
...
`````
For more example, you can check the [Tests](https://github.com/DataNext27/SteelSeries-NET-API/tree/main/SteelSeriesAPI.Tests) and the [Sample](https://github.com/DataNext27/SteelSeries-NET-API/tree/main/SteelSeriesAPI.Sample) folders.
For more example, you can check the [Sample](SteelSeriesAPI.Sample/Program.cs) and the [Tests](SteelSeriesAPI.Tests/Program.cs) folders.
If you need any sort of Documentation, go check the [Repo's Wiki](https://github.com/DataNext27/SteelSeries-NET-API/wiki) for more information.

### Some Vocabulary
- Mode : Classic/Stream
- Device : Master/Game/Chat/Media/Aux/Mic
- Channel : *(Streamer mode)* Monitoring/Stream
- Audio Configs : It's in the name
- Redirection States : *(Streamer mode)* Button above sliders to un/mute a channel of a device
- Redirection Device : Device where the sound got by GG is redirected (your headset for example)

## Todo
(Actually not possible, maybe one day i guess :/ )
(Actually not planned as not possible, maybe one day I guess :/ )
- Moments
- Engine
- Settings
Expand Down
146 changes: 84 additions & 62 deletions SteelSeriesAPI.Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SteelSeriesAPI.Events;
using SteelSeriesAPI.Sonar;
using SteelSeriesAPI.Sonar.Events;
using SteelSeriesAPI.Sonar.Enums;
using SteelSeriesAPI.Sonar.Models;

Expand All @@ -11,81 +12,97 @@ static void Main(string[] args)
// Create a Sonar Object to control Sonar
SonarBridge sonarManager = new SonarBridge();

// Wait until GG is started before continuing
sonarManager.WaitUntilSteelSeriesStarted();
// Wait until GG and Sonar are both started before continuing
sonarManager.WaitUntilSonarStarted();

// If I want to detect changes made on GG, I can use the listener (require admin rights)
// If you want to detect changes made on GG, you can use the listener (require admin rights)
sonarManager.StartListener();
// Then I register the events I want (I've put them all to demonstrate)
sonarManager.SonarEventManager.OnSonarModeChange += OnModeChangeHandler; // When the mode is change
sonarManager.SonarEventManager.OnSonarVolumeChange += OnVolumeChangeHandler; // When the volume of a Sonar Device or Channel is changed
sonarManager.SonarEventManager.OnSonarMuteChange += OnMuteChangeHandler; // When a Sonar Device or Channel is muted or unmuted
sonarManager.SonarEventManager.OnSonarConfigChange += OnConfigChangeHandler; // When a new config is set to a Sonar Device
sonarManager.SonarEventManager.OnSonarChatMixChange += OnChatMixChangeHandler; // When the ChatMix value is changed
sonarManager.SonarEventManager.OnSonarRedirectionDeviceChange += OnRedirectionDeviceChangeHandler; // When the Redirection Device of a Sonar Device is changed
sonarManager.SonarEventManager.OnSonarRedirectionStateChange += OnRedirectionStateChangeHandler; // When the Redirection of a Sonar Channel is muted or unmuted
sonarManager.SonarEventManager.OnSonarAudienceMonitoringChange += OnAudienceMonitoringChangeHandler; // When the Audience Monitoring is muted or unmuted
// Then you register the events you need (I've put them all to demonstrate)
sonarManager.Events.OnSonarModeChange += OnModeChangeHandler; // When the mode gets changed
sonarManager.Events.OnSonarVolumeChange += OnVolumeChangeHandler; // When the volume of a Sonar Channel or Mix gets changed
sonarManager.Events.OnSonarMuteChange += OnMuteChangeHandler; // When a Sonar Channel or Mix gets muted or unmuted
sonarManager.Events.OnSonarConfigChange += OnConfigChangeHandler; // When a new config is set to a Sonar Channel
sonarManager.Events.OnSonarChatMixChange += OnChatMixChangeHandler; // When the ChatMix value gets changed
sonarManager.Events.OnSonarPlaybackDeviceChange += OnPlaybackDeviceChangeHandler; // When the Redirection Channel of a Sonar Channel is changed
sonarManager.Events.OnSonarRoutedProcessChange += OnRoutedProcessChangeHandler; // When a routed process gets routed to a new Sonar Channel
sonarManager.Events.OnSonarMixChange += OnMixChangeHandler; // When the Mix of a Sonar Channem gets activated or deactivated
sonarManager.Events.OnSonarAudienceMonitoringChange += OnAudienceMonitoringChangeHandler; // When the Audience Monitoring gets muted or unmuted

// Get current sonar mode
Mode mode = sonarManager.GetMode();
Mode mode = sonarManager.Mode.Get();
// Change sonar mode to Streamer
sonarManager.SetMode(Mode.Streamer);
sonarManager.Mode.Set(Mode.STREAMER);

// Get current volume of a Sonar Device
double vol = sonarManager.GetVolume(Device.Media);
// Get current volume of a Sonar Channel
double vol2 = sonarManager.GetVolume(Device.Chat, Channel.Stream);
// Set the volume of a Sonar Device
sonarManager.SetVolume(0.75, Device.Game);
double vol = sonarManager.VolumeSettings.GetVolume(Channel.MEDIA);
// Get current volume of a Sonar Mix
double vol2 = sonarManager.VolumeSettings.GetVolume(Channel.CHAT, Mix.STREAM);
// Set the volume of a Sonar Channel
sonarManager.SetVolume(0.1, Device.Media, Channel.Monitoring);
sonarManager.VolumeSettings.SetVolume(0.75, Channel.GAME);
// Set the volume of a Sonar Mix
sonarManager.VolumeSettings.SetVolume(0.1, Channel.MEDIA, Mix.PERSONAL);

// Get the current mute state of a Sonar Device
bool state = sonarManager.GetMute(Device.Chat);
bool state2 = sonarManager.GetMute(Device.Master, Channel.Monitoring);
// Set the current mute state of a Sonar Device
sonarManager.SetMute(true, Device.Chat); // Mute chat
// Get the current mute state of a Sonar Channel
bool state = sonarManager.VolumeSettings.GetMute(Channel.CHAT);
bool state2 = sonarManager.VolumeSettings.GetMute(Channel.MASTER, Mix.PERSONAL);
// Set the current mute state of a Sonar Channel
sonarManager.VolumeSettings.SetMute(true, Channel.CHAT); // Mute chat

// Get audio configs
List<SonarAudioConfiguration> allConfigs = sonarManager.GetAllAudioConfigurations().ToList(); // Return all configs (A SonarAudioConfiguration contains an Id, a Name and an AssociatedDevice)
List<SonarAudioConfiguration> mediaConfigs = sonarManager.GetAudioConfigurations(Device.Media).ToList(); // Return all configs of a Sonar Device
SonarAudioConfiguration currentConfig = sonarManager.GetSelectedAudioConfiguration(Device.Media); // Return the currently used config of a Sonar Device
// Set the config of a Sonar Device
sonarManager.SetConfig(Device.Media, "Podcast"); // Using its name
sonarManager.SetConfig(currentConfig.Id); // Using its id (no need to precise which Sonar Device, one id goes to one Sonar Device)
List<SonarAudioConfiguration> allConfigs = sonarManager.Configurations.GetAllAudioConfigurations().ToList(); // Return all configs (A SonarAudioConfiguration contains an Id, a Name and an AssociatedChannel)
List<SonarAudioConfiguration> mediaConfigs = sonarManager.Configurations.GetAudioConfigurations(Channel.MEDIA).ToList(); // Return all configs of a Sonar Channel
SonarAudioConfiguration currentConfig = sonarManager.Configurations.GetSelectedAudioConfiguration(Channel.MEDIA); // Return the currently used config of a Sonar Channel
// Set the config of a Sonar Channel
sonarManager.Configurations.SetConfigByName(Channel.MEDIA, "Podcast"); // Using its name
sonarManager.Configurations.SetConfig(currentConfig); // Using directly the config object
sonarManager.Configurations.SetConfig(currentConfig.Id); // Or Using its id (no need to precise which Sonar Channel, one id = one config = one Sonar Channel)

// Get ChatMix info
double chatMixBalance = sonarManager.GetChatMixBalance(); // The ChatMix value between -1 and 1
bool chatMixState = sonarManager.GetChatMixState(); // If ChatMix is usable or not
double chatMixBalance = sonarManager.ChatMix.GetBalance(); // The ChatMix value between -1 and 1
bool chatMixState = sonarManager.ChatMix.GetState(); // If ChatMix is usable or not
// Change ChatMix value
sonarManager.SetChatMixBalance(0.5); // 0.5 is halfway to Chat
sonarManager.ChatMix.SetBalance(0.5); // 0.5 is halfway to Chat

// Get redirection devices (Windows devices)
List<RedirectionDevice> inputDevices = sonarManager.GetRedirectionDevices(Direction.Input).ToList(); // Input devices (Mics...)
sonarManager.GetRedirectionDevices(Direction.Output); // Output devices (headset, speakers...)
sonarManager.GetRedirectionDeviceFromId("{0.0.0.00000000}.{192b4f5b-9cc1-4eb2-b752-c5e15b99d548}"); // Get a redirection device from its id
RedirectionDevice gameRDevice = sonarManager.GetClassicRedirectionDevice(Device.Game); // Give currently used Redirection Device for classic mode
sonarManager.GetStreamRedirectionDevice(Channel.Monitoring); // Give currently used Redirection Device for Streamer mode
sonarManager.GetStreamRedirectionDevice(Device.Mic); // Give currently used Redirection Device for Mic in streamer mode
// Change redirection devices using their id
sonarManager.SetClassicRedirectionDevice(gameRDevice.Id, Device.Game);
sonarManager.SetStreamRedirectionDevice(gameRDevice.Id, Channel.Monitoring);
sonarManager.SetStreamRedirectionDevice(inputDevices[0].Id, Device.Mic);
// Get playback devices (Windows devices)
List<PlaybackDevice> playbackDevices = sonarManager.PlaybackDevices.GetAllPlaybackDevices().ToList(); // All playback devices
List<PlaybackDevice> inputDevices = sonarManager.PlaybackDevices.GetInputPlaybackDevices().ToList(); // Input devices (Mics...)
List<PlaybackDevice> outputDevices = sonarManager.PlaybackDevices.GetOutputPlaybackDevices().ToList(); // Output devices (headset, speakers...)
PlaybackDevice gameDevice = sonarManager.PlaybackDevices.GetPlaybackDevice(Channel.GAME); // Get the currently used Playback device of a Channel
sonarManager.PlaybackDevices.GetPlaybackDevice(Mix.STREAM); // Get the currently used Playback device of a Mix
sonarManager.PlaybackDevices.GetPlaybackDevice(Channel.MIC, Mode.STREAMER); // Get the currently used Playback device of the streamer mode Mic
sonarManager.PlaybackDevices.GetPlaybackDevice("{0.0.0.00000000}.{192b4f5b-9cc1-4eb2-b752-c5e15b99d548}"); // Get a playback device from its id
// Change playback devices
sonarManager.PlaybackDevices.SetPlaybackDevice(gameDevice, Channel.GAME); // Using the playback device object
sonarManager.PlaybackDevices.SetPlaybackDevice("{0.0.0.00000000}.{192b4f5b-9cc1-4eb2-b752-c5e15b99d548}", Channel.AUX); // Using the playback device ID

// Get the redirections states
sonarManager.GetRedirectionState(Device.Media, Channel.Monitoring);
// Change the redirections states
sonarManager.SetRedirectionState(false, Device.Media, Channel.Monitoring);
// Get the mixes states
sonarManager.Mix.GetState(Channel.MEDIA, Mix.PERSONAL);
// Change the mixes states
sonarManager.Mix.Activate(Channel.MEDIA, Mix.PERSONAL);
sonarManager.Mix.Deactivate(Channel.CHAT, Mix.STREAM);
sonarManager.Mix.SetState(false, Channel.MEDIA, Mix.PERSONAL); // Same as deactivating here

// Get Audience Monitoring state
sonarManager.GetAudienceMonitoringState();
sonarManager.AudienceMonitoring.GetState();
// Change Audience Monitoring state
sonarManager.SetAudienceMonitoringState(false);

// Get routed processes of a Sonar Device
List<RoutedProcess> mediaProcesses = sonarManager.GetRoutedProcess(Device.Media).ToList(); // Will surely return apps like Google Chrome or Spotify
// Route a process to a Sonar Device using its process ID (pid)
sonarManager.SetProcessToDeviceRouting(mediaProcesses[0].PId, Device.Media);
sonarManager.AudienceMonitoring.SetState(false);

// Get all routed processes whether they are active, inactive or expired
List<RoutedProcess> allProcesses = sonarManager.RoutedProcesses.GetAllRoutedProcesses().ToList();
// Get all active routed processes (currently in use)
List<RoutedProcess> allActiveProcesses = sonarManager.RoutedProcesses.GetAllActiveRoutedProcesses().ToList();
// Same but for a specific channel
List<RoutedProcess> gameProcesses = sonarManager.RoutedProcesses.GetRoutedProcesses(Channel.GAME).ToList(); // Will surely return apps like Minecraft...
List<RoutedProcess> mediaActiveProcesses = sonarManager.RoutedProcesses.GetActiveRoutedProcesses(Channel.MEDIA).ToList(); // Will surely return apps like Google Chrome or Spotify
// Same idea but by giving the ID of an audio process
sonarManager.RoutedProcesses.GetRoutedProcessesById(2063);
sonarManager.RoutedProcesses.GetActiveRoutedProcessesById(10548);
// Route a process to a Sonar Channel using the RoutedProcess object
sonarManager.RoutedProcesses.RouteProcessToChannel(mediaActiveProcesses[0], Channel.AUX);
// Route a process to a Sonar Channel using its process ID (pid)
sonarManager.RoutedProcesses.RouteProcessToChannel(15482, Channel.MEDIA);
}

static void OnModeChangeHandler(object? sender, SonarModeEvent eventArgs)
Expand All @@ -95,12 +112,12 @@ static void OnModeChangeHandler(object? sender, SonarModeEvent eventArgs)

static void OnVolumeChangeHandler(object? sender, SonarVolumeEvent eventArgs)
{
Console.WriteLine("Received Volume Event : " + eventArgs.Volume + ", " + eventArgs.Mode + ", " + eventArgs.Device + ", " + eventArgs.Channel);
Console.WriteLine("Received Volume Event : " + eventArgs.Volume + ", " + eventArgs.Mode + ", " + eventArgs.Channel + ", " + eventArgs.Mix);
}

static void OnMuteChangeHandler(object? sender, SonarMuteEvent eventArgs)
{
Console.WriteLine("Received Mute Event : " + eventArgs.Muted + ", " + eventArgs.Mode + ", " + eventArgs.Device + ", " + eventArgs.Channel);
Console.WriteLine("Received Mute Event : " + eventArgs.Muted + ", " + eventArgs.Mode + ", " + eventArgs.Channel + ", " + eventArgs.Mix);
}

static void OnConfigChangeHandler(object? sender, SonarConfigEvent eventArgs)
Expand All @@ -113,18 +130,23 @@ static void OnChatMixChangeHandler(object? sender, SonarChatMixEvent eventArgs)
Console.WriteLine("Received ChatMix Event : " + eventArgs.Balance);
}

static void OnRedirectionDeviceChangeHandler(object? sender, SonarRedirectionDeviceEvent eventArgs)
static void OnPlaybackDeviceChangeHandler(object? sender, SonarPlaybackDeviceEvent eventArgs)
{
Console.WriteLine("Received Redirection Channel Event : " + eventArgs.PlaybackDeviceId + ", " + eventArgs.Mode + ", " + eventArgs.Channel + ", " + eventArgs.Mix);
}

static void OnRoutedProcessChangeHandler(object? sender, SonarRoutedProcessEvent eventArgs)
{
Console.WriteLine("Received Redirection Device Event : " + eventArgs.RedirectionDeviceId + ", " + eventArgs.Mode + ", " + eventArgs.Device + ", " + eventArgs.Channel);
Console.WriteLine("Received Routed Process Event : " + eventArgs.ProcessId + ", " + eventArgs.NewChannel);
}

static void OnRedirectionStateChangeHandler(object? sender, SonarRedirectionStateEvent eventArgs)
static void OnMixChangeHandler(object? sender, SonarMixEvent eventArgs)
{
Console.WriteLine("Received Redirection State Event : " + eventArgs.State + ", " + eventArgs.Device + ", " + eventArgs.Channel);
Console.WriteLine("Received Redirection State Event : " + eventArgs.NewState + ", " + eventArgs.Channel + ", " + eventArgs.Mix);
}

static void OnAudienceMonitoringChangeHandler(object? sender, SonarAudienceMonitoringEvent eventArgs)
{
Console.WriteLine("Received Audience Monitoring Event : " + eventArgs.AudienceMonitoringState);
Console.WriteLine("Received Audience Monitoring Event : " + eventArgs.NewState);
}
}
Loading