From 882ffb5c02f82500fdb3696990ff9e78230f534d Mon Sep 17 00:00:00 2001 From: lx-s Date: Fri, 23 Jan 2026 11:39:00 +0100 Subject: [PATCH] Added option to pause/unpause media when muting/unmuting --- Dist/bin/changelog.txt | 5 + Translations/lang-de.json | 274 ++++++++++++++++++----------------- Translations/lang-en.json | 2 + WinMute/MediaController.cpp | 60 ++++++++ WinMute/MediaController.h | 41 ++++++ WinMute/MuteControl.cpp | 41 ++++-- WinMute/MuteControl.h | 12 +- WinMute/Settings_MuteDlg.cpp | 16 ++ WinMute/VistaAudio.cpp | 4 - WinMute/WMSettings.cpp | 10 ++ WinMute/WMSettings.h | 2 + WinMute/WMi18n.cpp | 22 +-- WinMute/WinMain.cpp | 10 +- WinMute/WinMute.cpp | 4 + WinMute/WinMute.rc | 47 +++--- WinMute/WinMute.vcxproj | 10 +- WinMute/common.h | 2 + WinMute/resource.h | 6 +- 18 files changed, 378 insertions(+), 190 deletions(-) create mode 100644 WinMute/MediaController.cpp create mode 100644 WinMute/MediaController.h diff --git a/Dist/bin/changelog.txt b/Dist/bin/changelog.txt index 2acf50a..e5451ca 100644 --- a/Dist/bin/changelog.txt +++ b/Dist/bin/changelog.txt @@ -1,3 +1,8 @@ +Version 2.5.5 (2026-01-23) + * Added feature to also try pausing/resuming currently playing media when muting/unmuting. + * Fixed loading of languages that have certain translations missing. + * Fixed rare crashes when trying to get the audio device name from the system. + Version 2.5.4 (2025-11-12) * Fixed: "Save" Button not enabling, when adding a new WiFi SSID diff --git a/Translations/lang-de.json b/Translations/lang-de.json index dd90b75..9f57ac5 100644 --- a/Translations/lang-de.json +++ b/Translations/lang-de.json @@ -1,138 +1,140 @@ { - "meta.lang.name": "Deutsch (German)", - "meta.lang.mode": "ltr", - "init.error.settings.title": "Fehler beim Initialisieren", - "init.error.settings.text": "Kritischer Fehler beim Initialisieren von WinMute", - "init.error.already-running.title": "WinMute läuft bereits", - "init.error.already-running.text": "Bitte halten Sie ausschau nach einem weißen Lautsprechersymbol im Symbolbereich der Taskleiste.", - "init.error.winmute.title": "Fehler beim Starten von WinMute.", - "init.error.winmute.text": "Ein kritischer Fehler trat beim starten von WinMute auf. Das Programm muss beendet werden.", - "init.error.winmute.platform-support.title": "Nur Windows Vista and neuer werden unterstützt", - "init.error.winmute.platform-support.text": "Für Windows XP Unterstützung, kann WinMute in der Version 1.4.2 oder älter installiert werden.", - "general.error.winapi.text": "{} fehlgeschlagen mit Fehler {}: {}", - "general.error.audio-service-shutdown.title": "Der Audioservice wurde beendet.", - "general.error.audio-service-shutdown.text": "WinMute kann diese Situation nicht Beheben. Bitte starten Sie das Programm neu.", - "popup.remote-session-detected.title": "Remote Session festgestellt", - "popup.remote-session-detected.text": "Alle Audiogeräte wurden stumm geschaltet", - "popup.bluetooth-muting-disabled.title": "Bluetooth-Stummschalten deaktiviert", - "popup.bluetooth-muting-disabled.text": "Bluetooth ist nicht verfügbar oder deaktiviert.\nDas Bluetooth-abhängige Stummschalten wurde deaktiviert.", - "popup.wlan-muting-disabled.title": "WLAN-Stummschalten deaktiviert", - "popup.wlan-muting-disabled.text": "WLAN ist nicht verfügbar oder deaktiviert.\nDas WLAN-abhängige Stummschalten wurde deaktiviert.", - "popup.quiet-hours-started.title": "Die Ruhezeit hat begonnen", - "popup.quiet-hours-started.text": "Der Computer wird stumm geschaltet.", - "popup.quiet-hours-ended.title": "Ruhezeit vorbei", - "popup.quiet-hours-ended.text": "Audiopegel wurden wiederhergestellt.", - "popup.workstation-muted.title": "Computer stummgeschaltet", - "popup.wlan-not-on-mute-list.text": "WLAN-Netzwerk \"{}\" ist nicht auf der Erlaubt-Liste.", - "popup.wlan-is-on-mute-list.text": "WLAN-Netzwerknetwork \"{}\" wurde für das automatische Stummschalten konfiguriert.", - "popup.muting-workstation-after-delay.title": "Verzögertes Stummschalten des Computers", - "popup.muting-workstation-after-delay.text": "Alle Audiogeräte wurden stummgeschaltet", - "popup.volume-restored.title": "Lautstärke wiederhergestellt", - "popup.volume-restored.text": "Die Lautstärkepegel aller Audiogeräte wurden wiederhergestellt", - "popup.muting-workstation.title": "Stummschalten des Computers", - "popup.muting-workstation.text": "Alle Audiogeräte wurden stumm geschaltet", - "popup.error.quiet-hours-start.title": "Beginn der Ruhzeit", - "popup.error.quiet-hours-start.text": "Fehler beim Registrieren des Windows-Timers für den Ruhezeit-Beginn", - "popup.error.quiet-hours-stop.title": "Ende der Ruhezeit", - "popup.error.quiet-hours-stop.text": "Fehler beim Registrieren des Windows-Timers für das Ruhezeit-Ende", - "traymenu.info": "Info", - "traymenu.mute-when": "Stummschalten sobald...", - "traymenu.mute-on-lock": "... PC gesperrt wird", - "traymenu.mute-on-screen-suspend": "... der Bildschirm sich ausschaltet", - "traymenu.restore-volume": "Lautstärke wiederherstellen", - "traymenu.mute-no-restore": "Stummschalten ohne Wiederherstellung...", - "traymenu.mute-on-shutdown": "... Herunterfahren", - "traymenu.mute-on-sleep": "... Standby", - "traymenu.mute-on-logout": "... Ausloggen", - "traymenu.mute-all-devices": "Alle Geräte jetzt stummschalten", - "traymenu.settings": "Einstellungen...", - "traymenu.exit": "Beenden", - "settings.title": "Einstellungen", - "settings.btn-save": "Speichern", - "settings.btn-cancel": "Abbrechen", - "settings.btn-add": "Hinzufügen", - "settings.btn-edit": "Bearbeiten", - "settings.btn-remove": "Entfernen", - "settings.btn-remove-all": "Alle entfernen", - "settings.tab.general": "Allgemein", - "settings.tab.mute": "Stummschalten", - "settings.tab.quiet-hours": "Ruhezeit", - "settings.tab.bluetooth": "Bluetooth", - "settings.tab.wifi": "WLAN", - "settings.bluetooth.add-edit.add-title": "Bluetooth-Gerät hinzufügen", - "settings.bluetooth.add-edit.edit-title": "Bluetooth-Gerät bearbeiten", - "settings.bluetooth.add-edit.device-name-label": "Bluetooth Gerätename:", - "settings.general.run-on-startup": "WinMute mit Windows starten", - "settings.general.enable-logging": "Protokoll in Datei speichern", - "settings.general.btn-open-log-file": "Protokolldatei öffnen...", - "settings.general.btn-open-log-window": "Protokoll anzeigen...", - "settings.general.select-language-label": "Sprache", - "settings.bluetooth.add-edit.enter-device-name-placeholder": "Bitte geben Sie einen Gerätenamen an", - "settings.bluetooth.description": "\"Bluetooth Muting\" aktiviert das Stummschalten des PCs sobald ein Bluetooth-Audiogerät vom PC getrennt wird und hebt die Stummschaltung auf, sobald es wieder verbunden wird.\n\nDieses Verhalten kann für alle oder nur bestimmte Bluetooth-Geräte aktiviert werden.", - "settings.bluetooth.enable-muting": "\"Bluetooth Stummschalten\" aktivieren", - "settings.bluetooth.enable-muting-filter": "Nur für die folgenden Geräte aktivieren:", - "settings.bluetooth-disabled-info": "Info: Bluetooth ist auf diesem Gerät nicht verfügbar.\nEinige Optionen wurden deaktiviert.", - "settings.mute.general-title": "Allgemein", - "settings.mute.show-mute-event-notifications": "Zeige Benachrichtigungen an", - "settings.mute.manage-endpoints-individually": "Verwalte Audiogeräte individuell", - "settings.mute.btn-manage-endpoints": "Audiogeräte verwalten...", - "settings.mute.mute-with-restore.title": "Stummschalten mit Lautstärkewiederherstellung, wenn...", - "settings.mute.mute-with-restore.when-workstation-is-locked": "... der PC gesperrt wird", - "settings.mute.mute-with-restore.when-screen-turns-off": "... der Bildschirm in Standby geht", - "settings.mute.mute-with-restore.restore-volume": "Lautstärke danach wiederherstellen", - "settings.mute.mute-with-restore.restore-volume-delay-label": "Sekunden Verzögerung vor dem Stummschalten.", - "settings.mute.mute-without-restore.title": "Stummschalten ohne Lautstärkenwiederherstellung, wenn...", - "settings.mute.mute-without-restore.when-computer-shuts-down": "... der Computer heruntegefahren wird", - "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "... der Computer in den Schlaf-/Ruhemodus geht", - "settings.mute.mute-without-restore.when-user-logs-out": "... sich der Benutzer abmeldet", - "settings.mute.mute-without-restore.when-rdp-session-starts": "... eine RDP Session erkannt wird", - "settings.quiet-hours.intro": "Während der Ruhezeit schaltet WinMute alle Audiogeräte auf Stumm und stellt anschließend die Lautstärke wieder her.", - "settings.quiet-hours.enable": "Ruhzeit aktivieren", - "settings.quiet-hours.start-time-label": "Beginn:", - "settings.quiet-hours.end-time-label": "Ende:", - "settings.quiet-hours.force-unmute": "Lautstärkewiederherstellung erzwingen", - "settings.quiet-hours.force-unmute-description": "Die Lautstärke wird von allen Audiogeräten wiederhergestellt, unabhängig davon ob diese vor der Ruhezeit stumm geschaltet waren, oder nicht.", - "settings.quiet-hours.show-notifications": "Benachrichtigungen zur Ruhezeit anzeigen", - "settings.quiet-hours.error.invalid-time-range.title": "Fehlerhafter Zeitraum", - "settings.quiet-hours.error.invalid-time-range.text": "Beginn und Ende müssen unterschiedliche Zeiten sein.", - "settings.quiet-hours.error.error-while-saving.title": "Fehler beim Speichern der Einstellungen", - "settings.quiet-hours.error.error-while-saving.text": "Während dem Speichern der Ruhezeiteinstellungen trat ein Fehler auf", - "settings.wifi.intro": "Das WLAN basiert Stummschalten ermöglicht es die PC-Lautstärke abhängig von dem Namen des verbundenen WLAN Netzwerks zu steuern.", - "settings.wifi.enable": "Aktiviere WLAN-basiertes Stummschalten", - "settings.wifi.mute-when-not-in-list": "Stummschalten, wenn das WLAN nicht in der Liste ist", - "settings.wifi.wifi-disabled-info": "Info: WLAN ist auf diesem Gerät nicht verfügbar.\nEinige Optionen wurden deaktiviert.", - "settings.wifi.add-edit.add-title": "WLAN Netzwerk hinzufügen", - "settings.wifi.add-edit.edit-title": "WLAN Netzwerk bearbeiten", - "settings.wifi.add-edit.ssid-name-label": "SSID/WLAN-Name:", - "settings.wifi.add-edit.enter-device-name-placeholder": "Bitte geben sie einen WLAN Netzwerknamen ein", - "settings.mute.manage-endpoints.title": "Audiogeräte verwalten", - "settings.mute.manage-endpoints.list-behaviour.title": "Allgemein", - "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "Nur gespeicherte Audiogeräte stummschalten", - "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "Alle bis auf die gespeicherten Audiogeräte stummschalten", - "settings.mute.manage-endpoints.endpoints.title": "Audiogeräte", - "settings.mute.manage-endpoints.add-edit.add-title": "Gerät hinzufügen", - "settings.mute.manage-endpoints.add-edit.edit-title": "Gerät bearbeiten", - "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "Bitte ein Audiogerät angeben", - "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "Audiogerät:", - "about.title": "Über WinMute", - "about.general.author-site-label": "Entwickler: www.lx-s.de", - "about.general.project-site-label": "Projektseite && Code", - "about.general.support-label": "Hilfe/Unterstützung", - "about.general.description": "WinMute wird von Alexander Steinhöfer in seiner Freizeit entwickelt. Der Quelltext sowie neue Programmversionen können auf GitHub heruntergeladen werden. Beiträge in Form von Code, Tickets oder Featurewünsche werden gerne gesehen! Vielen Dank dass Sie dieses kleine Tool verwenden!", - "about.tab.winmute": "WinMute", - "about.tab.license": "Lizenz", - "about.btn-close": "OK", - "settings.wifi.mute-when-in-list": "Stummschalten, wenn das WLAN in der Liste ist", - "settings.general.check-for-updates-on-start": "Bei Programmstart nach Updates suchen", - "popup.update-available.text": "Die installierte Version ist {}.\nKlicken sie auf diese Nachricht zum Öffnen der Downloadseite.", - "popup.update-available-beta.title": "WinMute Beta {} ist verfügbar!", - "popup.update-available-beta.text": "Die installierte Version ist {}.\nKlicken sie auf diese Nachricht zum Öffnen der Beta-Downloadseite.", - "settings.bluetooth.bluetooth-disabled-info": "Info: Bluetooth ist auf diesem Gerät nicht verfügbar.\nEinige Optionen wurden deaktiviert.", - "popup.error.update-check-failed.title": "Updateprüfung fehlgeschlagen.", - "popup.update-available.title": "WinMute {} ist verfügbar!", - "pupup.error.update-check-failed.text": "Fehler beim Prüfen auf eine neue Version.\nBitte prüfen Sie die Protokolldateien.", - "settings.general.check-for-beta-updates-on-start": "Auf Vorabversionen überprüfen", - "settings.general.updates-handled-externally": "Optionen deaktiviert: Updates werden extern durchgeführt", - "settings.general.help-translating": "Hilf beim Übersetzen", - "log.title": "WinMute Protokolldatei" + "meta.lang.name": "Deutsch (German)", + "meta.lang.mode": "ltr", + "init.error.settings.title": "Fehler beim Initialisieren", + "init.error.settings.text": "Kritischer Fehler beim Initialisieren von WinMute", + "init.error.already-running.title": "WinMute läuft bereits", + "init.error.already-running.text": "Bitte halten Sie ausschau nach einem weißen Lautsprechersymbol im Symbolbereich der Taskleiste.", + "init.error.winmute.title": "Fehler beim Starten von WinMute.", + "init.error.winmute.text": "Ein kritischer Fehler trat beim starten von WinMute auf. Das Programm muss beendet werden.", + "init.error.winmute.platform-support.title": "Nur Windows Vista and neuer werden unterstützt", + "init.error.winmute.platform-support.text": "Für Windows XP Unterstützung, kann WinMute in der Version 1.4.2 oder älter installiert werden.", + "general.error.winapi.text": "{} fehlgeschlagen mit Fehler {}: {}", + "general.error.audio-service-shutdown.title": "Der Audioservice wurde beendet.", + "general.error.audio-service-shutdown.text": "WinMute kann diese Situation nicht Beheben. Bitte starten Sie das Programm neu.", + "popup.remote-session-detected.title": "Remote Session festgestellt", + "popup.remote-session-detected.text": "Alle Audiogeräte wurden stumm geschaltet", + "popup.bluetooth-muting-disabled.title": "Bluetooth-Stummschalten deaktiviert", + "popup.bluetooth-muting-disabled.text": "Bluetooth ist nicht verfügbar oder deaktiviert.\nDas Bluetooth-abhängige Stummschalten wurde deaktiviert.", + "popup.wlan-muting-disabled.title": "WLAN-Stummschalten deaktiviert", + "popup.wlan-muting-disabled.text": "WLAN ist nicht verfügbar oder deaktiviert.\nDas WLAN-abhängige Stummschalten wurde deaktiviert.", + "popup.quiet-hours-started.title": "Die Ruhezeit hat begonnen", + "popup.quiet-hours-started.text": "Der Computer wird stumm geschaltet.", + "popup.quiet-hours-ended.title": "Ruhezeit vorbei", + "popup.quiet-hours-ended.text": "Audiopegel wurden wiederhergestellt.", + "popup.workstation-muted.title": "Computer stummgeschaltet", + "popup.wlan-not-on-mute-list.text": "WLAN-Netzwerk \"{}\" ist nicht auf der Erlaubt-Liste.", + "popup.wlan-is-on-mute-list.text": "WLAN-Netzwerknetwork \"{}\" wurde für das automatische Stummschalten konfiguriert.", + "popup.muting-workstation-after-delay.title": "Verzögertes Stummschalten des Computers", + "popup.muting-workstation-after-delay.text": "Alle Audiogeräte wurden stummgeschaltet", + "popup.volume-restored.title": "Lautstärke wiederhergestellt", + "popup.volume-restored.text": "Die Lautstärkepegel aller Audiogeräte wurden wiederhergestellt", + "popup.muting-workstation.title": "Stummschalten des Computers", + "popup.muting-workstation.text": "Alle Audiogeräte wurden stumm geschaltet", + "popup.error.quiet-hours-start.title": "Beginn der Ruhzeit", + "popup.error.quiet-hours-start.text": "Fehler beim Registrieren des Windows-Timers für den Ruhezeit-Beginn", + "popup.error.quiet-hours-stop.title": "Ende der Ruhezeit", + "popup.error.quiet-hours-stop.text": "Fehler beim Registrieren des Windows-Timers für das Ruhezeit-Ende", + "traymenu.info": "Info", + "traymenu.mute-when": "Stummschalten sobald...", + "traymenu.mute-on-lock": "... PC gesperrt wird", + "traymenu.mute-on-screen-suspend": "... der Bildschirm sich ausschaltet", + "traymenu.restore-volume": "Lautstärke wiederherstellen", + "traymenu.mute-no-restore": "Stummschalten ohne Wiederherstellung...", + "traymenu.mute-on-shutdown": "... Herunterfahren", + "traymenu.mute-on-sleep": "... Standby", + "traymenu.mute-on-logout": "... Ausloggen", + "traymenu.mute-all-devices": "Alle Geräte jetzt stummschalten", + "traymenu.settings": "Einstellungen...", + "traymenu.exit": "Beenden", + "settings.title": "Einstellungen", + "settings.btn-save": "Speichern", + "settings.btn-cancel": "Abbrechen", + "settings.btn-add": "Hinzufügen", + "settings.btn-edit": "Bearbeiten", + "settings.btn-remove": "Entfernen", + "settings.btn-remove-all": "Alle entfernen", + "settings.tab.general": "Allgemein", + "settings.tab.mute": "Stummschalten", + "settings.tab.quiet-hours": "Ruhezeit", + "settings.tab.bluetooth": "Bluetooth", + "settings.tab.wifi": "WLAN", + "settings.bluetooth.add-edit.add-title": "Bluetooth-Gerät hinzufügen", + "settings.bluetooth.add-edit.edit-title": "Bluetooth-Gerät bearbeiten", + "settings.bluetooth.add-edit.device-name-label": "Bluetooth Gerätename:", + "settings.general.run-on-startup": "WinMute mit Windows starten", + "settings.general.enable-logging": "Protokoll in Datei speichern", + "settings.general.btn-open-log-file": "Protokolldatei öffnen...", + "settings.general.btn-open-log-window": "Protokoll anzeigen...", + "settings.general.select-language-label": "Sprache", + "settings.bluetooth.add-edit.enter-device-name-placeholder": "Bitte geben Sie einen Gerätenamen an", + "settings.bluetooth.description": "\"Bluetooth Muting\" aktiviert das Stummschalten des PCs sobald ein Bluetooth-Audiogerät vom PC getrennt wird und hebt die Stummschaltung auf, sobald es wieder verbunden wird.\n\nDieses Verhalten kann für alle oder nur bestimmte Bluetooth-Geräte aktiviert werden.", + "settings.bluetooth.enable-muting": "\"Bluetooth Stummschalten\" aktivieren", + "settings.bluetooth.enable-muting-filter": "Nur für die folgenden Geräte aktivieren:", + "settings.bluetooth-disabled-info": "Info: Bluetooth ist auf diesem Gerät nicht verfügbar.\nEinige Optionen wurden deaktiviert.", + "settings.mute.general-title": "Allgemein", + "settings.mute.show-mute-event-notifications": "Zeige Benachrichtigungen an", + "settings.mute.manage-endpoints-individually": "Verwalte Audiogeräte individuell", + "settings.mute.btn-manage-endpoints": "Audiogeräte verwalten...", + "settings.mute.mute-with-restore.title": "Stummschalten mit Lautstärkewiederherstellung, wenn...", + "settings.mute.mute-with-restore.when-workstation-is-locked": "... der PC gesperrt wird", + "settings.mute.mute-with-restore.when-screen-turns-off": "... der Bildschirm in Standby geht", + "settings.mute.mute-with-restore.restore-volume": "Lautstärke danach wiederherstellen", + "settings.mute.mute-with-restore.restore-volume-delay-label": "Sekunden Verzögerung vor dem Stummschalten.", + "settings.mute.mute-without-restore.title": "Stummschalten ohne Lautstärkenwiederherstellung, wenn...", + "settings.mute.mute-without-restore.when-computer-shuts-down": "... der Computer heruntegefahren wird", + "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "... der Computer in den Schlaf-/Ruhemodus geht", + "settings.mute.mute-without-restore.when-user-logs-out": "... sich der Benutzer abmeldet", + "settings.mute.mute-without-restore.when-rdp-session-starts": "... eine RDP Session erkannt wird", + "settings.mute.try-pause-media-on-mute": "Versuche Medien beim Stummschalten pausieren.", + "settings.mute.try-resume-media-on-unmute": "Versuche Medien beim Wiederherstellen wieder abzuspielen.", + "settings.quiet-hours.intro": "Während der Ruhezeit schaltet WinMute alle Audiogeräte auf Stumm und stellt anschließend die Lautstärke wieder her.", + "settings.quiet-hours.enable": "Ruhzeit aktivieren", + "settings.quiet-hours.start-time-label": "Beginn:", + "settings.quiet-hours.end-time-label": "Ende:", + "settings.quiet-hours.force-unmute": "Lautstärkewiederherstellung erzwingen", + "settings.quiet-hours.force-unmute-description": "Die Lautstärke wird von allen Audiogeräten wiederhergestellt, unabhängig davon ob diese vor der Ruhezeit stumm geschaltet waren, oder nicht.", + "settings.quiet-hours.show-notifications": "Benachrichtigungen zur Ruhezeit anzeigen", + "settings.quiet-hours.error.invalid-time-range.title": "Fehlerhafter Zeitraum", + "settings.quiet-hours.error.invalid-time-range.text": "Beginn und Ende müssen unterschiedliche Zeiten sein.", + "settings.quiet-hours.error.error-while-saving.title": "Fehler beim Speichern der Einstellungen", + "settings.quiet-hours.error.error-while-saving.text": "Während dem Speichern der Ruhezeiteinstellungen trat ein Fehler auf", + "settings.wifi.intro": "Das WLAN basiert Stummschalten ermöglicht es die PC-Lautstärke abhängig von dem Namen des verbundenen WLAN Netzwerks zu steuern.", + "settings.wifi.enable": "Aktiviere WLAN-basiertes Stummschalten", + "settings.wifi.mute-when-not-in-list": "Stummschalten, wenn das WLAN nicht in der Liste ist", + "settings.wifi.wifi-disabled-info": "Info: WLAN ist auf diesem Gerät nicht verfügbar.\nEinige Optionen wurden deaktiviert.", + "settings.wifi.add-edit.add-title": "WLAN Netzwerk hinzufügen", + "settings.wifi.add-edit.edit-title": "WLAN Netzwerk bearbeiten", + "settings.wifi.add-edit.ssid-name-label": "SSID/WLAN-Name:", + "settings.wifi.add-edit.enter-device-name-placeholder": "Bitte geben sie einen WLAN Netzwerknamen ein", + "settings.mute.manage-endpoints.title": "Audiogeräte verwalten", + "settings.mute.manage-endpoints.list-behaviour.title": "Allgemein", + "settings.mute.manage-endpoints.list-behaviour.mute-only-listed": "Nur gespeicherte Audiogeräte stummschalten", + "settings.mute.manage-endpoints.list-behaviour.mute-all-but-listed": "Alle bis auf die gespeicherten Audiogeräte stummschalten", + "settings.mute.manage-endpoints.endpoints.title": "Audiogeräte", + "settings.mute.manage-endpoints.add-edit.add-title": "Gerät hinzufügen", + "settings.mute.manage-endpoints.add-edit.edit-title": "Gerät bearbeiten", + "settings.mute.manage-endpoints.add-edit.endpoint-name-placeholder": "Bitte ein Audiogerät angeben", + "settings.mute.manage-endpoints.add-edit.endpoint-name-label": "Audiogerät:", + "about.title": "Über WinMute", + "about.general.author-site-label": "Entwickler: www.lx-s.de", + "about.general.project-site-label": "Projektseite && Code", + "about.general.support-label": "Hilfe/Unterstützung", + "about.general.description": "WinMute wird von Alexander Steinhöfer in seiner Freizeit entwickelt. Der Quelltext sowie neue Programmversionen können auf GitHub heruntergeladen werden. Beiträge in Form von Code, Tickets oder Featurewünsche werden gerne gesehen! Vielen Dank dass Sie dieses kleine Tool verwenden!", + "about.tab.winmute": "WinMute", + "about.tab.license": "Lizenz", + "about.btn-close": "OK", + "settings.wifi.mute-when-in-list": "Stummschalten, wenn das WLAN in der Liste ist", + "settings.general.check-for-updates-on-start": "Bei Programmstart nach Updates suchen", + "popup.update-available.text": "Die installierte Version ist {}.\nKlicken sie auf diese Nachricht zum Öffnen der Downloadseite.", + "popup.update-available-beta.title": "WinMute Beta {} ist verfügbar!", + "popup.update-available-beta.text": "Die installierte Version ist {}.\nKlicken sie auf diese Nachricht zum Öffnen der Beta-Downloadseite.", + "settings.bluetooth.bluetooth-disabled-info": "Info: Bluetooth ist auf diesem Gerät nicht verfügbar.\nEinige Optionen wurden deaktiviert.", + "popup.error.update-check-failed.title": "Updateprüfung fehlgeschlagen.", + "popup.update-available.title": "WinMute {} ist verfügbar!", + "pupup.error.update-check-failed.text": "Fehler beim Prüfen auf eine neue Version.\nBitte prüfen Sie die Protokolldateien.", + "settings.general.check-for-beta-updates-on-start": "Auf Vorabversionen überprüfen", + "settings.general.updates-handled-externally": "Optionen deaktiviert: Updates werden extern durchgeführt", + "settings.general.help-translating": "Hilf beim Übersetzen", + "log.title": "WinMute Protokolldatei" } diff --git a/Translations/lang-en.json b/Translations/lang-en.json index 6702152..5cef550 100644 --- a/Translations/lang-en.json +++ b/Translations/lang-en.json @@ -96,6 +96,8 @@ "settings.mute.mute-without-restore.when-computer-goes-to-sleep": "... the computer goes into sleep/hibernate", "settings.mute.mute-without-restore.when-user-logs-out": "... the user logs out", "settings.mute.mute-without-restore.when-rdp-session-starts": "... WinMute is started within a RDP session", + "settings.mute.try-pause-media-on-mute": "Try pausing currently played media when muting.", + "settings.mute.try-resume-media-on-unmute": "Try resuming media when unmuting.", "settings.quiet-hours.intro": "During Quiet Hours WinMute automatically mutes the computers audio devices and unmutes them afterwards.", "settings.quiet-hours.enable": "Enable Quiet Hours", "settings.quiet-hours.start-time-label": "Start time:", diff --git a/WinMute/MediaController.cpp b/WinMute/MediaController.cpp new file mode 100644 index 0000000..93d910f --- /dev/null +++ b/WinMute/MediaController.cpp @@ -0,0 +1,60 @@ +#include "common.h" +#include "MediaController.h" + +#include +#include + +using namespace winrt; +using namespace winrt::Windows::Media::Control; + +bool MediaController::TryPauseCurrentSession(bool &paused_media) +{ + auto &log = WMLog::GetInstance(); + try { + auto manager = GlobalSystemMediaTransportControlsSessionManager::RequestAsync().get(); + auto session = manager.GetCurrentSession(); + + if (session) { + auto playbackInfo = session.GetPlaybackInfo(); + auto status = playbackInfo.PlaybackStatus(); + + if (status == GlobalSystemMediaTransportControlsSessionPlaybackStatus::Playing) { + session.TryPauseAsync().get(); + log.LogInfo(L"MediaController: Paused current media session."); + paused_media = true; + } else { + log.LogDebug(L"MediaController: Media is not playing, no action needed.\n"); + paused_media = false; + } + } + } catch (const hresult_error& e) { + log.LogError(L"MediaController: Failed to pause current media session. Error: %s", + e.message().c_str()); + return false; + } + return true; +} + +bool MediaController::TryPlayCurrentSession() +{ + auto &log = WMLog::GetInstance(); + try { + auto manager = GlobalSystemMediaTransportControlsSessionManager::RequestAsync().get(); + auto session = manager.GetCurrentSession(); + + if (session) { + auto playbackInfo = session.GetPlaybackInfo(); + auto status = playbackInfo.PlaybackStatus(); + + if (status == GlobalSystemMediaTransportControlsSessionPlaybackStatus::Paused) { + session.TryPlayAsync().get(); + log.LogInfo(L"MediaController: Resumed current media session."); + } + } + } catch (const hresult_error &e) { + log.LogError(L"MediaController: Failed to resume current media session. Error: %s", + e.message().c_str()); + return false; + } + return true; +} diff --git a/WinMute/MediaController.h b/WinMute/MediaController.h new file mode 100644 index 0000000..d2a55de --- /dev/null +++ b/WinMute/MediaController.h @@ -0,0 +1,41 @@ +/* + WinMute + Copyright (c) 2025, Alexander Steinhoefer + +----------------------------------------------------------------------------- +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the author nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +----------------------------------------------------------------------------- +*/ + +#pragma once + +class MediaController { +public: + static bool TryPauseCurrentSession(bool& paused_media); + static bool TryPlayCurrentSession(); +}; + diff --git a/WinMute/MuteControl.cpp b/WinMute/MuteControl.cpp index 4b9e013..c70f98a 100644 --- a/WinMute/MuteControl.cpp +++ b/WinMute/MuteControl.cpp @@ -189,10 +189,7 @@ void MuteControl::MuteDelayed(int magic) return; } WMLog::GetInstance().LogInfo(L"Muting workstation after delay"); - ShowNotification( - WMi18n::GetInstance().GetTranslationW("popup.muting-workstation-after-delay.title"), - WMi18n::GetInstance().GetTranslationW("popup.muting-workstation-after-delay.text")); - winAudio_->SetMute(true); + MuteNow(); KillTimer(hMuteCtrlWnd_, delayedMuteTimerId_); delayedMuteTimerId_ = 0; } @@ -239,6 +236,10 @@ void MuteControl::RestoreVolume(bool withDelay) Sleep(BLUETOOTH_RECONNECT_UNMUTE_DELAY); } winAudio_->RestoreMuteStatus(); + if (mediaWasPlaying_ && mediaConfig_.tryResume) { + MediaController::TryPlayCurrentSession(); + mediaWasPlaying_ = false; + } } } @@ -287,6 +288,16 @@ void MuteControl::SetMuteOnBluetoothDisconnect(bool enable) muteConfig_[MuteTypeBluetoothDisconnect].shouldMute = enable; } +void MuteControl::SetMuteTryPauseMedia(bool enable) +{ + mediaConfig_.tryPause = enable; +} + +void MuteControl::SetMuteTryResumeMedia(bool enable) +{ + mediaConfig_.tryResume = enable; +} + bool MuteControl::GetRestoreVolume() { return restoreVolume_; @@ -327,6 +338,22 @@ bool MuteControl::GetMuteOnShutdown() const return muteConfig_[MuteTypeShutdown].shouldMute; } +void MuteControl::MuteNow() +{ + WMLog::GetInstance().LogInfo(L"Muting workstation"); + ShowNotification( + WMi18n::GetInstance().GetTranslationW("popup.muting-workstation.title"), + WMi18n::GetInstance().GetTranslationW("popup.muting-workstation.text")); + winAudio_->SetMute(true); + if (mediaConfig_.tryPause) { + bool did_pause = false; + if (MediaController::TryPauseCurrentSession(did_pause)) { + mediaWasPlaying_ = did_pause; + } + } +} + + void MuteControl::NotifyRestoreCondition(int type, bool active, bool withDelay) { if (active) { @@ -334,11 +361,7 @@ void MuteControl::NotifyRestoreCondition(int type, bool active, bool withDelay) muteConfig_[type].active = active; if (muteConfig_[type].shouldMute) { if (muteDelaySeconds_ == 0) { - WMLog::GetInstance().LogInfo(L"Muting workstation"); - ShowNotification( - WMi18n::GetInstance().GetTranslationW("popup.muting-workstation.title"), - WMi18n::GetInstance().GetTranslationW("popup.muting-workstation.text")); - winAudio_->SetMute(true); + MuteNow(); } else { WMLog::GetInstance().LogInfo(L"Starting delayed mute timer..."); StartDelayedMute(); diff --git a/WinMute/MuteControl.h b/WinMute/MuteControl.h index 349dfb7..63eb7c4 100644 --- a/WinMute/MuteControl.h +++ b/WinMute/MuteControl.h @@ -56,7 +56,10 @@ public: void SetMuteOnRemoteSession(bool enable); void SetMuteOnDisplayStandby(bool enable); void SetMuteOnBluetoothDisconnect(bool enable); - + + void SetMuteTryPauseMedia(bool enable); + void SetMuteTryResumeMedia(bool enable); + void SetMuteOnLogout(bool enable); void SetMuteOnSuspend(bool enable); void SetMuteOnShutdown(bool enable); @@ -97,9 +100,14 @@ private: bool shouldMute; bool active; }; + struct MediaConfig { + bool tryPause = false; + bool tryResume = false; + } mediaConfig_; std::vector muteConfig_; bool restoreVolume_ = false; bool notificationsEnabled_ = false; + bool mediaWasPlaying_ = false; int muteDelaySeconds_ = 0; UINT_PTR delayedMuteTimerId_ = 0; std::unique_ptr winAudio_; @@ -116,4 +124,6 @@ private: void RestoreVolume(bool withDelay = false); void ShowNotification(const std::wstring& title, const std::wstring& text); bool StartDelayedMute(); + + void MuteNow(); }; diff --git a/WinMute/Settings_MuteDlg.cpp b/WinMute/Settings_MuteDlg.cpp index 802f39a..f7bd910 100644 --- a/WinMute/Settings_MuteDlg.cpp +++ b/WinMute/Settings_MuteDlg.cpp @@ -67,6 +67,9 @@ static void LoadMuteDlgTranslation(HWND hDlg) i18n.SetItemText(hDlg, IDC_MUTE_WHEN_SLEEP, "settings.mute.mute-without-restore.when-computer-goes-to-sleep"); i18n.SetItemText(hDlg, IDC_MUTE_WHEN_LOGOUT, "settings.mute.mute-without-restore.when-user-logs-out"); i18n.SetItemText(hDlg, IDC_MUTE_WHEN_RDP_SESSION, "settings.mute.mute-without-restore.when-rdp-session-starts"); + + i18n.SetItemText(hDlg, IDC_MUTE_TRY_PAUSE_MEDIA, "settings.mute.try-pause-media-on-mute"); + i18n.SetItemText(hDlg, IDC_MUTE_TRY_RESUME_MEDIA, "settings.mute.try-resume-media-on-unmute"); } INT_PTR CALLBACK Settings_MuteDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -94,6 +97,9 @@ INT_PTR CALLBACK Settings_MuteDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM HWND hMuteOnSleep = GetDlgItem(hDlg, IDC_MUTE_WHEN_SLEEP); HWND hMuteOnLogout = GetDlgItem(hDlg, IDC_MUTE_WHEN_LOGOUT); + HWND hTryPauseMedia = GetDlgItem(hDlg, IDC_MUTE_TRY_PAUSE_MEDIA); + HWND hTryResumeMedia = GetDlgItem(hDlg, IDC_MUTE_TRY_RESUME_MEDIA); + WMSettings* settings = reinterpret_cast(lParam); assert(settings != nullptr); SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast(settings)); @@ -116,6 +122,9 @@ INT_PTR CALLBACK Settings_MuteDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM SetCheckButton(hMuteOnSleep, *settings, SettingsKey::MUTE_ON_SUSPEND); SetCheckButton(hMuteOnLogout, *settings, SettingsKey::MUTE_ON_LOGOUT); + SetCheckButton(hTryPauseMedia, *settings, SettingsKey::MUTE_TRY_PAUSE_MEDIA); + SetCheckButton(hTryResumeMedia, *settings, SettingsKey::MUTE_TRY_RESUME_MEDIA); + return TRUE; } case WM_COMMAND: @@ -150,6 +159,9 @@ INT_PTR CALLBACK Settings_MuteDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM HWND hMuteOnSleep = GetDlgItem(hDlg, IDC_MUTE_WHEN_SLEEP); HWND hMuteOnLogout = GetDlgItem(hDlg, IDC_MUTE_WHEN_LOGOUT); + HWND hTryPauseMedia = GetDlgItem(hDlg, IDC_MUTE_TRY_PAUSE_MEDIA); + HWND hTryResumeMedia = GetDlgItem(hDlg, IDC_MUTE_TRY_RESUME_MEDIA); + // General SetOption(hNotify, *settings, SettingsKey::NOTIFICATIONS_ENABLED); SetOption(hManageEndpoints, *settings, SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS); @@ -167,6 +179,10 @@ INT_PTR CALLBACK Settings_MuteDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM SetOption(hMuteOnSleep, *settings, SettingsKey::MUTE_ON_SUSPEND); SetOption(hMuteOnLogout, *settings, SettingsKey::MUTE_ON_LOGOUT); + // Media + SetOption(hTryPauseMedia, *settings, SettingsKey::MUTE_TRY_PAUSE_MEDIA); + SetOption(hTryResumeMedia, *settings, SettingsKey::MUTE_TRY_RESUME_MEDIA); + return 0; } default: diff --git a/WinMute/VistaAudio.cpp b/WinMute/VistaAudio.cpp index 05425e6..17c621a 100644 --- a/WinMute/VistaAudio.cpp +++ b/WinMute/VistaAudio.cpp @@ -60,15 +60,11 @@ VistaAudio::VistaAudio() : muteSpecificEndpointsAllowList_(false), hParent_(nullptr) { - if (FAILED(CoInitialize(nullptr))) { - throw std::exception("Failed to initialize COM Library"); - } } VistaAudio::~VistaAudio() { Uninit(); - CoUninitialize(); } bool VistaAudio::LoadAllEndpoints() diff --git a/WinMute/WMSettings.cpp b/WinMute/WMSettings.cpp index 94c3c60..176c07f 100644 --- a/WinMute/WMSettings.cpp +++ b/WinMute/WMSettings.cpp @@ -98,6 +98,12 @@ static const wchar_t* KeyToStr(SettingsKey key) case SettingsKey::MUTE_DELAY: keyStr = L"MuteDelay"; break; + case SettingsKey::MUTE_TRY_PAUSE_MEDIA: + keyStr = L"MuteTryPauseMedia"; + break; + case SettingsKey::MUTE_TRY_RESUME_MEDIA: + keyStr = L"MuteTryResumeMedia"; + break; case SettingsKey::QUIETHOURS_ENABLE: keyStr = L"QuietHoursEnabled"; break; @@ -161,6 +167,10 @@ static DWORD GetDefaultSetting(SettingsKey key) return MUTE_ENDPOINT_MODE_INDIVIDUAL_ALLOW_LIST; case SettingsKey::MUTE_DELAY: return 0; + case SettingsKey::MUTE_TRY_PAUSE_MEDIA: + return 1; + case SettingsKey::MUTE_TRY_RESUME_MEDIA: + return 1; case SettingsKey::QUIETHOURS_ENABLE: return 0; case SettingsKey::QUIETHOURS_FORCEUNMUTE: diff --git a/WinMute/WMSettings.h b/WinMute/WMSettings.h index f2c7cb4..1fb919d 100644 --- a/WinMute/WMSettings.h +++ b/WinMute/WMSettings.h @@ -57,6 +57,8 @@ enum class SettingsKey { // 1 = mute specific (allowlist), 2 = mute specific (blocklist) , MUTE_INDIVIDUAL_ENDPOINTS_MODE , MUTE_DELAY + , MUTE_TRY_PAUSE_MEDIA + , MUTE_TRY_RESUME_MEDIA , QUIETHOURS_ENABLE , QUIETHOURS_FORCEUNMUTE , QUIETHOURS_NOTIFICATIONS diff --git a/WinMute/WMi18n.cpp b/WinMute/WMi18n.cpp index 8d6cc31..548da11 100644 --- a/WinMute/WMi18n.cpp +++ b/WinMute/WMi18n.cpp @@ -148,16 +148,20 @@ bool WMi18n::LoadLanguage(const std::wstring &fileName, TranslationMap &strings) log.LogError(L"Language module \"%ls\" has nested elements", langFilePath->c_str()); return false; } - const auto value = ConvertStringToWideString(it.value()); - if (value == L"") { - log.LogError(L"Unable to convert language element \"%S\"", it.key().c_str()); - return false; - } - if (translations_temp.contains(it.key())) { - log.LogError(L"Double entry for language key \"%S\" found.", it.key().c_str()); - return false; + if (it.value() == L"") { + log.LogInfo(L"No translation for \"%S\" found in language file", it.key().c_str()); + } else { + const auto value = ConvertStringToWideString(it.value()); + if (value == L"") { + log.LogError(L"Unable to convert language element \"%S\"", it.key().c_str()); + return false; + } + if (translations_temp.contains(it.key())) { + log.LogError(L"Double entry for language key \"%S\" found.", it.key().c_str()); + return false; + } + translations_temp[it.key()] = value; } - translations_temp[it.key()] = value; } strings = std::move(translations_temp); } catch (const nlohmann::json::parse_error &pe) { diff --git a/WinMute/WinMain.cpp b/WinMute/WinMain.cpp index 0348d72..6602781 100644 --- a/WinMute/WinMain.cpp +++ b/WinMute/WinMain.cpp @@ -79,10 +79,10 @@ static bool InitWindowsComponents() initComCtrl.dwICC = ICC_LINK_CLASS; if (InitCommonControlsEx(&initComCtrl) == FALSE) { WMLog::GetInstance().LogWinError(L"InitCommonControlsEx", GetLastError()); - return FALSE; - } else if (CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED) != S_OK) { - WMLog::GetInstance().LogWinError(L"CoInitializeEx", GetLastError()); - return FALSE; + return false; + } else if (FAILED(RoInitialize(RO_INIT_MULTITHREADED))) { + WMLog::GetInstance().LogWinError(L"RoInitialize", GetLastError()); + return false; } return TRUE; } @@ -161,7 +161,7 @@ int WINAPI wWinMain( } } - CoUninitialize(); + RoUninitialize(); ReleaseMutex(hMutex); return static_cast(msg.wParam); } diff --git a/WinMute/WinMute.cpp b/WinMute/WinMute.cpp index 7cc1858..ea74ac4 100644 --- a/WinMute/WinMute.cpp +++ b/WinMute/WinMute.cpp @@ -291,6 +291,8 @@ bool WinMute::LoadSettings() log.LogInfo(L"\tMute on shutdown: %s", settings_.QueryValue(SettingsKey::MUTE_ON_SHUTDOWN) ? L"Yes" : L"No"); log.LogInfo(L"\tShow notifications: %s", settings_.QueryValue(SettingsKey::NOTIFICATIONS_ENABLED) ? L"Yes" : L"No"); log.LogInfo(L"\tMute on bluetooth: %s", settings_.QueryValue(SettingsKey::MUTE_ON_BLUETOOTH) ? L"Yes" : L"No"); + log.LogInfo(L"\tTry pausing media when muting: %s", settings_.QueryValue(SettingsKey::MUTE_TRY_PAUSE_MEDIA) ? L"Yes" : L"No"); + log.LogInfo(L"\tTry resuming media when unmuting: %s", settings_.QueryValue(SettingsKey::MUTE_TRY_RESUME_MEDIA) ? L"Yes" : L"No"); log.LogInfo(L"\t\tUse devicelist: %s", settings_.QueryValue(SettingsKey::MUTE_ON_BLUETOOTH_DEVICELIST) ? L"Yes" : L"No"); log.LogInfo(L"\tMute on WLAN: %s", settings_.QueryValue(SettingsKey::MUTE_ON_WLAN) ? L"Yes" : L"No"); log.LogInfo(L"\t\tUse allowlist: %s", settings_.QueryValue(SettingsKey::MUTE_ON_WLAN_ALLOWLIST) ? L"Yes" : L"No"); @@ -311,6 +313,8 @@ bool WinMute::LoadSettings() muteCtrl_.SetMuteOnLogout(settings_.QueryValue(SettingsKey::MUTE_ON_LOGOUT)); muteCtrl_.SetMuteOnSuspend(settings_.QueryValue(SettingsKey::MUTE_ON_SUSPEND)); muteCtrl_.SetMuteOnShutdown(settings_.QueryValue(SettingsKey::MUTE_ON_SHUTDOWN)); + muteCtrl_.SetMuteTryPauseMedia(settings_.QueryValue(SettingsKey::MUTE_TRY_PAUSE_MEDIA)); + muteCtrl_.SetMuteTryResumeMedia(settings_.QueryValue(SettingsKey::MUTE_TRY_RESUME_MEDIA)); muteCtrl_.SetNotifications(settings_.QueryValue(SettingsKey::NOTIFICATIONS_ENABLED)); diff --git a/WinMute/WinMute.rc b/WinMute/WinMute.rc index 3f4e34b..33c9bd0 100644 --- a/WinMute/WinMute.rc +++ b/WinMute/WinMute.rc @@ -62,15 +62,15 @@ BEGIN PUSHBUTTON "OK",IDOK,242,246,64,16 END -IDD_SETTINGS DIALOGEX 0, 0, 269, 267 +IDD_SETTINGS DIALOGEX 0, 0, 275, 314 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT | WS_EX_APPWINDOW CAPTION "Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL "",IDC_SETTINGS_TAB,"SysTabControl32",0x0,7,7,255,238 - DEFPUSHBUTTON "OK",IDOK,158,246,50,14 - PUSHBUTTON "Cancel",IDCANCEL,212,246,50,14 + CONTROL "",IDC_SETTINGS_TAB,"SysTabControl32",0x0,7,7,261,285 + DEFPUSHBUTTON "OK",IDOK,165,293,50,14 + PUSHBUTTON "Cancel",IDCANCEL,218,293,50,14 END IDD_SETTINGS_GENERAL DIALOGEX 0, 0, 233, 205 @@ -131,32 +131,37 @@ BEGIN EDITTEXT IDC_ABOUTTEXT,7,14,182,144,ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_READONLY | NOT WS_BORDER END -IDD_SETTINGS_MUTE DIALOGEX 0, 0, 242, 222 +IDD_SETTINGS_MUTE DIALOGEX 0, 0, 253, 263 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - GROUPBOX "General",IDC_GROUP_GENERAL,7,7,228,61 + GROUPBOX "General",IDC_GROUP_GENERAL,7,7,239,61 CONTROL "Show mute event notifications",IDC_SHOWNOTIFICATIONS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,15,219,18 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,15,227,18 CONTROL "Manage audio endpoints individually",IDC_MANAGE_AUDIO_ENDPOINTS_INDIVIDUALLY, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,28,219,18 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,28,227,18 PUSHBUTTON "Manage endpoints...",IDC_MANAGE_ENDPOINTS,26,46,97,15 - GROUPBOX "Mute with volume restore, when...",IDC_GROUP_MUTE_WITH_RESTORE,7,71,228,71 + GROUPBOX "Mute with volume restore, when...",IDC_GROUP_MUTE_WITH_RESTORE,7,71,239,71 CONTROL "... the workstation is locked.",IDC_MUTE_WHEN_WS_LOCKED, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,83,207,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,83,214,10 CONTROL "... the screen turns off.",IDC_MUTE_WHEN_SCREEN_OFF, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,97,205,10 - CONTROL "Restore volume afterwards.",IDC_RESTOREVOLUME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,112,210,10 + CONTROL "Restore volume afterwards.",IDC_RESTOREVOLUME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,112,221,10 EDITTEXT IDC_MUTEDELAY,13,124,30,13,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "seconds delay before muting.",IDC_DELAY_MUTING_LABEL,47,127,169,8 - GROUPBOX "Mute without volume restore, when...",IDC_GROUP_MUTE_WITHOUT_RESTORE,7,145,228,67 + LTEXT "seconds delay before muting.",IDC_DELAY_MUTING_LABEL,47,127,187,8 + GROUPBOX "Mute without volume restore, when...",IDC_GROUP_MUTE_WITHOUT_RESTORE,7,145,239,67 CONTROL "... the computer shuts down.",IDC_MUTE_WHEN_SHUTDOWN, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,156,207,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,156,220,10 CONTROL "... the computer goes into sleep/hibernate.",IDC_MUTE_WHEN_SLEEP, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,170,206,10 - CONTROL "... you log out.",IDC_MUTE_WHEN_LOGOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,184,207,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,170,214,10 + CONTROL "... you log out.",IDC_MUTE_WHEN_LOGOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,184,214,10 CONTROL "... when WinMute is started within a RDP session.",IDC_MUTE_WHEN_RDP_SESSION, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,198,208,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,198,220,10 + GROUPBOX "Media",IDC_GROUP_MUTE_MEDIA_CONTROL,7,216,239,42 + CONTROL "Try pausing currently played media when muting.",IDC_MUTE_TRY_PAUSE_MEDIA, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,227,219,10 + CONTROL "Try resuming media when unmuting.",IDC_MUTE_TRY_RESUME_MEDIA, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,241,214,10 END IDD_SETTINGS_WIFI DIALOGEX 0, 0, 242, 216 @@ -274,9 +279,9 @@ BEGIN IDD_SETTINGS, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 262 + RIGHTMARGIN, 268 TOPMARGIN, 7 - BOTTOMMARGIN, 260 + BOTTOMMARGIN, 307 END IDD_SETTINGS_GENERAL, DIALOG @@ -314,9 +319,9 @@ BEGIN IDD_SETTINGS_MUTE, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 235 + RIGHTMARGIN, 246 TOPMARGIN, 7 - BOTTOMMARGIN, 213 + BOTTOMMARGIN, 254 END IDD_SETTINGS_WIFI, DIALOG diff --git a/WinMute/WinMute.vcxproj b/WinMute/WinMute.vcxproj index af00a68..e80b0a1 100644 --- a/WinMute/WinMute.vcxproj +++ b/WinMute/WinMute.vcxproj @@ -121,7 +121,7 @@ Windows true - Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) + mincore.lib;windowsapp.lib;Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) PerMonitorHighDPIAware @@ -151,7 +151,7 @@ true true true - Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) + mincore.lib;windowsapp.lib;Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) UseLinkTimeCodeGeneration true @@ -175,7 +175,7 @@ Windows true - Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) + mincore.lib;windowsapp.lib;Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) PerMonitorHighDPIAware @@ -205,7 +205,7 @@ true true true - Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) + mincore.lib;windowsapp.lib;Winhttp.lib;Bthprops.lib;Winmm.lib;UxTheme.lib;Wlanapi.lib;comctl32.lib;WtsApi32.lib;Version.lib;%(AdditionalDependencies) UseLinkTimeCodeGeneration true @@ -217,6 +217,7 @@ + @@ -251,6 +252,7 @@ Create + diff --git a/WinMute/common.h b/WinMute/common.h index f2e175f..28caf5d 100644 --- a/WinMute/common.h +++ b/WinMute/common.h @@ -99,6 +99,7 @@ namespace fs = std::filesystem; #include #include #include +#include #pragma warning(disable : 4201) # include #pragma warning(default : 4201) @@ -113,6 +114,7 @@ namespace fs = std::filesystem; #include "UpdateChecker.h" #include "TrayIcon.h" #include "WinAudio.h" +#include "MediaController.h" #include "MuteControl.h" #include "WiFiDetector.h" #include "BluetoothDetector.h" diff --git a/WinMute/resource.h b/WinMute/resource.h index c085542..94cf5dd 100644 --- a/WinMute/resource.h +++ b/WinMute/resource.h @@ -71,7 +71,10 @@ #define IDC_WIFI_REMOVEALL 1027 #define IDC_CHECK2 1028 #define IDC_IS_PERMITLIST 1028 +#define IDC_MUTE_TRY_PAUSE_MEDIA 1028 #define IDC_STATIC_WLAN_NOT_AVAILABLE 1029 +#define IDC_MUTE_RESUME_MEDIA 1029 +#define IDC_MUTE_TRY_RESUME_MEDIA 1029 #define IDC_STATIC_BLUETOOTH_NOT_AVAILABLE 1030 #define IDC_BLUETOOTH_ADD 1031 #define IDC_BLUETOOTH_EDIT 1032 @@ -102,6 +105,7 @@ #define IDC_GROUP_MUTE_WITHOUT_RESTORE 1057 #define IDC_DELAY_MUTING_LABEL 1058 #define IDC_QUIET_HOURS_DESCRIPTION 1059 +#define IDC_GROUP_MUTE_MEDIA_CONTROL 1059 #define IDC_QUIET_HOURS_START_LABEL 1060 #define IDC_QUIET_HOURS_END_LABEL 1061 #define IDC_QUIET_HOURS_FORCE_UNMUTE_DESCRIPTION 1062 @@ -166,7 +170,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 144 #define _APS_NEXT_COMMAND_VALUE 40042 -#define _APS_NEXT_CONTROL_VALUE 1076 +#define _APS_NEXT_CONTROL_VALUE 1077 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- 2.43.0