Revision 7a918ce1

View differences:

server/src/Arbiter.cpp
37 37

  
38 38
Arbiter::Arbiter(std::string audio_output){
39 39
    //initialize audio player:
40
    if (iequals(audio_output.substr(0,3), "rsb")){
40
    if (iequals(audio_output, "none")){
41
        //allow none for no sound output
42
        audio_player = NULL;
43
    }else if (iequals(audio_output.substr(0,3), "rsb")){
41 44
        #ifdef RSB_SUPPORT
42 45
            audio_player = new AudioPlayerRSB(audio_output);
43 46
        #else
......
157 160
    scoped_lock.unlock();
158 161

  
159 162
    //start audio playback, this function returns once we started playback
160
    audio_player->play(utterance->get_audio_data());
163
    if (audio_player == NULL){
164
        printf("> audio_player disabled, not speaking '%s'\n", u.get()->get_text().c_str());
165
    }else{
166
        audio_player->play(utterance->get_audio_data());
167
    }
161 168
    utterance->start_playback();
162 169

  
163 170
    //wait until audio playback was finished:
164
    while(audio_player->is_playing()){
165
        //save some cpu cycles:
166
        usleep(1*1000); //1ms
171
    if (audio_player != NULL){
172
        while(audio_player->is_playing()){
173
            //save some cpu cycles:
174
            usleep(1*1000); //1ms
175
        }
167 176
    }
177

  
168 178
    //in case the audio output fails, we end up here before the utterance is finished.
169 179
    //so check now if the utterance finished as well:
170 180
    while (utterance->is_playing()){
......
175 185
}
176 186

  
177 187
bool Arbiter::speak_active(){
178
    return audio_player->is_playing();
188
    if (audio_player == NULL){
189
        return false;
190
    }else{
191
        return audio_player->is_playing();
192
    }
179 193
}
180 194

  
181 195
void Arbiter::arbitrate(){

Also available in: Unified diff