forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pulseaudio] Fix sink-input configuration and other (openhab#11272) (o…
…penhab#11276) * [pulseaudio] Fix sink-input configuration and other small improvements (openhab#11272) The binding requires a parameter to activate the parsing of sink-input entries on the pulseaudio server. This patch : - document this behaviour - fix the parsing of these parameters if a configuration file is used (the old method of casting launched a class cast exception) Other small improvements : - Force a refresh/new parsing when the configuration changes - Fix scheduled disconnection : if a sound is played during the grace period, the scheduled disconnection is postponed, not added to the last - add a possibility to never disconnect the audio sink (in order to have a lower latency when playing sound) Closes openhab#11272 Signed-off-by: Gwendal Roulleau <[email protected]> * Small fixes after proofreading Signed-off-by: Gwendal Roulleau <[email protected]> Co-authored-by: Gwendal Roulleau <[email protected]>
- Loading branch information
Showing
10 changed files
with
165 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...src/main/java/org/openhab/binding/pulseaudio/internal/PulseAudioBindingConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Copyright (c) 2010-2021 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.pulseaudio.internal; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* Contains the binding configuration | ||
* | ||
* @author Gwendal Roulleau - Initial contribution | ||
* | ||
*/ | ||
@NonNullByDefault | ||
public class PulseAudioBindingConfiguration { | ||
|
||
public boolean sink = true; | ||
|
||
public boolean source = false; | ||
|
||
public boolean sinkInput = false; | ||
|
||
public boolean sourceOutput = false; | ||
|
||
private Set<PulseAudioBindingConfigurationListener> listeners = new HashSet<>(); | ||
|
||
public void addPulseAudioBindingConfigurationListener(PulseAudioBindingConfigurationListener listener) { | ||
listeners.add(listener); | ||
} | ||
|
||
public void removePulseAudioBindingConfigurationListener(PulseAudioBindingConfigurationListener listener) { | ||
listeners.remove(listener); | ||
} | ||
|
||
public void update(PulseAudioBindingConfiguration newConfiguration) { | ||
sink = newConfiguration.sink; | ||
source = newConfiguration.source; | ||
sinkInput = newConfiguration.sinkInput; | ||
sourceOutput = newConfiguration.sourceOutput; | ||
|
||
listeners.forEach(PulseAudioBindingConfigurationListener::bindingConfigurationChanged); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
.../java/org/openhab/binding/pulseaudio/internal/PulseAudioBindingConfigurationListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright (c) 2010-2021 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.pulseaudio.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* Interface for listening to configuration change | ||
* | ||
* @author Gwendal Roulleau - Initial contribution | ||
* | ||
*/ | ||
@NonNullByDefault | ||
public interface PulseAudioBindingConfigurationListener { | ||
|
||
public void bindingConfigurationChanged(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.