* [pulseaudio] Removing isIdle test
The isIdle boolean was not properly handled.
When disconnection is called, isIdle is not relevant : we should always honnor the disconnection request.
In fact, isIdle prevented disconnection when it is necessary (example : when a IOException occurs when sending audio to sink)
+Little bug fix on volume parsing: some volume request doesn't respond with a space after the comma separating left/right channel.
* [pulseaudio] Enhancement to the idle detection for disconnection
Using a counter to count client instead of a isIdle variable, which was not thread safe.
The PulseaudioSimpleProtocolStream parent class is now the sole responsible for closing source or sink stream.
* [pulseaudio] Small performance enhancement
Avoid a costly synchronized operation for a method called very often.
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* [pulseaudio] Allow flexible parameters to find a given pulseaudio device
To identify the device on the pulseaudio server, you can now use the description instead of the technical id (a.k.a. "name").
To filter furthermore, you can also use the parameter additionalFilters (optional regular expressions that need to match a property value of a device on the pulseaudio server)
Closes#12555
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* [pulseaudio] small fixes and rewrite
- All classes are now @NonNullByDefault
- all build warnings cleared
- no more need for a watchdog scheduled thread for every pulseaudio device : the bridge now handles sending information to child
- fix bug : exception at startup when child handler try to get information from the bridge too soon is now handled by waiting 2 seconds if necessary
- fix bug : playing MP3 with high bitrate is now OK with the replacement of the ResetableInputStream by a standard BufferedInputStream that handle mark/reset method better
- fix bug : ghost device listener no longer receive event after dispose
- fix bug : discovery doesn't show already added thing anymore
- Updating the status bridge to ONLINE only AFTER the update method is done.
- Use the bridgeStatusChanged method in the childhandler to get opportunity to test if the child could go ONLINE, (and by the way initialize the audiosink and audiosource, has they also need information from the bridge)
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
Co-authored-by: Laurent Garnier <lg.hc@free.fr>
* [pulseaudio] use thread safe collection
* [pulseaudio] source: connect pipe before store ref
* [pulseaudio] source: improve warning messages
* [pulseaudio] fix IOException when closing all sources
* [pulseaudio] prevent warning when InterruptedIOException on source close
Signed-off-by: Miguel Álvarez Díez <miguelwork92@gmail.com>
* Add default translations for binding add-ons
This makes the texts used by these add-ons translatable with Crowdin.
To keep the PR simple, it only adds default translations for add-ons which do not yet have any default translations properties file.
We can do follow up PRs for adding missing key/values to add-ons that already have these files or to remove duplications.
There are several add-ons in this PR that do have non-English translation files, so I'll upload those to Crowdin when the PR is merged.
Signed-off-by: Wouter Born <github@maindrain.net>
Add a pass to reencode PCM sound in 16 bit, 44100 hz, 2 channels, before sending it to the pulseaudio audio sink.
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
Co-authored-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* [pulseaudio] Fix sink-input configuration and other small improvements (#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#11272
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* Small fixes after proofreading
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
Co-authored-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
Fixes#11170 by introducing an intelligent thread.sleep (getting the duration of the sound, if possible, then wait the appropriate time for letting the sound play). By the way, the method to get the sound duration is not as easy as I thought.
Also fix a minor issue with the last volume not propertly saved.
And fix some minor warnings by using final local variable.
Signed-off-by: Gwendal ROULLEAU <gwendal.roulleau@gmail.com>
* [pulseaudio] Add pulseaudio sink as openhab audio sink (#1895)
This add to the pulseaudio binding the capability to use "pulseaudio sink" as an "openhab sink" to output sound from openhab to a pulse audio server on the network.
You need to load module-simple-protocol-tcp sink in addition to the usual module-cli-protocol-tcp, and enable the sink in the thing configuration.
Closes#1895
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* Small corrections after review
And getting rid of some other compilation warnings
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* Fix some registration errors and allow the binding to load the simple module remotely
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* Small corrections after reviews
initialize audiosink in a thread with scheduler.submit
clear some warning related code.
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
Better interruptexception handling
* Fix two small concurrency bugs
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
Co-authored-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* Reworks many commons-lang usages to use standard Java
* Updates all remaining commons.lang imports to commons.lang3
Related to openhab/openhab-addons#7722
Signed-off-by: Wouter Born <github@maindrain.net>