Skip to content
DataNext edited this page Apr 29, 2025 · 12 revisions

Here you'll find everything related to Sonar.
It is separated in multiple categories, same as in code.

Mode

Mode refers to the two modes available on Sonar, the Classic and the Streamer mode

Enums

They have their own enums (Mode):

public enum Mode
{
    CLASSIC,
    STREAMER
}

Methods

To get the currently used mode

Mode Get();

To change the mode to a new one

void Set(Mode);

Associated API Route
/mode

VolumeSettings

VolumeSettings regroups the volume and mute management for each Channels and Mixes.

Methods

To get the volume of a Channel or a Mix

double GetVolume(Channel);
double GetVolume(Channel, Mix);

To get the mute state of a Channel or a Mix

bool GetMute(Channel);
bool GetMute(Channel, Mix);

To change the volume of a Channel or a Mix

void SetVolume(double, Channel);
void SetVolume(double, Channel, Mix);

To mute or unmute a Channel or a Mix (true = mute, false = unmute);

void SetMute(bool, Channel);
void SetMute(bool, Channel, Mix);

Associated API Route
/volumeSettings/classic /volumeSettings/streamer

ChatMix

ChatMix is the slider under the Game and Chat Channels.
It can be active or inactive. It is active when the same Playback Device is set to Game and Chat channels.
(active = true, inactive = false)

Methods

To get the current balance of ChatMix

double GetBalance();

To get the current state of ChatMix

bool GetState();

To change the balance of ChatMix (only works when ChatMix is active)

void SetBalance(double balance);

Associated API Route
/chatMix

Configurations

Configurations (or Audio Configurations) are the preset settings you can use for each channels.

Record

They have their special object :

public record SonarAudioConfiguration(string Id, string Name, Channel AssociatedChannel);
  • Id : String | The id of the Config
  • Name : String | The name of the Config
  • AssociatedChannel : Enums Channel | The Channel where the Config is usable

Methods

To get all existing Configs

IEnumerable<SonarAudioConfiguration> GetAllAudioConfigurations();

To get all Configs of a Channel or the one currently in use

IEnumerable<SonarAudioConfiguration> GetAudioConfigurations(Channel);
SonarAudioConfiguration GetSelectedAudioConfiguration(Channel);

To get an audio config from its ID

SonarAudioConfiguration GetAudioConfiguration(string configId);

To change the selected config of a channel. A config is designed for one channel, so just giving the ID is sufficient to find the channel.

void SetConfig(string configId);
void SetConfig(SonarAudioConfiguration);
void SetConfigByName(Channel, string name);

Associated API Route
/configs /configs/selected

Playback Devices

Playback Devices (or redirection devices) are Windows devices that Sonar outputs the sound to.
This is the playback device of my Chat Channel
image

Record

They have their special object :

public record PlaybackDevice(string Id, string Name, DataFlow DataFlow, List<Tuple<Channel, Mode>> Channels, List<Mix> Mixes);
  • Id : String | The id of the Windows device
  • Name : String | The name of the Windows device
  • DataFlow : Enums DataFlow | The direction of the data flow (Input or Output)
  • Channels : Enums Channel Mode | The channels it is used on (also contains the streamer mode mic, that's why it is a tuple containing the Channel and the Mode)
  • Mixes : Enums Mix | The mixes channels it is used on

Methods

To retrieve all the playback devices usable

IEnumerable<PlaybackDevice> GetAllPlaybackDevices();

To retrieve all usable playback devices depending on their DataFlow

IEnumerable<PlaybackDevice> GetOutputPlaybackDevices();
IEnumerable<PlaybackDevice> GetInputPlaybackDevices();

To retrieve the playback device of a Channel

PlaybackDevice GetPlaybackDevice(Channel);
PlaybackDevice GetPlaybackDevice(Channel, Mode);
PlaybackDevice GetPlaybackDevice(Mix);

To retrieve a playback device from its id:

PlaybackDevice GetPlaybackDevice(string deviceId);

To change the playback device of a Channel

void SetPlaybackDevice(PlaybackDevice, Channel);
void SetPlaybackDevice(PlaybackDevice, Channel, Mode);
void SetPlaybackDevice(PlaybackDevice, Mix mix);
void SetPlaybackDevice(string deviceId, Channel);
void SetPlaybackDevice(string deviceId, Channel, Mode);
void SetPlaybackDevice(string deviceId, Mix);

Associated API Route
/audioDevices /classicRedirections /streamRedirections

Routed Processes

Routed Processes are audio processes that output their audio to a Sonar Channel.
This is the Youtube Music app routed to the Media Channel
image

A Routed Process has a state, it can be either Active, Inactive, or Expired.
It's possible that an Audio Process is routed to multiple Channels, but it is always active only on one of them.
e.g. : Let's admit we routed Chrome to Game, the Aux by mistake and then Media to correct ourself. We would have :

Channel Routed Processes State
Game Chrome Inactive
Media Chrome Active
Aux Chrome Inactive

Notice there is not the Chat Channel, because we didn't route chrome to Chat at least once.
So each channel has an instance of a routed process but it is only active in one.

There is one exception to this! : The Mic Channel
One routed process, can be active at the same time in the Mic Channel and in any other Channel.
e.g. : Let's take Discord as an example and let's admit you are connected to a discord channel :

Channel Routed Processes State
Game Chrome, Discord Inactive, Incative
Chat Discord Active
Media Chrome Active
Aux Chrome Inactive
Mic Discord Active

Discord is an audio process that needs an Input and an Output, that's why the routed process can be active in 2 different Channels.

Record

They have their special object :

public record RoutedProcess(int ProcessId, string ProcessName, string DisplayName, RoutedProcessState State, Channel Channel, string ProcessPath);
  • ProcessId : String | The id of the audio process
  • ProcessName : String | The name of the audio process (e.g. "steam.exe")
  • DisplayName : String | The friendly name of the audio process (e.g. "Steam")
  • State : Enums RoutedProcessState | The state of the routed process on this Channel
  • Channel : Enums Channel | The Channel of the routed process
  • ProcessPath : String | The location of the exe of the routed process

Methods

To retrieve all the Routed Processes or all the active routed processes

IEnumerable<RoutedProcess> GetAllRoutedProcesses();
IEnumerable<RoutedProcess> GetAllActiveRoutedProcesses();

To retrieve the Routed Processes of a Channel

IEnumerable<RoutedProcess> GetRoutedProcesses(Channel);
IEnumerable<RoutedProcess> GetActiveRoutedProcesses(Channel);

To retrieve the Routed Processes of an audio process by giving its ID

IEnumerable<RoutedProcess> GetRoutedProcessesById(int processId);
IEnumerable<RoutedProcess> GetActiveRoutedProcessesById(int processId);

To route an audio process or reroute an existing Routed Process

void RouteProcessToChannel(int processId, Channel);
void RouteProcessToChannel(RoutedProcess, Channel);

Associated API Route
/AudioDeviceRouting

Mixes

Mixes are the 2 seperates channels of each Channels in Streamer Mode
This are the 2 Mix of the Game Channel.
The Personal Mix on the left and the Stream Mix on the right.
They are actually both activated as there is the green dot, and there icons aren't crossed out.
image

Enums

They have their own enums (Mix):

public enum Mix
{
    PERSONAL,
    STREAM
}

Methods

To get the current state of a mix (activated = true)

bool GetState(Channel, Mix);

To change state to the one you want

void SetState(bool newState, Channel, Mix);

Or

void Activate(Channel, Mix);
void Deactivate(Channel, Mix);

Associated API Route
/streamRedirections

Audience Monitoring

Audience Monitoring is a Streamer Mode feature that allows the user to hear what the audience would hear.
It is this button on the Master Channel
image
Since it's either activated or deactivated => true or false

Methods

To get the actual state of the Audience Monitoring (true = activated)

bool GetState();

To change the state of the Audience Monitoring

void SetState(bool);

Associated API Route
/streamRedirections/isStreamMonitoringEnabled

Enums

The list of usable enums to represent something

  • Mode

    • CLASSIC
    • STREAMER
  • Channel

    • MASTER
    • GAME
    • CHAT
    • MEDIA
    • AUX
    • MIC
  • Mix

    • PERSONAL
    • STREAM
  • DataFlow

    • INPUT
    • OUTPUT
  • RoutedProcessState

    • ACTIVE
    • INACTIVE
    • EXPIRED

Events

Here the list the differents events.
They are called when a PUT request is made, so when you modify something on GG or by using a method od this library.
So pay attention, some event comes from your code.

OnSonarModeChange

Called when the mode is changed.
Returns a SonarModeEvent which contains :

  • NewMode : The new mode that is set

OnSonarVolumeChange

Called when the volume of a Channel or Mix is changed.
Returns a SonarVolumeEvent which contains :

  • Volume : The new volume that is set
  • Mode : The Mode in which the volume changement occured
  • Channel : The Channel that got its volume changed
  • Mix? : If in streamer mode, the mix that got its volume changed

OnSonarMuteChange

Called when a Channel or Mix gets muted or unmuted.
Returns a SonarMuteEvent which contains :

  • Muted : The new muted state
  • Mode : The Mode in which the mute changement occured
  • Channel : The Channel that got muted or unmuted
  • Mix? : If in streamer mode, the mix that got muted or unmuted

OnSonarConfigChange

Called when the Audio Config of a channel is changed.
Returns a SonarConfigEvent which contains :

  • ConfigId : The id of the new config

To get the associated channel, you can use GetAudioConfiguration(string configId).AssociatedChannel;

OnSonarChatMixChange

Called when the ChatMix Balance is changed.
Returns a SonarChatMixEvent which contains :

  • Balance : The new balance in double

OnSonarPlaybackDeviceChange

Called when the Playback Device of a Channel or Mix is changed.
Returns a SonarPlaybackDeviceEvent which contains :

  • PlaybackDeviceId : The ID of the new playback device
  • Mode : The mode in which the changement occured
  • Channel? : The Channel that got its playback device changed (Always MIC in streamer mode)
  • Mix? : The mix that got its playback device changed

OnSonarRoutedProcessChange

Called when an audio process is routed to a new Channel.
Returns a SonarRoutedProcessEvent which contains :

  • ProcessId : The ID of the new audio process
  • NewChannel : The Channel that got the new audio process

OnSonarMixChange

Called when a Mix of a Channel gets activated or deactivated.
Returns a SonarMixEvent which contains :

  • NewState : The new state of the mix (activated/deactivated => true/false)
  • Channel : The Channel on which the event happened
  • Mix : The mix that got activated or deactivated

OnSonarAudienceMonitoringChange

Called when Audience Monitoring feature gets activated or deactivated.
Returns a SonarAudienceMonitoringEvent which contains :

  • NewState : The new state of the audience monitoring (activated/deactivated => true/false)

Exceptions

Here is the list of every existing Exception with a little description


SteelSeriesNotRunningException

Thrown when SteelSeries GG is not started/running


SonarNotRunningException

Thrown when Sonar is not started or deactivated in the GG settings


ChannelNoStreamerSupportException

Thrown when you tried to use a channel in a Streamer Mode Context/Method

(e.g. with GetPlaybackDevice(Channel, Mode);, you can only give Channel.MIC with Mode.STREAMER because it is meant to get the Playback device of the Streamer Mode Mic else, you'll get this Exception)


ChannelNotFoundException

Thrown when you pass a Channel that doesn't exist as an argument. Should never happen unless you create a new Channel enum.


ChatMixBalanceException

Thrown when you try to change the balance of ChatMix and you pass a too big number as an argument.


ChatMixDisabledException

Thrown when ChatMix is disabled and you try to change the balance.
(ChatMix is disabled when Game and Chat Channel's playback devices are not the same)


ConfigNotFoundException

Thrown when no Audio Configurations are found using a specific ID, or when the ID is null.


MasterChannelNotSupportedException

Thrown when you try to pass the Master Channel as an arg on a method that doesn't support the Master channel.
(e.g. Configs, Playback devices, Routed Processes...)


MixNotFoundException

Thrown when you pass a Mix channel that doesn't exist as an argument. Should never happen unless you create a new Mix enum.


PlaybackDeviceDataFlowException

Thrown when you try to change a Playback Device with another that doesn't have the same DataFlow direction.
(e.g. You try to set a Microphone (Input DataFlow) as the playback device of the Channel Game (Output DataFlow), this would make no sense)


PlaybackDeviceNotFoundException

Thrown when no Playback Device is set on a Channel or when no Playback Device are found using a specific ID, or when the ID is null.


RoutedProcessNotFoundException

Thrown when no Routed Processes are found using a specific ID, or when the ID is null.
Can also be thrown when a Routed Process Event occurs and the Event can't find the Routed Process' Channel.


SonarListenerNotConnectedException

Thrown when the Sonar Listener try to listen for event but the socket is not connected to the API.