use of org.eclipse.smarthome.core.audio.AudioSource in project smarthome by eclipse.
the class AudioManagerImpl method getParameterOptions.
@Override
public Collection<ParameterOption> getParameterOptions(URI uri, String param, Locale locale) {
if (uri.toString().equals(CONFIG_URI)) {
if (CONFIG_DEFAULT_SOURCE.equals(param)) {
List<ParameterOption> options = new ArrayList<>();
for (AudioSource source : audioSources.values()) {
ParameterOption option = new ParameterOption(source.getId(), source.getLabel(locale));
options.add(option);
}
return options;
} else if (CONFIG_DEFAULT_SINK.equals(param)) {
List<ParameterOption> options = new ArrayList<>();
for (AudioSink sink : audioSinks.values()) {
ParameterOption option = new ParameterOption(sink.getId(), sink.getLabel(locale));
options.add(option);
}
return options;
}
}
return null;
}
use of org.eclipse.smarthome.core.audio.AudioSource in project smarthome by eclipse.
the class VoiceManagerImpl method startDialog.
@Override
public void startDialog(KSService ksService, STTService sttService, TTSService ttsService, HumanLanguageInterpreter interpreter, AudioSource audioSource, AudioSink audioSink, Locale locale, String keyword, String listeningItem) {
// use defaults, if null
KSService ks = (ksService == null) ? getKS() : ksService;
STTService stt = (sttService == null) ? getSTT() : sttService;
TTSService tts = (ttsService == null) ? getTTS() : ttsService;
HumanLanguageInterpreter hli = (interpreter == null) ? getHLI() : interpreter;
AudioSource source = (audioSource == null) ? audioManager.getSource() : audioSource;
AudioSink sink = (audioSink == null) ? audioManager.getSink() : audioSink;
Locale loc = (locale == null) ? localeProvider.getLocale() : locale;
String kw = (keyword == null) ? this.keyword : keyword;
String item = (listeningItem == null) ? this.listeningItem : listeningItem;
if (ks != null && stt != null && tts != null && hli != null && source != null && sink != null && loc != null && kw != null) {
DialogProcessor processor = new DialogProcessor(ks, stt, tts, hli, source, sink, loc, kw, item, this.eventPublisher);
processor.start();
} else {
String msg = "Cannot start dialog as services are missing.";
logger.error(msg);
throw new IllegalStateException(msg);
}
}
Aggregations