Skip to content

Commit

Permalink
Speech output now stoppable
Browse files Browse the repository at this point in the history
  • Loading branch information
BennyR committed May 7, 2014
1 parent ccc0069 commit 419cb19
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cerevoice_tts/src/CerevoiceTts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ void CerevoiceTts::channelCallback(CPRC_abuf * audio_buffer, void * user_data)
audio_sound_cue = CPRC_sc_audio_short_disposable(CPRC_abuf_wav_data(audio_buffer) + wav_mk, wav_done - wav_mk);
CPRC_sc_audio_cue(tts_object->player_, audio_sound_cue);
}
else
{
ROS_ERROR("Can't play audio! Pointer to player is NULL!");
}
}

bool CerevoiceTts::init()
Expand Down Expand Up @@ -199,7 +203,16 @@ void CerevoiceTts::executeCB(const cerevoice_tts_msgs::TtsGoalConstPtr &goal)

void CerevoiceTts::preemptCB()
{
if(player_)
{
ROS_INFO("Aborting text synthesis.");
int ret = CPRC_sc_audio_stop(player_);

if(ret == 0)
ROS_ERROR("Player can't be stopped!");
}
else
ROS_ERROR("Player is NULL!");
}

std::string CerevoiceTts::constructXml(std::string text, std::string voice)
Expand Down

0 comments on commit 419cb19

Please sign in to comment.