Revision 36c5f031
| client/java/src/main/java/de/cit_ec/opensource/hlrc/client/MiddlewareRSB.java | ||
|---|---|---|
| 5 | 5 |
*/ |
| 6 | 6 |
package de.cit_ec.opensource.hlrc.client; |
| 7 | 7 |
|
| 8 |
import com.google.protobuf.ByteString; |
|
| 8 | 9 |
import java.util.ArrayList; |
| 9 | 10 |
import java.util.HashMap; |
| 10 | 11 |
import java.util.Map; |
| ... | ... | |
| 12 | 13 |
import java.util.concurrent.TimeoutException; |
| 13 | 14 |
import java.util.logging.Level; |
| 14 | 15 |
import java.util.logging.Logger; |
| 15 |
|
|
| 16 | 16 |
import javax.sound.sampled.AudioFormat; |
| 17 | 17 |
import javax.sound.sampled.AudioFormat.Encoding; |
| 18 |
|
|
| 18 |
import rsb.Factory; |
|
| 19 |
import rsb.Informer; |
|
| 19 | 20 |
import rsb.RSBException; |
| 20 | 21 |
import rsb.converter.DefaultConverterRepository; |
| 21 | 22 |
import rsb.converter.ProtocolBufferConverter; |
| 22 | 23 |
import rsb.patterns.RemoteServer; |
| 23 |
|
|
| 24 |
import rst.audition.SoundChunkType.SoundChunk; |
|
| 25 |
import rst.audition.UtteranceType.Utterance; |
|
| 26 |
import rst.animation.HeadAnimationType.HeadAnimation; |
|
| 27 |
import rst.animation.EmotionExpressionType.EmotionExpression; |
|
| 28 | 24 |
import rst.animation.BinocularHeadGazeType.BinocularHeadGaze; |
| 29 |
|
|
| 30 |
import com.google.protobuf.ByteString; |
|
| 31 |
|
|
| 32 |
// Create _abstract_ middleware class and function _interface_ for |
|
| 33 |
// future integration of additional Middleware implementations... |
|
| 34 |
import rsb.Factory; |
|
| 35 |
import rsb.Informer; |
|
| 25 |
import rst.animation.EmotionExpressionType.EmotionExpression; |
|
| 36 | 26 |
import rst.animation.EmotionExpressionType.EmotionExpression.Emotion; |
| 27 |
import rst.animation.HeadAnimationType.HeadAnimation; |
|
| 37 | 28 |
import rst.animation.HeadAnimationType.HeadAnimation.Animation; |
| 38 | 29 |
import rst.audition.PhonemeCollectionType.PhonemeCollection; |
| 39 | 30 |
import rst.audition.PhonemeType.Phoneme; |
| 31 |
import rst.audition.SoundChunkType.SoundChunk; |
|
| 32 |
import rst.audition.UtteranceType.Utterance; |
|
| 40 | 33 |
import rst.geometry.SphericalDirectionFloatType.SphericalDirectionFloat; |
| 41 | 34 |
|
| 42 | 35 |
public class MiddlewareRSB {
|
| ... | ... | |
| 243 | 236 |
public EmotionExpression createDefaultEmotionMessage(Emotions emo) {
|
| 244 | 237 |
EmotionExpression.Builder es = EmotionExpression.newBuilder(); |
| 245 | 238 |
es.setEmotion(emo_map.get(emo)); |
| 239 |
es.setDuration(0); |
|
| 246 | 240 |
return es.build(); |
| 247 | 241 |
} |
| 248 | 242 |
|
| ... | ... | |
| 288 | 282 |
public void setEmotion(Emotions emo, int duration, boolean blocking) throws ExecutionException, TimeoutException {
|
| 289 | 283 |
try {
|
| 290 | 284 |
if (blocking) {
|
| 291 |
server.call("emotion", createEmotionMessage(emo, duration));
|
|
| 285 |
server.call("currentEmotion", createEmotionMessage(emo, duration));
|
|
| 292 | 286 |
// System.out.println("Server replied: " + server.call("emotion", createEmotionMessage(emo, duration)));
|
| 293 | 287 |
} else {
|
| 294 |
server.callAsync("emotion", createEmotionMessage(emo, duration));
|
|
| 288 |
server.callAsync("currentEmotion", createEmotionMessage(emo, duration));
|
|
| 295 | 289 |
// System.out.println("Set Emotion non-blocking, not wating for reply");
|
| 296 | 290 |
} |
| 297 | 291 |
|
Also available in: Unified diff