-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[voicerss] Add support for WAV audio format (#11916)
* [voicerss] add unit test for supported formats * [voicerss] add support for WAV audio format Signed-off-by: Andreas Brenk <mail@andreasbrenk.com>
- Loading branch information
Showing
7 changed files
with
263 additions
and
71 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
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
52 changes: 52 additions & 0 deletions
52
...cerss/src/test/java/org/openhab/voice/voicerss/internal/CompatibleAudioFormatMatcher.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,52 @@ | ||
/** | ||
* Copyright (c) 2010-2022 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.voice.voicerss.internal; | ||
|
||
import org.hamcrest.Description; | ||
import org.hamcrest.Matcher; | ||
import org.hamcrest.TypeSafeMatcher; | ||
import org.openhab.core.audio.AudioFormat; | ||
|
||
/** | ||
* Hamcrest {@link Matcher} to assert a compatible {@link AudioFormat}. | ||
* | ||
* @author Andreas Brenk - Initial contribution | ||
*/ | ||
public class CompatibleAudioFormatMatcher extends TypeSafeMatcher<AudioFormat> { | ||
|
||
private final AudioFormat audioFormat; | ||
|
||
public CompatibleAudioFormatMatcher(AudioFormat audioFormat) { | ||
this.audioFormat = audioFormat; | ||
} | ||
|
||
@Override | ||
protected boolean matchesSafely(AudioFormat actual) { | ||
return audioFormat.isCompatible(actual); | ||
} | ||
|
||
@Override | ||
public void describeTo(Description description) { | ||
description.appendText("an audio format compatible to ").appendValue(audioFormat); | ||
} | ||
|
||
/** | ||
* Creates a matcher that matches when the examined object is | ||
* compatible to the specified <code>audioFormat</code>. | ||
* | ||
* @param audioFormat the audio format which must be compatible | ||
*/ | ||
public static Matcher<AudioFormat> compatibleAudioFormat(AudioFormat audioFormat) { | ||
return new CompatibleAudioFormatMatcher(audioFormat); | ||
} | ||
} |
Oops, something went wrong.