diff options
-rw-r--r-- | src/vox.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -66,7 +66,9 @@ static int vox_start(xas_vox *vox) { snprintf(sample_rate, sizeof(sample_rate)-1, "%zu", vox->format.sample_rate); - (void)vox_stop(vox); + if (vox->flags & XAS_VOX_ACTIVE) { + (void)vox_stop(vox); + } if (pipe(pipe_stdin) < 0) { goto error_pipe_stdin; @@ -203,7 +205,11 @@ void xas_vox_destroy(xas_vox *vox) { } int xas_vox_stop(xas_vox *vox) { - return vox_stop(vox); + if (vox->flags & XAS_VOX_ACTIVE) { + return vox_stop(vox); + } + + return 0; } int xas_vox_active(xas_vox *vox) { @@ -241,7 +247,7 @@ error_riff_open_fd: } int xas_vox_vsayf(xas_vox *vox, const char *format, va_list args) { - if (vox_start(vox) < 0) { + if (!(vox->flags & XAS_VOX_ACTIVE) && vox_start(vox) < 0) { goto error_vox_start; } |