#include #include #include #include static void vox_cleanup(xas_vox *vox, xas_audio_stream *stream) { int status; if (vox->flags & XAS_VOX_ACTIVE) { if (vox->pid >= 0) { (void)waitpid(vox->pid, &status, 0); } if (vox->stdout >= 0) { (void)close(vox->stdout); } } } static ssize_t vox_fill(xas_vox *vox, int16_t *samples, size_t count, xas_audio_stream *stream) { size_t i; for (i=0; itext2wave_path = text2wave_path; vox->sample_size = sample_size; vox->sample_rate = sample_rate; vox->buffer_size = buffer_size; vox->ctx = ctx; vox->flags = XAS_VOX_IDLE; vox->pid = -1; vox->stdout = -1; return vox; error_malloc_vox: return NULL; } xas_audio_stream *xas_vox_stream_new(xas_vox *vox) { return xas_audio_stream_new_source((xas_audio_fill)vox_fill, (xas_audio_cleanup)vox_cleanup, vox, vox->sample_size, vox->sample_rate, XAS_AUDIO_STREAM_MONO, vox->buffer_size); }