version 1.20, 2010/04/03 17:40:33 |
version 1.21, 2010/04/03 17:59:17 |
|
|
unsigned start; /* offset where data starts */ |
unsigned start; /* offset where data starts */ |
unsigned used; /* valid data */ |
unsigned used; /* valid data */ |
unsigned len; /* size of the ring */ |
unsigned len; /* size of the ring */ |
|
unsigned abspos; /* frame number of the start position */ |
|
unsigned silence; /* silence to insert on next write */ |
|
unsigned drop; /* bytes to drop on next read */ |
struct aproc *rproc; /* reader */ |
struct aproc *rproc; /* reader */ |
struct aproc *wproc; /* writer */ |
struct aproc *wproc; /* writer */ |
struct abuf *duplex; /* link to buffer of the other direction */ |
struct abuf *duplex; /* link to buffer of the other direction */ |
|
|
int weight; /* dynamic range */ |
int weight; /* dynamic range */ |
int maxweight; /* max dynamic range allowed */ |
int maxweight; /* max dynamic range allowed */ |
unsigned vol; /* volume within the dynamic range */ |
unsigned vol; /* volume within the dynamic range */ |
unsigned done; /* frames ready */ |
unsigned done; /* bytes ready */ |
unsigned xrun; /* underrun policy */ |
unsigned xrun; /* underrun policy */ |
int drop; /* frames to drop on next read */ |
|
} mix; |
} mix; |
struct { |
struct { |
unsigned st; /* MIDI running status */ |
unsigned st; /* MIDI running status */ |
|
|
*/ |
*/ |
union { |
union { |
struct { |
struct { |
unsigned todo; /* frames to process */ |
unsigned todo; /* bytes to process */ |
} mix; |
} mix; |
struct { |
struct { |
unsigned done; /* frames copied */ |
unsigned done; /* bytes copied */ |
unsigned xrun; /* overrun policy */ |
unsigned xrun; /* overrun policy */ |
int silence; /* silence to add on next write */ |
|
} sub; |
} sub; |
} w; |
} w; |
}; |
}; |
|
|
* the buffer contains at least one frame. This macro should |
* the buffer contains at least one frame. This macro should |
* be used to check if the buffer can be flushed |
* be used to check if the buffer can be flushed |
*/ |
*/ |
#define ABUF_ROK(b) ((b)->used > 0) |
#define ABUF_ROK(b) ((b)->used >= (b)->bpf) |
|
|
/* |
/* |
* there's room for at least one frame |
* there's room for at least one frame |
*/ |
*/ |
#define ABUF_WOK(b) ((b)->len - (b)->used > 0) |
#define ABUF_WOK(b) ((b)->len - (b)->used >= (b)->bpf) |
|
|
/* |
/* |
* the buffer is empty and has no writer anymore |
* the buffer is empty and has no writer anymore |
|
|
* be not yet connected buffer (eg. socket play buffer) |
* be not yet connected buffer (eg. socket play buffer) |
*/ |
*/ |
#define ABUF_HUP(b) (!ABUF_WOK(b) && (b)->rproc == NULL) |
#define ABUF_HUP(b) (!ABUF_WOK(b) && (b)->rproc == NULL) |
|
|
|
/* |
|
* similar to !ABUF_WOK, but is used for file i/o, where |
|
* operation may not involve an integer number of frames |
|
*/ |
|
#define ABUF_FULL(b) ((b)->used == (b)->len) |
|
|
|
/* |
|
* same as !ABUF_ROK, but used for files, where |
|
* operations are byte orientated, not frame-oriented |
|
*/ |
|
#define ABUF_EMPTY(b) ((b)->used == 0) |
|
|
struct abuf *abuf_new(unsigned, struct aparams *); |
struct abuf *abuf_new(unsigned, struct aparams *); |
void abuf_del(struct abuf *); |
void abuf_del(struct abuf *); |