SteelSeries Sonar Rust API
A Rust library for interacting with the SteelSeries Sonar application API. This crate provides a convenient interface for controlling audio volumes, muting channels, and managing chat mix settings programmatically.
Features
- 🎵 Control volume levels for different audio channels
- 🔇 Mute/unmute specific channels
- 🎙️ Manage chat mix settings
- 🎮 Support for both classic and streamer modes
- ⚡ Async/await support with tokio
- 🦀 Safe, idiomatic Rust API
- 📦 Cross-platform support
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
= { = "1.0", = ["full"] }
Quick Start
use ;
async
Usage
Initializing the Sonar Client
Default Configuration
use Sonar;
let sonar = new.await?;
Custom Configuration
use Sonar;
use Path;
// With custom app data path and explicit streamer mode
let sonar = with_config.await?;
Volume Control
Setting Volume
// Set master volume to 75%
sonar.set_volume.await?;
// In streamer mode, specify the slider
sonar.set_volume.await?;
Getting Volume Data
let volume_data = sonar.get_volume_data.await?;
println!;
Channel Muting
// Mute the media channel
sonar.mute_channel.await?;
// Unmute the media channel
sonar.mute_channel.await?;
// In streamer mode
sonar.mute_channel.await?;
Chat Mix Control
// Set chat mix (range: -1.0 to 1.0)
sonar.set_chat_mix.await?;
// Get current chat mix data
let chat_mix_data = sonar.get_chat_mix_data.await?;
Streamer Mode
// Check if streamer mode is enabled
let is_streamer_mode = sonar.is_streamer_mode.await?;
println!;
// Toggle streamer mode
let mut sonar = new.await?;
sonar.set_streamer_mode.await?;
Available Channels
The following audio channels are supported:
"master"- Master volume"game"- Game audio"chatRender"- Chat playback"media"- Media/music"aux"- Auxiliary audio"chatCapture"- Microphone/chat capture
Streamer Mode
SteelSeries Sonar supports streamer mode, which provides two separate slider controls:
"streaming"- Audio levels for the stream output"monitoring"- Audio levels for personal monitoring
When streamer mode is enabled, you can specify which slider to control:
// Control the streaming slider
sonar.set_volume.await?;
// Control the monitoring slider
sonar.set_volume.await?;
Error Handling
The library provides comprehensive error handling through the SonarError enum:
use ;
match sonar.set_volume.await
Requirements
- SteelSeries Engine 3 must be installed and running
- SteelSeries Sonar must be enabled in the Engine
- Windows, macOS, or Linux (where SteelSeries Engine is available)
Examples
Check out the examples/ directory for more comprehensive usage examples:
basic_usage.rs- Basic volume and mute controlsstreamer_mode.rs- Working with streamer modechat_mix.rs- Chat mix management
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development
# Clone the repository
# Run tests
# Build documentation
# Run examples
License
This project is licensed under the MIT License - see the LICENSE file for details.
Related Projects
- steelseries-sonar-py - Python implementation
- steelseries-sonar-js - JavaScript/TypeScript implementation
Changelog
See CHANGELOG.md for a list of changes and version history.