Skip to content

Commit e96dc4a

Browse files
authored
Merge pull request #1719 from Belphemur/compact-banner
feat(notification:mute): Make a persistent banner for muted microphone Fixes #1682
2 parents 5ee0c5a + 4b1f334 commit e96dc4a

23 files changed

+466
-38
lines changed

README.de.md

+24-7
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@
77
**Nie wieder** durch mehrere Bildschirme und Menüs navigieren. SoundSwitch **einmalig** einstellen - und schon können Sie zwischen Geräten schneller wechseln, als jemals zuvor!
88

99
## ✨ Vorschau
10+
1011
![Vorschau](https://soundswitch.aaflalo.me/img/preview.gif)
1112

1213
## Anforderungen
14+
1315
- ⚠ Betriebssystem: Windows 7 oder neuer
1416

1517
## Spenden
18+
1619
Wenn Sie die Entwicklung unterstützen möchten, würden wir uns freuen, Sie [hier ❤](https://soundswitch.aaflalo.me/#donate) zu sehen.
1720

1821
## Einrichtung
22+
1923
_Rechtsklicken_ Sie das SoundSwitch Symbol in ihrer Taskleiste und wählen Sie _Einstellungen_. Jetzt wählen Sie aus, zwischen welchen Geräten Sie wechseln möchten. Optional können Sie hier auch die Tastatur-Kombinationen ändern, welche die Geräte wechselt. Wenn Sie möchten, dass das Programm automatisch startet wenn Sie Ihren PC einschalten, wählen Sie die Schaltfläche _Automatisch mit Windows starten_ aus.
2024

2125
## Bedienung
@@ -25,15 +29,20 @@ Wählen Sie zuerst, wie im vorigen Abschnitt beschrieben, Ihre gewünschten Ger
2529
**Nachdem Sie SoundSwitch eingerichtet haben** können Sie die folgenden Hotkeys verwenden:
2630

2731
- 🔊 Um durch Ihre **Wiedergabegeräte** zu schalten:
32+
2833
- `Strg` + `Alt` + `F11` (Standard) **oder**
2934
- Doppelklicken auf das `SoundSwitch Symbol in der Taskleiste`.
3035

3136
- 🎙 Um durch Ihre **Aufnahmegeräte** zu wechseln, verwenden Sie:
37+
3238
- `Strg` + `Alt` + `F7` (Standard)
3339

3440
- 🔇 Um das **Standardmikrofon** stummzuschalten:
41+
3542
- `Strg` + `Alt` + `M` (Standard)
3643

44+
Wenn ein Mikrofon stummgeschaltet wird, erscheint ein dauerhaftes Banner auf Ihrem Bildschirm, um Sie daran zu erinnern, dass Ihr Mikrofon stummgeschaltet ist. Das Banner bleibt sichtbar, bis Sie die Stummschaltung des Mikrofons aufheben oder auf das Banner klicken, um es direkt zu aktivieren.
45+
3746
## 💻 Kommandozeile (CLI)
3847

3948
SoundSwitch verfügt über eine leistungsfähige Kommandozeilen-Schnittstelle, mit der Sie die Anwendung über die Befehlszeile steuern können:
@@ -50,39 +59,47 @@ Weitere Details zu den verfügbaren Befehlen und deren Verwendung finden Sie in
5059
SoundSwitch bietet vier verschiedenen Arten der Benachrichtigung, wenn ein Gerät gewechselt wird:
5160

5261
- #### 🎟 Banner Benachrichtigung
53-
Verwendet ein Anzeigeelement, welches über allem liegt (always-on-top), nützlich für die Verwendung in Spielen. Dies ist die Standardart der Benachrichtigung.
62+
63+
Verwendet ein Anzeigeelement, welches über allem liegt (always-on-top), nützlich für die Verwendung in Spielen. Dies ist die Standardart der Benachrichtigung.
5464

5565
- #### 🗨 Windows Benachrichtigung
56-
Verwendet die Standard Windows Benachrichtigung. Im Falle von Windows 7, ist dies das kleine Popup, welches überhalb der Taskleiste auftaucht. Für Windows 10, ist dies das Benachrichtigungssystem, welches von der rechten Kante des Bildschirms ins Bild gleitet.
66+
67+
Verwendet die Standard Windows Benachrichtigung. Im Falle von Windows 7, ist dies das kleine Popup, welches überhalb der Taskleiste auftaucht. Für Windows 10, ist dies das Benachrichtigungssystem, welches von der rechten Kante des Bildschirms ins Bild gleitet.
5768

5869
- #### 🎵 Akustische Benachrichtigung
59-
Diese Benachrichtigung ist ein Ton, der über das aktuell aktive Augabegerät abgespielt wird. Auf diese Weise teilt das neue Gerät ihnen mit, dass es ausgewählt ist.
70+
Diese Benachrichtigung ist ein Ton, der über das aktuell aktive Augabegerät abgespielt wird. Auf diese Weise teilt das neue Gerät ihnen mit, dass es ausgewählt ist.
6071

6172
## Profile
6273

6374
Mithilfe von Profilen ist es möglich zu einem bestimmten Gerät zu wechseln, wenn eine Bedingung eintritt. Profile können für die folgenden Zwecke definiert werden:
6475

6576
- ### 💫 Anwendungsprofil
66-
Wenn eine Anwendung fokussiert wird, werden die Soundeinstellungen auf der Grundlage des Profils geändert. Erstelle zum Beispiel ein Profil für Spotify, damit nur Musik über den Lautsprecher wiedergegeben wird, während das Lieblingsspiel über das Headset läuft.
77+
78+
Wenn eine Anwendung fokussiert wird, werden die Soundeinstellungen auf der Grundlage des Profils geändert. Erstelle zum Beispiel ein Profil für Spotify, damit nur Musik über den Lautsprecher wiedergegeben wird, während das Lieblingsspiel über das Headset läuft.
6779

6880
- ### ⌨️ Hotkeyprofil
69-
Wenn eine bestimmte Tastenkombination gedrückt wird, werden die Soundeinstellungen auf der Grundlage des Profils geändert. Definiere zum Beispiel eine spezielle Kombination, um als Wiedergabegerät den Fernseher zu verwenden.
81+
Wenn eine bestimmte Tastenkombination gedrückt wird, werden die Soundeinstellungen auf der Grundlage des Profils geändert. Definiere zum Beispiel eine spezielle Kombination, um als Wiedergabegerät den Fernseher zu verwenden.
7082

7183
## Erweiterte Funktionen
7284

7385
### 🎙 Kommunikation
86+
7487
SoundSwitch kann ebenfalls ihr **Standardkommunikationsgerät** wechseln, wenn Sie dies in den Einstellungen auswählen. Windows unterscheidet zwischen Multimedia- und Kommunikationsgeräten; dies bedeutet, wenn ein Programm Zugriff auf das Kommunikationsgerät haben möchte, liefert Windows das Standardkommunikationsgerät. Standardmäßig ändert SoundSwitch nur das Multimediagerät, nicht jedoch das Kommunikationsgerät. Wenn Sie jedoch die entsprechende Option in den Einstellungen wählen, wird zusätzlich das Kommunikationsgerät geändert.
7588

7689
### 📥 Auto-Updater
90+
7791
Alle 24 Stunden überprüft SoundSwitch das GitHub-Repository (dank der GitHub-API) auf ein neues Release. Falls ein neues Update verfügbar ist, erhalten Sie eine Benachrichtigung und der Menüpunkt "Kein Update verfügbar", im Kontextmenü des Taskleisten-Symbols, ändert sich zu "Update verfügbar". Die neue Version wird automatisch heruntergeladen und installiert, je nach aktueller _Update Einstellung_. Wir bieten dabei auch einen Changelog mit den neuesten Verbesserungen von SoundSwitch.
7892

7993
#### 🚥 Update Einstellungen
94+
8095
Es gibt drei verschiedene Arten, wie Updates installiert werden:
96+
8197
- **Updates automatisch installieren**, das Programm aktualisiert sich im Hintergrund selbständig ohne Nutzerinteraktion.
8298
- **Benachrichtigen falls Update verfügbar**, benachrichtigt Sie im Falle das ein Update verfügbar ist.
8399
- **Niemals**, ist selbsterklärend.
84100

85101
### 🌎 Unterstütze Sprachen
102+
86103
SoundSwitch ist in mehr als 20 Sprachen verfügbar, darunter **Englisch**, **Französisch**, **Deutsch**, **Spanisch**, **Italienisch**, **Portugiesisch (Brasilien)**, **Russisch**, **Chinesisch** und viele mehr.
87104

88105
Sie möchten etwas verbessern oder eine neue Sprache hinzufügen? Übersetzungen sind online editierbar [gleich hier](https://hosted.weblate.org/projects/soundswitch/#languages)!
@@ -97,7 +114,7 @@ Sie möchten etwas verbessern oder eine neue Sprache hinzufügen? Übersetzungen
97114

98115
- Original Developer: [Jeroen Pelgrims](http://jeroenpelgrims.be)
99116
- Disabling Notification [#33](https://github.com/Belphemur/SoundSwitch/pull/33) [@adamblackburn](https://github.com/adamblackburn)
100-
- Localization and german translation [#157](https://github.com/Belphemur/SoundSwitch/pull/157) [@FireEmerald](https://github.com/FireEmerald)
117+
- Localization and german translation [#157](https://github.com/Belphemur/SoundSwitch/pull/157) [@FireEmerald](https://github.com/FireEmerald)
101118
- Banner Notification [#186](https://github.com/Belphemur/SoundSwitch/pull/186) [@ramon18](https://github.com/ramon18)
102119
- Keyboard hook, [Christian Liensberger](http://www.liensberger.it/web/blog/?p=207)
103120
- Changing default sound device, [EreTIk](http://eretik.omegahg.com/)
@@ -127,7 +144,7 @@ of the License, or any later version.
127144

128145
This program is distributed in the hope that it will be useful,
129146
but WITHOUT ANY WARRANTY; without even the implied warranty of
130-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
147+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
131148
GNU General Public License for more details.
132149

133150
Die vollständige GPLv2-Lizenzdatei befindet sich [hier](https://github.com/Belphemur/SoundSwitch/blob/master/LICENSE.txt).

README.md

+29-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
<a href="https://soundswitch.aaflalo.me" title="SoundSwitch Website"><img src="https://soundswitch.aaflalo.me/img/Main-Logo-Blue.svg" alt="SoundSwitch Logo" height="180px"></a>
22

33
[![.NET](https://github.com/Belphemur/SoundSwitch/actions/workflows/dotnet.yml/badge.svg)](https://github.com/Belphemur/SoundSwitch/actions/workflows/dotnet.yml)[![Last Release](https://img.shields.io/github/release/Belphemur/SoundSwitch.svg)](https://soundswitch.aaflalo.me) [![Downloads for last Release](https://img.shields.io/github/downloads/Belphemur/SoundSwitch/total.svg)](https://soundswitch.aaflalo.me/) [![Translate](https://hosted.weblate.org/widgets/soundswitch/-/svg-badge.svg)](https://hosted.weblate.org/projects/soundswitch/) [![Donate](https://img.shields.io/badge/Donate-paypal%2Fcc-blue.svg)](https://soundswitch.aaflalo.me) [![Help](https://img.shields.io/badge/Discord-Community%20&%20Help-green?style=flat-square&logo=discord)](https://discord.gg/gUCw3Ue)
4+
45
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
6+
57
[![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors-)
8+
69
<!-- ALL-CONTRIBUTORS-BADGE:END -->
10+
711
**SoundSwitch** offers you the opportunity to switch your playback and recording devices using simple **hotkeys**.
812

913
**No more** navigating througth several menus and screens. Just configure SoundSwitch **once** and you are able to switch between your devices faster than ever before!
1014

1115
## ✨ Preview
16+
1217
![Preview](https://soundswitch.aaflalo.me/img/preview.gif?v=20191124)
1318

1419
## Requirements
20+
1521
- ⚠ Operating System: Windows 7 or newer
1622

1723
## Donations
24+
1825
If you'd like to support development, we would love to see you [here ❤](https://soundswitch.aaflalo.me/#donate).
1926

2027
## Configuration
28+
2129
_Right click_ the SoundSwitch icon in your system tray and choose _Settings_. Now select the devices between which you want to toggle. Optionally, you can also change the keyboard combination. If you want the application to start automatically when your PC boots up, check the box _Start automatically with Windows_.
2230

2331
## Usage
@@ -27,15 +35,20 @@ First set up your devices you want to cycle through, using _right click_ on the
2735
**After you configured** SoundSwitch you can use the following hotkeys:
2836

2937
- 🔊 To cycle through the **playback devices** press:
38+
3039
- `Ctrl` + `Alt` + `F11` (default) **or**
3140
- Double click on the `System Tray Icon` of SoundSwitch.
3241

3342
- 🎙 To cycle through the **recording devices** press:
43+
3444
- `Ctrl` + `Alt` + `F7` (default)
3545

3646
- 🔇 To mute the **default microphone** press:
47+
3748
- `Ctrl` + `Alt` + `M` (default)
3849

50+
When a microphone is muted, a persistent banner will appear on your screen to remind you that your microphone is muted. The banner will remain visible until you unmute the microphone or click on the banner to unmute it directly.
51+
3952
## 💻 Command Line Interface
4053

4154
SoundSwitch includes a powerful CLI that allows you to control the application through command line:
@@ -52,39 +65,47 @@ See the [CLI documentation](SoundSwitch.CLI/README.md) for more details about av
5265
SoundSwitch provides four types of notification when a device is changed:
5366

5467
- #### 🎟 Banner Notification
55-
Uses a custom always-on-top frame, useful for in-game usage. This is the recommended default display style.
68+
69+
Uses a custom always-on-top frame, useful for in-game usage. This is the recommended default display style.
5670

5771
- #### 🗨 Windows Notification
58-
Uses the balloon tip of Windows. In the case of Windows 7, it's the little balloon that opens next to the systray icon. For Windows 10, it's the notification system that slides from the right corner of the screen.
72+
73+
Uses the balloon tip of Windows. In the case of Windows 7, it's the little balloon that opens next to the systray icon. For Windows 10, it's the notification system that slides from the right corner of the screen.
5974

6075
- #### 🎵 Sound Notification
61-
This notification is a sound played on the switched device. This way when you are switching devices, the new device will 'chime' to tell you it's selected.
76+
This notification is a sound played on the switched device. This way when you are switching devices, the new device will 'chime' to tell you it's selected.
6277

6378
## Profiles
6479

6580
Using profiles, it is possible to switch to a specific device when a condition occurs. Profiles can be defined for the following purposes:
6681

6782
- ### 💫 Application profile
68-
When a application is focused, the sound settings are switched based on the profile. For example create a profile for Spotify to only play music on your speaker, while your favorite game is using your headset.
83+
84+
When a application is focused, the sound settings are switched based on the profile. For example create a profile for Spotify to only play music on your speaker, while your favorite game is using your headset.
6985

7086
- ### ⌨️ Hot key profile
71-
When a hot key combination is pressed, the sound settings are switched based on the profile. For example you define a special combination to switch your playback device to your television.
87+
When a hot key combination is pressed, the sound settings are switched based on the profile. For example you define a special combination to switch your playback device to your television.
7288

7389
## Advanced
7490

7591
### 🎙 Communications
92+
7693
SoundSwitch can also change the **Default Communication Device** when asked in the Settings. Windows differentiates between Multimedia and Communication; it means if an application asks to have access to communications audio device, it will receive the Default Communication Device. By default SoundSwitch only changes the multimedia device and not the communication device. Now if the checkbox is checked in the settings, it will also change the Communication Device.
7794

7895
### 📥 Auto-Updater
96+
7997
Every 24 hours SoundSwitch checks the GitHub repository (thanks to the GitHub API) for a new release. If a new one is available you will get a notification and the 'No update available' in the context menu will change to 'Update Available'. The new version gets automatically downloaded and installed, depeding on your _Update Mode_. We also provide a changelog with the latest improvements of SoundSwitch.
8098

8199
#### 🚥 Update Modes
100+
82101
There are three different options available on how updates are installed:
102+
83103
- **Silent**, means the program updates itself in the background without any prompts.
84104
- **Notify**, you will be notified when there's an update available.
85105
- **Never**, well this is self-explained.
86106

87107
### 🌎 Multi-Language Support
108+
88109
SoundSwitch is available in more than 20 languages including **English**, **French**, **German**, **Spanish**, **Italian**, **Portuguese (Brazilian)**, **Russian**, **Chinese**, and many more.
89110

90111
Want to improve an existing language or add another one? Translations are online editable [right here](https://hosted.weblate.org/projects/soundswitch/#languages)!
@@ -130,7 +151,7 @@ Want to improve an existing language or add another one? Translations are online
130151

131152
- Original Developer: [Jeroen Pelgrims](http://jeroenpelgrims.be)
132153
- Disabling Notification [#33](https://github.com/Belphemur/SoundSwitch/pull/33) [@adamblackburn](https://github.com/adamblackburn)
133-
- Localization and german translation [#157](https://github.com/Belphemur/SoundSwitch/pull/157) [@FireEmerald](https://github.com/FireEmerald)
154+
- Localization and german translation [#157](https://github.com/Belphemur/SoundSwitch/pull/157) [@FireEmerald](https://github.com/FireEmerald)
134155
- Banner Notification [#186](https://github.com/Belphemur/SoundSwitch/pull/186) [@ramon18](https://github.com/ramon18)
135156
- Keyboard hook, [Christian Liensberger](http://www.liensberger.it/web/blog/?p=207)
136157
- Changing default sound device, [EreTIk](http://eretik.omegahg.com/)
@@ -141,6 +162,7 @@ Want to improve an existing language or add another one? Translations are online
141162
- Icons [Pastel SVG icon set](https://codefisher.org/pastel-svg/), by Michael Buckley ([CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/))
142163
- Discovered and reported a security vulnerability with the updater and its code signature checker [#415](https://github.com/Belphemur/SoundSwitch/issues/415) [@JarLob](https://github.com/JarLob)
143164
- Free Icons from [Font Awesome](https://fontawesome.com/), Creative Commons Attribution 4.0 International license: [License](https://fontawesome.com/license/free)
165+
144166
### 🤝 JetBrains ![JetBrain Tooling](https://i.imgur.com/SN2qAuL.png "JetBrain Tooling")
145167

146168
Thanks for their Open-Source licence to their amazing IDEs and addons like [ReSharper](https://www.jetbrains.com/resharper) for Visual Studio.
@@ -160,7 +182,7 @@ of the License, or (at your option) any later version.
160182

161183
This program is distributed in the hope that it will be useful,
162184
but WITHOUT ANY WARRANTY; without even the implied warranty of
163-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
185+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
164186
GNU General Public License for more details.
165187

166188
The complete GPLv2 license file is located [here](https://github.com/Belphemur/SoundSwitch/blob/master/LICENSE.txt).

SoundSwitch.Common/Framework/Audio/Device/DeviceInfo.cs

+11-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ public partial class DeviceInfo : IEquatable<DeviceInfo>
1616

1717
[Obsolete("Use " + nameof(NameClean))]
1818
public string Name { get; }
19+
20+
[JsonIgnore]
21+
public string FriendlyName { get; private set; }
22+
23+
[JsonIgnore]
24+
public string DeviceName { get; private set; }
1925

2026
public string Id { get; }
2127
public DataFlow Type { get; }
@@ -37,12 +43,14 @@ public string NameClean
3743
//Old naming, can't do anything about this
3844
if (!match.Success)
3945
{
46+
FriendlyName = Name;
47+
DeviceName = string.Empty;
4048
return _nameClean = Name;
4149
}
4250

43-
var friendlyName = match.Groups["friendlyName"].Value;
44-
var deviceName = match.Groups["deviceName"].Value;
45-
return _nameClean = $"{NameCleanerRegex.Replace(friendlyName, "")} ({deviceName})";
51+
FriendlyName = match.Groups["friendlyName"].Value;
52+
DeviceName = match.Groups["deviceName"].Value;
53+
return _nameClean = $"{NameCleanerRegex.Replace(FriendlyName, "")} ({DeviceName})";
4654
}
4755
}
4856

SoundSwitch/Framework/Audio/Microphone/MicrophoneMuteToggler.cs

+19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System;
2+
using JetBrains.Annotations;
3+
using NAudio.CoreAudioApi;
24
using Serilog;
35
using SoundSwitch.Audio.Manager;
46
using SoundSwitch.Audio.Manager.Interop.Enum;
@@ -61,6 +63,23 @@ public MicrophoneMuteToggler(AudioSwitcher switcher)
6163
public (string Name, bool MuteState)? SetDefaultMuteState(bool muteState)
6264
{
6365
var microphone = _switcher.GetDefaultMmDevice(EDataFlow.eCapture, ERole.eCommunications);
66+
return SetMuteState(muteState, microphone);
67+
}
68+
69+
/// <summary>
70+
/// Set mute state for the microphone
71+
/// </summary>
72+
/// <param name="deviceId"></param>
73+
/// <param name="muteState">The mute state to set</param>
74+
/// <returns>Tuple with the device name and current mute state, null if couldn't interact with the microphone</returns>
75+
public (string Name, bool MuteState)? SetMicrophoneMuteState(string deviceId, bool muteState)
76+
{
77+
var microphone = _switcher.GetDevice(deviceId);
78+
return SetMuteState(muteState, microphone);
79+
}
80+
81+
private (string Name, bool MuteState)? SetMuteState(bool muteState, [CanBeNull] MMDevice microphone)
82+
{
6483
if (microphone == null)
6584
{
6685
Log.Information("Couldn't find a default microphone to set mute state");

0 commit comments

Comments
 (0)