Revision f150aab5 server/include/Arbiter.h

View differences:

server/include/Arbiter.h
1 1
/*
2
* This file is part of hlrc_server
3
*
4
* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
5
* http://opensource.cit-ec.de/projects/hlrc_server
6
*
7
* This file may be licensed under the terms of the
8
* GNU General Public License Version 3 (the ``GPL''),
9
* or (at your option) any later version.
10
*
11
* Software distributed under the License is distributed
12
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
13
* express or implied. See the GPL for the specific language
14
* governing rights and limitations.
15
*
16
* You should have received a copy of the GPL along with this
17
* program. If not, go to http://www.gnu.org/licenses/gpl.html
18
* or write to the Free Software Foundation, Inc.,
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
*
21
* The development of this software was supported by the
22
* Excellence Cluster EXC 277 Cognitive Interaction Technology.
23
* The Excellence Cluster EXC 277 is a grant of the Deutsche
24
* Forschungsgemeinschaft (DFG) in the context of the German
25
* Excellence Initiative.
26
*
27
*/
2
 * This file is part of hlrc_server
3
 *
4
 * Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
5
 * http://opensource.cit-ec.de/projects/hlrc_server
6
 *
7
 * This file may be licensed under the terms of the
8
 * GNU General Public License Version 3 (the ``GPL''),
9
 * or (at your option) any later version.
10
 *
11
 * Software distributed under the License is distributed
12
 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
13
 * express or implied. See the GPL for the specific language
14
 * governing rights and limitations.
15
 *
16
 * You should have received a copy of the GPL along with this
17
 * program. If not, go to http://www.gnu.org/licenses/gpl.html
18
 * or write to the Free Software Foundation, Inc.,
19
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
 *
21
 * The development of this software was supported by the
22
 * Excellence Cluster EXC 277 Cognitive Interaction Technology.
23
 * The Excellence Cluster EXC 277 is a grant of the Deutsche
24
 * Forschungsgemeinschaft (DFG) in the context of the German
25
 * Excellence Initiative.
26
 *
27
 */
28 28

  
29 29
#pragma once
30 30
#include <string>
......
38 38
#include <boost/shared_ptr.hpp>
39 39
#include <vector>
40 40

  
41
class Arbiter{
41
class Arbiter {
42 42
public:
43
    Arbiter(std::string audio_output);
44
    ~Arbiter();
43
	Arbiter(std::string audio_output);
44
	~Arbiter();
45 45

  
46
    void arbitrate();
46
	void arbitrate();
47 47

  
48
    void set_default_emotion(EmotionState e);
49
    void set_current_emotion(EmotionState e);
50
    void set_mouth_config(MouthConfig m);
51
    void speak(boost::shared_ptr<Utterance> u);
52
    bool speak_active();
48
	void set_default_emotion(EmotionState e);
49
	void set_current_emotion(EmotionState e);
50
	void set_mouth_config(MouthConfig m);
51
	void speak(boost::shared_ptr<Utterance> u);
52
	bool speak_active();
53 53

  
54
    void set_gaze_target(humotion::GazeState g);
55
    void set_mouth_target(humotion::MouthState target);
56
    void play_animation(boost::shared_ptr<Animation> ani);
54
	void set_gaze_target(humotion::GazeState g);
55
	void set_mouth_target(humotion::MouthState target);
56
	void play_animation(boost::shared_ptr<Animation> ani);
57 57

  
58
    humotion::GazeState  get_gaze_state();
59
    humotion::MouthState get_mouth_state();
58
	humotion::GazeState get_gaze_state();
59
	humotion::MouthState get_mouth_state();
60 60

  
61 61
private:
62
    void override_by_emotion();
63
    void override_by_gaze();
64
    void override_by_animation();
65
    void override_by_utterance();
66
    void override_by_mouth();
62
	void override_by_emotion();
63
	void override_by_gaze();
64
	void override_by_animation();
65
	void override_by_utterance();
66
	void override_by_mouth();
67 67

  
68
    humotion::GazeState soft_overblend_gaze(humotion::GazeState gaze_now,
69
                                            humotion::GazeState gaze_target,
70
                                            unsigned int overblend_time);
68
	humotion::GazeState soft_overblend_gaze(humotion::GazeState gaze_now, humotion::GazeState gaze_target,
69
	                                        unsigned int overblend_time);
71 70

  
72
    EmotionConfig emotion_config_current;
73
    EmotionConfig emotion_config_default;
71
	EmotionConfig emotion_config_current;
72
	EmotionConfig emotion_config_default;
74 73

  
75
    humotion::MouthState mouth_state;
76
    humotion::GazeState gaze_state;
74
	humotion::MouthState mouth_state;
75
	humotion::GazeState gaze_state;
77 76

  
77
	boost::posix_time::ptime gaze_state_end_time;
78
	humotion::GazeState gaze_state_old;
79
	bool gaze_state_animation_restart;
78 80

  
79
    boost::posix_time::ptime gaze_state_end_time;
80
    humotion::GazeState gaze_state_old;
81
    bool gaze_state_animation_restart;
81
	EmotionConfig* emotion_target;
82 82

  
83
    EmotionConfig *emotion_target;
83
	MouthConfig mouth_config;
84 84

  
85
    MouthConfig mouth_config;
85
	boost::shared_ptr<Utterance> utterance;
86 86

  
87
    boost::shared_ptr<Utterance> utterance;
87
	humotion::GazeState requested_gaze_state;
88
	humotion::MouthState requested_mouth_state;
88 89

  
89
    humotion::GazeState requested_gaze_state;
90
    humotion::MouthState requested_mouth_state;
90
	boost::mutex emotion_config_default_mutex;
91
	boost::mutex emotion_config_current_mutex;
92
	boost::mutex mouth_config_override_mutex;
93
	boost::mutex utterance_mutex;
94
	boost::mutex requested_gaze_state_mutex;
95
	boost::mutex requested_mouth_state_mutex;
96
	boost::mutex audio_player_mutex;
91 97

  
98
	boost::mutex animation_mutex;
99
	Animation active_animation;
92 100

  
93
    boost::mutex emotion_config_default_mutex;
94
    boost::mutex emotion_config_current_mutex;
95
    boost::mutex mouth_config_override_mutex;
96
    boost::mutex utterance_mutex;
97
    boost::mutex requested_gaze_state_mutex;
98
    boost::mutex requested_mouth_state_mutex;
99
    boost::mutex audio_player_mutex;
101
	typedef std::vector<boost::shared_ptr<Animation>> active_animation_vector_t;
102
	boost::mutex active_animation_vector_mutex;
103
	active_animation_vector_t active_animation_vector;
100 104

  
101
    boost::mutex animation_mutex;
102
    Animation active_animation;
103

  
104
    typedef std::vector<boost::shared_ptr<Animation>> active_animation_vector_t;
105
    boost::mutex active_animation_vector_mutex;
106
    active_animation_vector_t active_animation_vector;
107

  
108

  
109
    AudioPlayer *audio_player;
105
	AudioPlayer* audio_player;
110 106
};
111

  
112

  

Also available in: Unified diff