diff options
author | XANTRONIX Development | 2022-02-26 22:27:18 -0500 |
---|---|---|
committer | XANTRONIX Development | 2022-02-26 22:27:18 -0500 |
commit | ca33881982e65f5c927cabdde5571ac4b8ce19cb (patch) | |
tree | ff72ac2eaa6008963c3432ac947e6974f88a31c3 /src | |
parent | 8a197be597ea6ffd1463e417394b14804e5fcc01 (diff) | |
download | xas-ca33881982e65f5c927cabdde5571ac4b8ce19cb.tar.gz xas-ca33881982e65f5c927cabdde5571ac4b8ce19cb.tar.bz2 xas-ca33881982e65f5c927cabdde5571ac4b8ce19cb.zip |
Ensure vox can only start, stop in correct state
Diffstat (limited to 'src')
-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; } |