Fix two errors for calculating bitrate and duration of sound.
In AudioSinkUtilsImpl : confusion between byte / bite
In AudioWaveUtils : confusion between byte / bite AND with the defintion of framesize (framesize already includes channels number)
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* Replace Markdown backticks with JavaDoc code tags
The proper way to format code with JavaDoc is using code tags and not Markdown backticks.
Signed-off-by: Wouter Born <github@maindrain.net>
Removes redundant modifiers from the code.
These modifiers redeclare the default modifiers that apply to interfaces, enums etc.
Signed-off-by: Wouter Born <github@maindrain.net>
While cleaning up the code I found a some more code to cleanup:
* Remove unnecessary boxing
* Use `contains(..)` instead of `indexOf(..) != -1`
* Use `assertInstanceOf` in tests
* Make expensive trace logging conditional
* Remove redundant constructor
* Replace `collect(Collectors.toUnmodifiableList())` with `toList()`
* Replace `filter(..).count() == 0L` with `noneMatch(..)`
* Replace `filter(..).count() > 0` with `anyMatch(..)`
Signed-off-by: Wouter Born <github@maindrain.net>
Method references are more readable because they refer to class names and usually result in less code.
Signed-off-by: Wouter Born <github@maindrain.net>
Simplifies the code by using List.of, List.copyOf etc. where possible which results in less code and imports.
Signed-off-by: Wouter Born <github@maindrain.net>
Stream.toList was introduced in Java 16 and creates an unmodifiable List so it can be used to simplify code whenever the List is not expected to be modified.
Signed-off-by: Wouter Born <github@maindrain.net>
Instead of 5s before.
It helps triggering the end of playback earlier for audio sinks in asynchronous mode.
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Allows the use of a Sizeable interface (for AudioStream that we know the length of, but we cannot clone). We can then improve the duration detection, for example for the pulseaudio sink (PR coming after).
We can also give the length information to sink in more cases.
Add the support of the mark / reset methods to some common AudioStream. We then allow more stream analysis for sink requiring it (Stream analysis often requires to get back in time after consuming a few bytes)
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* [audio] More capabilities for AudioSink using the AudioServlet
AudioServlet can now serve all type of AudioStream multiple times by buffering data in memory or in temporary file.
Adding method to ease disposal of temporary file after playing a sound
Adding an identifyier to audio stream for further development (allow audio sink to cache computation data)
We can now send audio with a Runnable for a delayed task to be executed after. This delayed task includes temporary file deletion and volume restoration.
This is a no breaking change / no behaviour modification for other addon AudioSink, as existing AudioSink must explicitly override the old behaviour to use this capability.
Add AudioSinkSync / AudioSinkAsync abstract classes to use this capability easily.
WebAudioSink now implements this capability, with the help of a modified AudioServlet
Adding (approximative, better than nothing) sound duration computation method for MP3 and WAV.
Use this sound duration computation to guess when the async sound is finished and when to do the post process (i.e. volume restoration)
Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
* New translations audio.properties (Romanian)
* New translations addons.properties (Romanian)
* New translations i18n.properties (Romanian)
* New translations network.properties (Romanian)
* New translations marketplace.properties (Romanian)
* New translations validation.properties (Finnish)
* New translations scriptprofile.properties (French)
* New translations scriptprofile.properties (Slovenian)
* New translations validation.properties (Hebrew)
* New translations validation.properties (Polish)
* New translations validation.properties (Slovenian)
* New translations hli.properties (French)
* New translations hli.properties (Polish)
* New translations automation.properties (Hebrew)
* New translations automation.properties (Polish)
* Sync runtime dependencies with Karaf 4.4.3, most notably:
* Jetty 9.4.50.v20221201
* Pax Logging 2.2.0
* Pax Web 8.0.15
* Use OSGi R8 as compile dependency
* Rework Servlets to use Http Whiteboard annotations in favor of proprietary `org.openhab.core.io.http.servlet` classes
* Resolve itest runbundles
Also-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Wouter Born <github@maindrain.net>
* [voice] Add notification sounds to dialog processor
* [audio] add actions and commands to play melodies
Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>