This repository has been archived by the owner on May 7, 2020. It is now read-only.
[audio] Added getSupportedStreams() and UnsupportedAudioStreamException #3764
Merged
kaikreuzer
merged 5 commits into
eclipse-archived:master
from
cweitkamp:feature-3566-audio-stream-exception
Jun 30, 2017
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7870952
Added getSupportedStreams() and UnsupportedAudioStreamException
cweitkamp 322ff11
Added example for getSupportedStreams() and getSupportedFormats()
cweitkamp 2ec1516
Applied AudioSink changes to Voice bundle
cweitkamp c2ba048
Applied changes to binding.sonos, io.javasound and io.webaudio
cweitkamp 85e7ab3
Addressed comments from review
cweitkamp File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
57 changes: 57 additions & 0 deletions
57
...audio/src/main/java/org/eclipse/smarthome/core/audio/UnsupportedAudioStreamException.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,57 @@ | ||
/** | ||
* Copyright (c) 2014-2017 by the respective copyright holders. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.eclipse.smarthome.core.audio; | ||
|
||
/** | ||
* Thrown when a requested {@link AudioStream} is not supported by an {@link AudioSource} or {@link AudioSink} | ||
* implementation | ||
* | ||
* @author Christoph Weitkamp - Initial contribution and API | ||
* | ||
*/ | ||
public class UnsupportedAudioStreamException extends AudioException { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
/** | ||
* Unsupported {@link AudioStream} | ||
*/ | ||
private Class<? extends AudioStream> unsupportedAudioStreamClass; | ||
|
||
/** | ||
* Constructs a new exception with the specified detail message, unsupported format, and cause. | ||
* | ||
* @param message The message | ||
* @param unsupportedAudioStreamClass The unsupported audio stream class | ||
* @param cause The cause | ||
*/ | ||
public UnsupportedAudioStreamException(String message, Class<? extends AudioStream> unsupportedAudioStreamClass, | ||
Throwable cause) { | ||
super(message, cause); | ||
this.unsupportedAudioStreamClass = unsupportedAudioStreamClass; | ||
} | ||
|
||
/** | ||
* Constructs a new exception with the specified detail message and unsupported format. | ||
* | ||
* @param message The message | ||
* @param unsupportedAudioStreamClass The unsupported audio stream class | ||
*/ | ||
public UnsupportedAudioStreamException(String message, Class<? extends AudioStream> unsupportedAudioStreamClass) { | ||
this(message, unsupportedAudioStreamClass, null); | ||
} | ||
|
||
/** | ||
* Gets the unsupported audio stream class. | ||
* | ||
* @return The unsupported audio stream class | ||
*/ | ||
public Class<? extends AudioStream> getUnsupportedAudioStreamClass() { | ||
return unsupportedAudioStreamClass; | ||
} | ||
} |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change this? This potentially returns you the default tts instead of the one specified in
segments[0]
, so it unnecessarily complicates things here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it for readability and to prevent NPE (in case of
segment[0]
contains a not suitable value). Have a look at https://github.com/eclipse/smarthome/pull/3764/files#diff-2bdbf6176fb6bd9b1af9a6cb230b6293R472. ThegetTTS(String)
method returns exaclty the same like before (ttsServices.get(id)
).