Changes between Version 2 and Version 3 of SwimmersGame


Ignore:
Timestamp:
03/24/11 09:42:24 (9 years ago)
Author:
masc01
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SwimmersGame

    v2 v3  
    2020 5   public PositionComputer() throws JMSException { 
    2121 6     super("PositionComputer"); 
    22  7     receivers.add(new EmmaReceiver("semaine.data.state.user.emma")); 
     22 7     receivers.add( 
     23          new EmmaReceiver("semaine.data.state.user.emma.emotion.voice")); 
    2324 8     senders.add(positionSender); 
    2425 9   } 
    252610  
    26 11   @Override protected void react(SEMAINEMessage m) throws MessageFormatException { 
     2711   @Override protected void react(SEMAINEMessage m) 
     28                 throws MessageFormatException { 
    272912     SEMAINEEmmaMessage emmaMessage = (SEMAINEEmmaMessage) m; 
    283013     Element interpretation = emmaMessage.getTopLevelInterpretation(); 
    29 14     List<Element> emotionElements = emmaMessage.getEmotionElements(interpretation); 
     3114     if (interpretation == null) return; 
     3214     List<Element> emotionElements = 
     33                 emmaMessage.getEmotionElements(interpretation); 
    303415  
    313516     for (Element emotion : emotionElements) { 
    32 17       Element dimensions = XMLTool.getChildElementByTagNameNS(emotion, EmotionML.E_DIMENSIONS, 
    33                                  EmotionML.namespaceURI); 
    34 18       if (dimensions != null) { 
    35 19         Element arousal = XMLTool.needChildElementByTagNameNS(dimensions, EmotionML.E_AROUSAL,  
    36                                  EmotionML.namespaceURI); 
    37 20         float arousalValue = Float.parseFloat(arousal.getAttribute(EmotionML.A_VALUE)); 
    38 21         // Arousal influences the swimmer's position: 
    39 22         position += 10*arousalValue; 
    40 23       } 
    41 24     } 
    42 25   } 
    43 26  
    44 27   @Override protected void act() throws JMSException { 
    45 28     // The river slowly pulls back the swimmer: 
    46 29     position -= 0.1; 
    47 30     positionSender.sendTextMessage(String.valueOf(position), meta.getTime()); 
    48 31   } 
    49 32 } 
     3617       List<Element> dimensions = XMLTool.getChildrenByLocalNameNS( 
     37                 emotion, EmotionML.E_DIMENSION, EmotionML.namespaceURI); 
     3818       for (Element dim : dimensions) { 
     3919         if (dim.getAttribute(EmotionML.A_NAME).equals( 
     40                 EmotionML.VOC_FSRE_DIMENSION_AROUSAL)) { 
     4120           float arousalValue = Float.parseFloat( 
     42                 dim.getAttribute(EmotionML.A_VALUE)); 
     4321           // Arousal influences the swimmer's position: 
     4422           position += 10*(arousalValue-0.4f); 
     4523           break; 
     4624         } 
     4725       } 
     4826     } 
     4927   } 
     5028  
     5129   @Override protected void act() throws JMSException { 
     5230     // The river slowly pulls back the swimmer: 
     5331     position -= 0.1; 
     5432     positionSender.sendTextMessage(String.valueOf(position), 
     55                                      meta.getTime()); 
     5633   } 
     5734 } 
    5058}}} 
    5159 
     
    111119The complete system consists of the Java components !SystemManager, !PositionComputer, !SwimmerDisplay, Commentator, SpeechBMLRealiser and !SemaineAudioPlayer, as well as the external C++ component openSMILE. The resulting message flow graph is shown in the following figure. 
    112120 
    113 [[Image(swimmers-game-flowgraph.png)]] 
     121[[Image(message-flow-graph-swimmer.png)]] 
    114122 
    115123,,''Back to [wiki:BuildingSystems Building emotion-oriented systems]'',,