rename STATE_xxx to SIOFILE_xxx

This commit is contained in:
Alexandre Ratchov 2012-11-02 12:48:10 +01:00
parent e22f44cdfa
commit a9dad9889f
3 changed files with 15 additions and 15 deletions

View File

@ -147,7 +147,7 @@ struct dev {
#define DEV_CFG 0 /* closed */ #define DEV_CFG 0 /* closed */
#define DEV_INIT 1 /* stopped */ #define DEV_INIT 1 /* stopped */
#define DEV_RUN 3 /* playin & recording */ #define DEV_RUN 3 /* playin & recording */
unsigned int pstate; /* one of DEV_xxx */ unsigned int pstate; /* one of above */
char *path; /* sio path */ char *path; /* sio path */
/* /*

View File

@ -267,10 +267,10 @@ siofile_start(struct siofile *f)
return; return;
} }
if (d->mode & MODE_PLAY) { if (d->mode & MODE_PLAY) {
f->state = STATE_CYCLE; f->state = SIOFILE_CYCLE;
f->todo = 0; f->todo = 0;
} else { } else {
f->state = STATE_REC; f->state = SIOFILE_READ;
f->todo = d->round * d->rchan * d->par.bps; f->todo = d->round * d->rchan * d->par.bps;
} }
#ifdef DEBUG #ifdef DEBUG
@ -315,7 +315,7 @@ siofile_pollfd(void *arg, struct pollfd *pfd)
struct siofile *f = arg; struct siofile *f = arg;
int events; int events;
events = (f->state == STATE_REC) ? POLLIN : POLLOUT; events = (f->state == SIOFILE_READ) ? POLLIN : POLLOUT;
return sio_pollfd(f->hdl, pfd, events); return sio_pollfd(f->hdl, pfd, events);
} }
@ -344,7 +344,7 @@ siofile_run(void *arg)
if (d->pstate != DEV_RUN) if (d->pstate != DEV_RUN)
return; return;
switch (f->state) { switch (f->state) {
case STATE_REC: case SIOFILE_READ:
#ifdef DEBUG #ifdef DEBUG
if (!(f->events & POLLIN)) { if (!(f->events & POLLIN)) {
siofile_log(f); siofile_log(f);
@ -375,20 +375,20 @@ siofile_run(void *arg)
panic(); panic();
} }
#endif #endif
f->state = STATE_CYCLE; f->state = SIOFILE_CYCLE;
break; break;
case STATE_CYCLE: case SIOFILE_CYCLE:
dev_cycle(d); dev_cycle(d);
if (d->mode & MODE_PLAY) { if (d->mode & MODE_PLAY) {
f->state = STATE_PLAY; f->state = SIOFILE_WRITE;
f->todo = d->round * d->pchan * d->par.bps; f->todo = d->round * d->pchan * d->par.bps;
break; break;
} else { } else {
f->state = STATE_REC; f->state = SIOFILE_READ;
f->todo = d->round * d->rchan * d->par.bps; f->todo = d->round * d->rchan * d->par.bps;
return; return;
} }
case STATE_PLAY: case SIOFILE_WRITE:
if (!siofile_play(f)) if (!siofile_play(f))
return; return;
#ifdef DEBUG #ifdef DEBUG
@ -416,10 +416,10 @@ siofile_run(void *arg)
if (d->poffs == d->bufsz) if (d->poffs == d->bufsz)
d->poffs = 0; d->poffs = 0;
if ((d->mode & MODE_REC) && d->prime == 0) { if ((d->mode & MODE_REC) && d->prime == 0) {
f->state = STATE_REC; f->state = SIOFILE_READ;
f->todo = d->round * d->rchan * d->par.bps; f->todo = d->round * d->rchan * d->par.bps;
} else } else
f->state = STATE_CYCLE; f->state = SIOFILE_CYCLE;
return; return;
} }
} }

View File

@ -29,9 +29,9 @@ struct siofile {
#endif #endif
struct dev *dev; struct dev *dev;
struct file *file; struct file *file;
#define STATE_REC 0 #define SIOFILE_READ 0
#define STATE_CYCLE 1 #define SIOFILE_CYCLE 1
#define STATE_PLAY 2 #define SIOFILE_WRITE 2
int state; int state;
}; };