diff --git a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioManagerImpl.java b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioManagerImpl.java index d8e794849..a32d883e8 100644 --- a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioManagerImpl.java +++ b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioManagerImpl.java @@ -123,17 +123,18 @@ public class AudioManagerImpl implements AudioManager, ConfigOptionProvider { AudioSink sink = getSink(sinkId); if (sink != null) { PercentType oldVolume = null; - try { - // get current volume - oldVolume = getVolume(sinkId); - } catch (IOException e) { - logger.debug("An exception occurred while getting the volume of sink '{}' : {}", sink.getId(), - e.getMessage(), e); - } // set notification sound volume if (volume != null) { try { - setVolume(volume, sinkId); + // get current volume + oldVolume = sink.getVolume(); + } catch (IOException e) { + logger.debug("An exception occurred while getting the volume of sink '{}' : {}", sink.getId(), + e.getMessage(), e); + } + + try { + sink.setVolume(volume); } catch (IOException e) { logger.debug("An exception occurred while setting the volume of sink '{}' : {}", sink.getId(), e.getMessage(), e); @@ -147,7 +148,7 @@ public class AudioManagerImpl implements AudioManager, ConfigOptionProvider { if (volume != null && oldVolume != null) { // restore volume only if it was set before try { - setVolume(oldVolume, sinkId); + sink.setVolume(oldVolume); } catch (IOException e) { logger.debug("An exception occurred while setting the volume of sink '{}' : {}", sink.getId(), e.getMessage(), e); diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceManagerImpl.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceManagerImpl.java index 81aef2516..90e98f484 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceManagerImpl.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceManagerImpl.java @@ -255,17 +255,18 @@ public class VoiceManagerImpl implements VoiceManager, ConfigOptionProvider, Dia } PercentType oldVolume = null; - try { - // get current volume - oldVolume = audioManager.getVolume(sinkId); - } catch (IOException e) { - logger.debug("An exception occurred while getting the volume of sink '{}' : {}", sink.getId(), - e.getMessage(), e); - } // set notification sound volume if (volume != null) { try { - audioManager.setVolume(volume, sinkId); + // get current volume + oldVolume = sink.getVolume(); + } catch (IOException e) { + logger.debug("An exception occurred while getting the volume of sink '{}' : {}", sink.getId(), + e.getMessage(), e); + } + + try { + sink.setVolume(volume); } catch (IOException e) { logger.debug("An exception occurred while setting the volume of sink '{}' : {}", sink.getId(), e.getMessage(), e); @@ -277,7 +278,7 @@ public class VoiceManagerImpl implements VoiceManager, ConfigOptionProvider, Dia if (volume != null && oldVolume != null) { // restore volume only if it was set before try { - audioManager.setVolume(oldVolume, sinkId); + sink.setVolume(oldVolume); } catch (IOException e) { logger.debug("An exception occurred while setting the volume of sink '{}' : {}", sink.getId(), e.getMessage(), e);