Revision 482adb6d server/src/Arbiter.cpp
| server/src/Arbiter.cpp | ||
|---|---|---|
| 64 | 64 |
gaze_state_animation_restart = true; |
| 65 | 65 |
emotion_target = &emotion_config_default; |
| 66 | 66 |
|
| 67 |
utterance = boost::shared_ptr<Utterance>(new Utterance());
|
|
| 67 |
utterance = std::shared_ptr<Utterance>(new Utterance());
|
|
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
Arbiter::~Arbiter() {
|
| ... | ... | |
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 | 122 |
//! note: this is blocking! |
| 123 |
void Arbiter::play_animation(boost::shared_ptr<Animation> incoming_animation) {
|
|
| 123 |
void Arbiter::play_animation(std::shared_ptr<Animation> incoming_animation) {
|
|
| 124 | 124 |
// incoming animation, check if this would conflict with any pending animations: |
| 125 | 125 |
// lock access & iterate over vector: |
| 126 | 126 |
std::unique_lock<std::mutex> lock_av(active_animation_vector_mutex); |
| 127 | 127 |
active_animation_vector_t::iterator it; |
| 128 | 128 |
for (it = active_animation_vector.begin(); it < active_animation_vector.end(); it++) {
|
| 129 |
boost::shared_ptr<Animation> current_ani = *it;
|
|
| 129 |
std::shared_ptr<Animation> current_ani = *it;
|
|
| 130 | 130 |
// check if the running animation collides with the incoming animation: |
| 131 | 131 |
if (current_ani->collides_with(incoming_animation.get())) {
|
| 132 | 132 |
// this would fail, we can not play this animation right now! |
| ... | ... | |
| 153 | 153 |
// ok, it finished. we can safely remove it now: |
| 154 | 154 |
lock_av.lock(); |
| 155 | 155 |
for (it = active_animation_vector.begin(); it < active_animation_vector.end();) {
|
| 156 |
boost::shared_ptr<Animation> current_ani = *it;
|
|
| 156 |
std::shared_ptr<Animation> current_ani = *it;
|
|
| 157 | 157 |
if (*it == incoming_animation) {
|
| 158 | 158 |
// printf(">match -> remove incoming ani again\n");
|
| 159 | 159 |
it = active_animation_vector.erase(it); |
| ... | ... | |
| 165 | 165 |
} |
| 166 | 166 |
|
| 167 | 167 |
void Arbiter::speak( |
| 168 |
boost::shared_ptr<Utterance> u) { //, ao_sample_format audio_format, char *audio_data, unsigned int audio_len){
|
|
| 168 |
std::shared_ptr<Utterance> u) { //, ao_sample_format audio_format, char *audio_data, unsigned int audio_len){
|
|
| 169 | 169 |
// lock audio playback as such: |
| 170 | 170 |
const std::lock_guard<std::mutex> lock_audio(audio_player_mutex); |
| 171 | 171 |
|
| ... | ... | |
| 355 | 355 |
const std::lock_guard<std::mutex> lock_av(active_animation_vector_mutex); |
| 356 | 356 |
active_animation_vector_t::iterator it; |
| 357 | 357 |
for (it = active_animation_vector.begin(); it < active_animation_vector.end(); it++) {
|
| 358 |
boost::shared_ptr<Animation> current_ani = *it;
|
|
| 358 |
std::shared_ptr<Animation> current_ani = *it;
|
|
| 359 | 359 |
|
| 360 | 360 |
// gaze_state.dump(); |
| 361 | 361 |
current_ani->apply_on_gazestate(&gaze_state); |
Also available in: Unified diff