Revision 2e526a15 server/src/Arbiter.cpp
server/src/Arbiter.cpp | ||
---|---|---|
52 | 52 |
emotion_config_current.init_sad(); |
53 | 53 |
emotion_config_current.set_duration(2000); |
54 | 54 |
emotion_config_default.init_neutral(); |
55 |
|
|
56 |
utterance = boost::shared_ptr<Utterance>(new Utterance()); |
|
55 | 57 |
} |
56 | 58 |
|
57 | 59 |
Arbiter::~Arbiter(){ |
... | ... | |
145 | 147 |
} |
146 | 148 |
} |
147 | 149 |
|
148 |
void Arbiter::speak(Utterance u){ //, ao_sample_format audio_format, char *audio_data, unsigned int audio_len){
|
|
150 |
void Arbiter::speak(boost::shared_ptr<Utterance> u){ //, ao_sample_format audio_format, char *audio_data, unsigned int audio_len){
|
|
149 | 151 |
//lock audio playback as such: |
150 | 152 |
mutex::scoped_lock scoped_lock_audio(audio_player_mutex); |
151 | 153 |
|
... | ... | |
155 | 157 |
scoped_lock.unlock(); |
156 | 158 |
|
157 | 159 |
//start audio playback, this function returns once we started playback |
158 |
audio_player->play(utterance.get_audio_data());
|
|
159 |
utterance.start_playback();
|
|
160 |
audio_player->play(utterance->get_audio_data());
|
|
161 |
utterance->start_playback();
|
|
160 | 162 |
|
161 | 163 |
//wait until audio playback was finished: |
162 | 164 |
while(audio_player->is_playing()){ |
... | ... | |
165 | 167 |
} |
166 | 168 |
//in case the audio output fails, we end up here before the utterance is finished. |
167 | 169 |
//so check now if the utterance finished as well: |
168 |
while (utterance.is_playing()){
|
|
170 |
while (utterance->is_playing()){
|
|
169 | 171 |
//save some cpu cycles: |
170 | 172 |
usleep(1*1000); //1ms |
171 | 173 |
} |
... | ... | |
197 | 199 |
|
198 | 200 |
void Arbiter::override_by_utterance(){ |
199 | 201 |
//fetch MouthState by utterance: |
200 |
if (!utterance.is_playing()){
|
|
202 |
if (!utterance->is_playing()){
|
|
201 | 203 |
//not playing -> return |
202 | 204 |
return; |
203 | 205 |
} |
204 | 206 |
|
205 | 207 |
//fetch symbol |
206 |
string symbol = utterance.currently_active_phoneme();
|
|
208 |
string symbol = utterance->currently_active_phoneme();
|
|
207 | 209 |
if ((symbol.empty()) || (symbol == "")){ |
208 | 210 |
return; |
209 | 211 |
} |
Also available in: Unified diff