summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vox.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/vox.c b/src/vox.c
index 697ff95..caa3a26 100644
--- a/src/vox.c
+++ b/src/vox.c
@@ -38,7 +38,7 @@ static int vox_stop(xas_vox *vox) {
vox->pid = -1;
}
- vox->flags &= ~XAS_VOX_ACTIVE;
+ vox->state = XAS_VOX_IDLE;
return 0;
@@ -83,7 +83,7 @@ static int vox_start(xas_vox *vox) {
char sample_rate[40];
- if (vox->flags & XAS_VOX_ACTIVE) {
+ if (vox->state == XAS_VOX_ACTIVE) {
(void)vox_stop(vox);
}
@@ -155,7 +155,7 @@ error_child:
vox->stdin = pipe_stdin[1];
vox->stdout = pipe_stdout[0];
vox->in = fdopen(pipe_stdin[1], "w");
- vox->flags |= XAS_VOX_ACTIVE;
+ vox->state = XAS_VOX_ACTIVE;
return 0;
@@ -182,7 +182,7 @@ static ssize_t vox_fill(xas_vox *vox,
ssize_t readlen,
readcount;
- if (!(vox->flags & XAS_VOX_ACTIVE)) {
+ if (vox->state != XAS_VOX_ACTIVE) {
xas_audio_zero(vox->format, samples, 0, count);
return count;
@@ -224,7 +224,7 @@ xas_vox *xas_vox_new(const char *text2wave_path,
vox->format.sample_rate = format.sample_rate;
vox->buffer_size = buffer_size;
- vox->flags = XAS_VOX_IDLE;
+ vox->state = XAS_VOX_IDLE;
vox->pid = -1;
vox->stdin = -1;
vox->stdout = -1;
@@ -246,7 +246,7 @@ void xas_vox_destroy(xas_vox *vox) {
}
int xas_vox_stop(xas_vox *vox) {
- if (vox->flags & XAS_VOX_ACTIVE) {
+ if (vox->state == XAS_VOX_ACTIVE) {
return vox_stop(vox);
}
@@ -254,7 +254,7 @@ int xas_vox_stop(xas_vox *vox) {
}
int xas_vox_active(xas_vox *vox) {
- return vox->flags & XAS_VOX_ACTIVE;
+ return vox->state == XAS_VOX_ACTIVE;
}
int xas_vox_generate(xas_vox *vox) {
@@ -288,7 +288,7 @@ error_riff_open_fd:
}
int xas_vox_vsayf(xas_vox *vox, const char *format, va_list args) {
- if (!(vox->flags & XAS_VOX_ACTIVE) && vox_start(vox) < 0) {
+ if (vox->state == XAS_VOX_IDLE && vox_start(vox) < 0) {
goto error_vox_start;
}