Revision 888a909b server/src/Arbiter.cpp
| server/src/Arbiter.cpp | ||
|---|---|---|
| 61 | 61 |
gaze_state_animation_restart = true; |
| 62 | 62 |
emotion_target = &emotion_config_default; |
| 63 | 63 |
|
| 64 |
utterance = boost::shared_ptr<Utterance>(new Utterance());
|
|
| 64 |
utterance = std::shared_ptr<Utterance>(new Utterance());
|
|
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
Arbiter::~Arbiter(){
|
| ... | ... | |
| 117 | 117 |
} |
| 118 | 118 |
|
| 119 | 119 |
//! note: this is blocking! |
| 120 |
void Arbiter::play_animation(boost::shared_ptr<Animation> incoming_animation){
|
|
| 120 |
void Arbiter::play_animation(std::shared_ptr<Animation> incoming_animation){
|
|
| 121 | 121 |
//incoming animation, check if this would conflict with any pending animations: |
| 122 | 122 |
//lock access & iterate over vector: |
| 123 | 123 |
std::unique_lock<std::mutex> lock_av(active_animation_vector_mutex); |
| 124 | 124 |
active_animation_vector_t::iterator it; |
| 125 | 125 |
for(it = active_animation_vector.begin(); it<active_animation_vector.end(); it++){
|
| 126 |
boost::shared_ptr<Animation> current_ani = *it;
|
|
| 126 |
std::shared_ptr<Animation> current_ani = *it;
|
|
| 127 | 127 |
//check if the running animation collides with the incoming animation: |
| 128 | 128 |
if (current_ani->collides_with(incoming_animation.get())){
|
| 129 | 129 |
//this would fail, we can not play this animation right now! |
| ... | ... | |
| 150 | 150 |
//ok, it finished. we can safely remove it now: |
| 151 | 151 |
lock_av.lock(); |
| 152 | 152 |
for(it = active_animation_vector.begin(); it<active_animation_vector.end();){
|
| 153 |
boost::shared_ptr<Animation> current_ani = *it;
|
|
| 153 |
std::shared_ptr<Animation> current_ani = *it;
|
|
| 154 | 154 |
if (*it == incoming_animation){
|
| 155 | 155 |
//printf(">match -> remove incoming ani again\n");
|
| 156 | 156 |
it = active_animation_vector.erase(it); |
| ... | ... | |
| 160 | 160 |
} |
| 161 | 161 |
} |
| 162 | 162 |
|
| 163 |
void Arbiter::speak(boost::shared_ptr<Utterance> u){ //, ao_sample_format audio_format, char *audio_data, unsigned int audio_len){
|
|
| 163 |
void Arbiter::speak(std::shared_ptr<Utterance> u){ //, ao_sample_format audio_format, char *audio_data, unsigned int audio_len){
|
|
| 164 | 164 |
//lock audio playback as such: |
| 165 | 165 |
const std::lock_guard<std::mutex> lock_audio(audio_player_mutex); |
| 166 | 166 |
|
| ... | ... | |
| 348 | 348 |
const std::lock_guard<std::mutex> lock_av(active_animation_vector_mutex); |
| 349 | 349 |
active_animation_vector_t::iterator it; |
| 350 | 350 |
for(it = active_animation_vector.begin(); it<active_animation_vector.end(); it++){
|
| 351 |
boost::shared_ptr<Animation> current_ani = *it;
|
|
| 351 |
std::shared_ptr<Animation> current_ani = *it;
|
|
| 352 | 352 |
|
| 353 | 353 |
//gaze_state.dump(); |
| 354 | 354 |
current_ani->apply_on_gazestate(&gaze_state); |
Also available in: Unified diff