add prototypes

This commit is contained in:
Alexandre Ratchov 2013-11-18 17:50:04 +01:00
parent def3c30515
commit b1c417ab04
28 changed files with 312 additions and 40 deletions

View File

@ -45,6 +45,12 @@
#include "dbg.h"
#endif
void abuf_dump(struct abuf *);
int abuf_flush_do(struct abuf *);
int abuf_fill_do(struct abuf *);
void abuf_eof_do(struct abuf *);
void abuf_hup_do(struct abuf *);
#ifdef DEBUG
void
abuf_dbg(struct abuf *buf)

View File

@ -60,6 +60,90 @@
*/
#define SUB_WOK(buf) (ABUF_WOK(buf) || (buf)->w.sub.silence < 0)
int zomb_in(struct aproc *, struct abuf *);
int zomb_out(struct aproc *, struct abuf *);
void zomb_eof(struct aproc *, struct abuf *);
void zomb_hup(struct aproc *, struct abuf *);
void zomb_newin(struct aproc *, struct abuf *);
void zomb_newout(struct aproc *, struct abuf *);
void zomb_ipos(struct aproc *, struct abuf *, int);
void zomb_opos(struct aproc *, struct abuf *, int);
int rfile_do(struct aproc *, unsigned int, unsigned int *);
int rfile_in(struct aproc *, struct abuf *);
int rfile_out(struct aproc *, struct abuf *);
void rfile_done(struct aproc *);
void rfile_eof(struct aproc *, struct abuf *);
void rfile_hup(struct aproc *, struct abuf *);
void wfile_done(struct aproc *);
int wfile_do(struct aproc *, unsigned int, unsigned int *);
int wfile_in(struct aproc *, struct abuf *);
int wfile_out(struct aproc *, struct abuf *);
void wfile_eof(struct aproc *, struct abuf *);
void wfile_hup(struct aproc *, struct abuf *);
void mix_drop(struct abuf *, int);
void mix_bzero(struct abuf *, unsigned int);
unsigned int mix_badd(struct abuf *, struct abuf *);
int mix_xrun(struct aproc *, struct abuf *);
int mix_in(struct aproc *, struct abuf *);
int mix_out(struct aproc *, struct abuf *);
void mix_eof(struct aproc *, struct abuf *);
void mix_hup(struct aproc *, struct abuf *);
void mix_newin(struct aproc *, struct abuf *);
void mix_newout(struct aproc *, struct abuf *);
void mix_opos(struct aproc *, struct abuf *, int);
void mix_setmaster(struct aproc *);
void mix_clear(struct aproc *);
void mix_quit(struct aproc *);
void sub_silence(struct abuf *, int);
void sub_bcopy(struct abuf *, struct abuf *);
int sub_xrun(struct aproc *, struct abuf *);
int sub_in(struct aproc *, struct abuf *);
int sub_out(struct aproc *, struct abuf *);
void sub_eof(struct aproc *, struct abuf *);
void sub_hup(struct aproc *, struct abuf *);
void sub_newout(struct aproc *, struct abuf *);
void sub_ipos(struct aproc *, struct abuf *, int);
void sub_clear(struct aproc *);
void resamp_bcopy(struct aproc *, struct abuf *, struct abuf *);
int resamp_in(struct aproc *, struct abuf *);
int resamp_out(struct aproc *, struct abuf *);
void resamp_eof(struct aproc *, struct abuf *);
void resamp_hup(struct aproc *, struct abuf *);
void resamp_ipos(struct aproc *, struct abuf *, int);
void resamp_opos(struct aproc *, struct abuf *, int);
void enc_bcopy(struct aproc *, struct abuf *, struct abuf *);
int enc_in(struct aproc *, struct abuf *);
int enc_out(struct aproc *, struct abuf *);
void enc_eof(struct aproc *, struct abuf *);
void enc_hup(struct aproc *, struct abuf *);
void dec_bcopy(struct aproc *, struct abuf *, struct abuf *);
int dec_in(struct aproc *, struct abuf *);
int dec_out(struct aproc *, struct abuf *);
void dec_eof(struct aproc *, struct abuf *);
void dec_hup(struct aproc *, struct abuf *);
void join_bcopy(struct aproc *, struct abuf *, struct abuf *);
int join_in(struct aproc *, struct abuf *);
int join_out(struct aproc *, struct abuf *);
void join_eof(struct aproc *, struct abuf *);
void join_hup(struct aproc *, struct abuf *);
void mon_flush(struct aproc *);
void mon_snoop(struct aproc *, struct abuf *, unsigned int, unsigned int);
int mon_in(struct aproc *, struct abuf *);
void mon_clear(struct aproc *);
int mon_out(struct aproc *, struct abuf *);
void mon_eof(struct aproc *, struct abuf *);
void mon_hup(struct aproc *, struct abuf *);
void mon_ipos(struct aproc *, struct abuf *, int);
#ifdef DEBUG
void
aproc_dbg(struct aproc *p)

View File

@ -205,6 +205,7 @@ void aproc_del(struct aproc *);
void aproc_dbg(struct aproc *);
void aproc_setin(struct aproc *, struct abuf *);
void aproc_setout(struct aproc *, struct abuf *);
int aproc_inuse(struct aproc *);
int aproc_depend(struct aproc *, struct aproc *);
void aproc_ipos(struct aproc *, struct abuf *, int);

View File

@ -69,6 +69,19 @@
#define DEFAULT_BUFSZ 7860
#endif
void sigint(int);
void sigusr1(int);
void sigusr2(int);
void opt_ch(struct aparams *);
void opt_enc(struct aparams *);
int opt_hdr(void);
int opt_mmc(void);
int opt_onoff(void);
int opt_xrun(void);
void setsig(void);
void unsetsig(void);
struct dev *mkdev(char *, int, int, int, int, int);
#ifdef DEBUG
volatile sig_atomic_t debug_level = 1;
#endif

View File

@ -87,6 +87,11 @@ void dev_stop(struct dev *);
void dev_clear(struct dev *);
void dev_onmove(void *, int);
int devctl_open(struct dev *, struct devctl *);
int dev_getep(struct dev *, unsigned int, struct abuf **, struct abuf **);
void dev_sync(struct dev *, unsigned int, struct abuf *, struct abuf *);
int dev_mkslot(struct dev *, char *);
int dev_try(struct dev *, int);
struct dev *dev_list = NULL;
unsigned int dev_sndnum = 0, dev_thrnum = 0;

View File

@ -69,6 +69,11 @@
#define MAXFDS 100
#define TIMER_USEC 10000
void timo_update(unsigned int);
void timo_init(void);
void timo_done(void);
void file_sigalrm(int);
struct timespec file_ts;
struct filelist file_list;
struct timo *timo_queue;

View File

@ -76,6 +76,8 @@ char wav_guid[14] = {
0x9B, 0x71
};
int wav_readfmt(int, unsigned int, struct aparams *, short **);
int
wav_readfmt(int fd, unsigned int csize, struct aparams *par, short **map)
{

View File

@ -66,6 +66,22 @@
#define MIDI_CTLVOL 7 /* volume */
#define MIDI_CTLPAN 11 /* pan */
void midi_cb(void *);
void midi_msg_info(struct aproc *, int, unsigned char *);
void midi_msg_vol(struct aproc *, int, unsigned char *);
void midi_msg_master(struct aproc *, unsigned char *);
void midi_copy(struct abuf *, struct abuf *, unsigned char *, unsigned int);
void midi_send(struct aproc *, struct abuf *, unsigned char *, unsigned int);
void midi_copy_dump(struct aproc *, struct abuf *);
void midi_onvoice(struct aproc *, struct abuf *);
void midi_onsysex(struct aproc *, struct abuf *);
int midi_in(struct aproc *, struct abuf *);
int midi_out(struct aproc *, struct abuf *);
void midi_eof(struct aproc *, struct abuf *);
void midi_hup(struct aproc *, struct abuf *);
void midi_newin(struct aproc *, struct abuf *);
void midi_done(struct aproc *);
/*
* length of voice and common messages (status byte included)
*/

View File

@ -57,6 +57,7 @@ void siofile_stop(struct file *);
int siofile_nfds(struct file *);
int siofile_pollfd(struct file *, struct pollfd *, int);
int siofile_revents(struct file *, struct pollfd *);
void siofile_cb(void *, int);
struct fileops siofile_ops = {
"sio",

View File

@ -30,6 +30,36 @@
#include "dbg.h"
#endif
void wav_dbg(struct wav *);
void wav_conv(unsigned char *, unsigned int, short *);
unsigned int wav_read(struct file *, unsigned char *, unsigned int);
unsigned int wav_write(struct file *, unsigned char *, unsigned int);
void wav_close(struct file *);
int wav_attach(struct wav *, int);
void wav_midiattach(struct wav *);
void wav_allocbuf(struct wav *);
void wav_freebuf(struct wav *);
void wav_reset(struct wav *);
void wav_exit(struct wav *);
int wav_init(struct wav *);
int wav_seekmmc(struct wav *);
int wav_rdata(struct wav *);
int wav_wdata(struct wav *);
void wav_setvol(void *, unsigned int);
void wav_startreq(void *);
void wav_stopreq(void *);
void wav_locreq(void *, unsigned int);
void wav_quitreq(void *);
int wav_autohdr(char *, struct dev *, unsigned int *, unsigned int *);
void rwav_done(struct aproc *);
int rwav_in(struct aproc *, struct abuf *);
int rwav_out(struct aproc *, struct abuf *);
struct aproc *rwav_new(struct file *);
void wwav_done(struct aproc *);
int wwav_in(struct aproc *, struct abuf *);
int wwav_out(struct aproc *, struct abuf *);
struct aproc *wwav_new(struct file *);
short wav_ulawmap[256] = {
-32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956,
-23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764,

View File

@ -13,9 +13,10 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef HAVE_ISSETUGID
#include <unistd.h>
#include "bsd-compat.h"
#ifndef HAVE_ISSETUGID
int
issetugid(void)
{

View File

@ -16,10 +16,11 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef HAVE_STRLCAT
#include <sys/types.h>
#include <string.h>
#include "bsd-compat.h"
#ifndef HAVE_STRLCAT
/*
* Appends src to string dst of size siz (unlike strncat, siz is the
* full size of dst, not space left). At most siz-1 characters

View File

@ -14,10 +14,11 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef HAVE_STRLCPY
#include <sys/types.h>
#include <string.h>
#include "bsd-compat.h"
#ifndef HAVE_STRLCPY
/*
* Copy src to string dst of size siz. At most siz-1 characters
* will be copied. Always NUL terminates (unless siz == 0).

View File

@ -15,10 +15,10 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef HAVE_STRTONUM
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include "bsd-compat.h"
#ifndef LLONG_MIN
#define LLONG_MIN (-LLONG_MAX-1)
@ -31,6 +31,7 @@
#define TOOSMALL 2
#define TOOLARGE 3
#ifndef HAVE_STRTONUM
long long
strtonum(const char *numstr, long long minval, long long maxval,
const char **errstrp)

View File

@ -11,6 +11,10 @@
struct sio_par par;
struct sio_cap cap;
void pr_enc(struct sio_enc *);
void cap_pr(struct sio_cap *);
void usage(void);
void
pr_enc(struct sio_enc *enc)
{

View File

@ -16,6 +16,13 @@ struct buf { /* simple circular fifo */
unsigned char data[BUF_LEN];
};
void cb(void *, int);
void buf_read(struct buf *, int);
void buf_write(struct buf *, int);
unsigned buf_rec(struct buf *, struct sio_hdl *);
unsigned buf_play(struct buf *, struct sio_hdl *);
void usage(void);
char *xstr[] = SIO_XSTRINGS;
struct sio_par par;
struct buf playbuf, recbuf;

View File

@ -9,6 +9,10 @@
#include "tools.h"
#define BUFSZ 0x100
void cb(void *, int);
void usage(void);
unsigned char buf[BUFSZ];
struct sio_par par;
char *xstr[] = SIO_XSTRINGS;

View File

@ -9,6 +9,10 @@
#include "tools.h"
#define BUFSZ 0x1000
void cb(void *, int);
void usage(void);
unsigned char buf[BUFSZ];
struct sio_par par;
char *xstr[] = SIO_XSTRINGS;

View File

@ -11,6 +11,10 @@
#include "tools.h"
#define BUFSZ 0x100
void usage(void);
void onvol(void *, unsigned);
unsigned char buf[BUFSZ];
struct sio_par par;
unsigned vol = 0xdeadbeef;

View File

@ -55,6 +55,9 @@ struct sio_alsa_hdl {
int events;
};
/* stdin */
static void sio_alsa_onmove(struct sio_alsa_hdl *);
static int sio_alsa_revents(struct sio_hdl *, struct pollfd *);
static void sio_alsa_close(struct sio_hdl *);
static int sio_alsa_start(struct sio_hdl *);
static int sio_alsa_stop(struct sio_hdl *);
@ -450,7 +453,7 @@ sio_alsa_xrun(struct sio_alsa_hdl *hdl)
return 1;
}
int
static int
sio_alsa_setpar_hw(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwp,
snd_pcm_format_t *reqfmt, unsigned int *rate, unsigned int *chans,
snd_pcm_uframes_t *round, unsigned int *periods)

View File

@ -27,6 +27,13 @@
#define MIDI_NCHAN 16 /* max channels */
#define MSGMAX 0x100 /* buffer size */
void setvol(int, int);
void setmaster(int);
void onsysex(unsigned char *, int);
void oncommon(unsigned char *, int);
void oninput(unsigned char *, int);
void usage(void);
int verbose = 0;
int mst, midx, mlen, mready; /* midi parser state */
unsigned char mmsg[MSGMAX]; /* resulting midi message */

View File

@ -28,16 +28,6 @@
#include "sysex.h"
#include "utils.h"
int dev_open(struct dev *);
void dev_close(struct dev *);
void dev_clear(struct dev *);
void dev_master(struct dev *, unsigned int);
void slot_attach(struct slot *);
void slot_ready(struct slot *);
void slot_mix_drop(struct slot *);
void slot_sub_sil(struct slot *);
void zomb_onmove(void *, int);
void zomb_onvol(void *, unsigned int);
void zomb_fill(void *);
@ -48,11 +38,67 @@ void zomb_mmcstop(void *);
void zomb_mmcloc(void *, unsigned int);
void zomb_exit(void *);
void dev_log(struct dev *);
void dev_midi_qfr(struct dev *, int);
void dev_midi_full(struct dev *);
void dev_midi_vol(struct dev *, struct slot *);
void dev_midi_master(struct dev *);
void dev_midi_slotdesc(struct dev *, struct slot *);
void dev_midi_dump(struct dev *);
void dev_midi_imsg(void *, unsigned char *, int);
void dev_midi_omsg(void *, unsigned char *, int);
void dev_midi_fill(void *, int);
void dev_midi_exit(void *);
void dev_mon_snoop(struct dev *);
int play_filt_resamp(struct slot *, void *, void *, int);
int play_filt_dec(struct slot *, void *, void *, int);
void dev_mix_badd(struct dev *, struct slot *);
void dev_empty_cycle(struct dev *);
void dev_mix_adjvol(struct dev *);
void dev_mix_cycle(struct dev *);
int rec_filt_resamp(struct slot *, void *, void *, int);
int rec_filt_enc(struct slot *, void *, void *, int);
void dev_sub_bcopy(struct dev *, struct slot *);
void dev_sub_cycle(struct dev *);
void dev_onmove(struct dev *, int);
void dev_master(struct dev *, unsigned int);
void dev_cycle(struct dev *);
int dev_getpos(struct dev *);
struct dev *dev_new(char *, struct aparams *, unsigned int, unsigned int,
unsigned int, unsigned int, unsigned int, unsigned int);
void dev_adjpar(struct dev *, int, int, int, int, int);
int dev_open(struct dev *);
void dev_close(struct dev *);
int dev_ref(struct dev *);
void dev_unref(struct dev *);
int dev_init(struct dev *);
void dev_done(struct dev *);
struct dev *dev_bynum(int);
void dev_del(struct dev *);
unsigned int dev_roundof(struct dev *, unsigned int);
void dev_wakeup(struct dev *);
void dev_clear(struct dev *);
void dev_sync_attach(struct dev *);
void dev_mmcstart(struct dev *);
void dev_mmcstop(struct dev *);
void dev_mmcloc(struct dev *, unsigned int);
void slot_log(struct slot *);
struct slot *slot_new(struct dev *, char *, struct slotops *, void *, int);
void slot_del(struct slot *);
void slot_setvol(struct slot *, unsigned int);
void slot_attach(struct slot *);
void slot_ready(struct slot *);
void slot_start(struct slot *);
void slot_detach(struct slot *);
void slot_stop(struct slot *);
void slot_write(struct slot *);
void slot_read(struct slot *);
void slot_mix_drop(struct slot *);
void slot_sub_sil(struct slot *);
struct midiops dev_midiops = {
dev_midi_imsg,
dev_midi_omsg,

View File

@ -157,5 +157,6 @@ void dec_init(struct conv *, struct aparams *, int);
void cmap_add(struct cmap *, void *, void *, int, int);
void cmap_copy(struct cmap *, void *, void *, int, int);
void cmap_init(struct cmap *, int, int, int, int, int, int, int, int);
int sqrtone(int, adata_t *, int, int, int);
#endif /* !defined(DSP_H) */

View File

@ -62,6 +62,11 @@
#define MAXFDS 100
#define TIMER_USEC 10000
void timo_update(unsigned int);
void timo_init(void);
void timo_done(void);
void file_sigalrm(int);
struct timespec file_ts;
struct file *file_list;
struct timo *timo_queue;

View File

@ -110,6 +110,7 @@ void midi_fill(struct midi *);
void midi_tag(struct midi *, unsigned int);
void midi_link(struct midi *, struct midi *);
void port_log(struct port *);
struct port *port_new(char *, unsigned int, int);
struct port *port_bynum(int);
void port_del(struct port *);

View File

@ -33,6 +33,8 @@
#define WATCHDOG_USEC 2000000 /* 2 seconds */
void dev_sio_onmove(void *, int);
void dev_sio_timeout(void *);
int dev_sio_pollfd(void *, struct pollfd *);
int dev_sio_revents(void *, struct pollfd *);
void dev_sio_run(void *);

View File

@ -86,6 +86,22 @@
#define DEFAULT_DEV "rsnd/0"
#endif
void sigint(int);
void opt_ch(int *, int *);
void opt_enc(struct aparams *);
int opt_mmc(void);
int opt_onoff(void);
int getword(char *, char **);
unsigned int opt_mode(void);
void getbasepath(char *, size_t);
void setsig(void);
void unsetsig(void);
void privdrop(void);
struct dev *mkdev(char *, struct aparams *,
int, int, int, int, int, int);
struct opt *mkopt(char *, struct dev *,
int, int, int, int, int, int, int, int);
unsigned int log_level = 0;
volatile sig_atomic_t quit_flag = 0;

View File

@ -32,39 +32,40 @@
#include "sock.h"
#include "utils.h"
void sock_attach(struct sock *, int);
int sock_read(struct sock *);
int sock_write(struct sock *);
void sock_log(struct sock *);
void sock_close(struct sock *);
void sock_slot_fill(void *);
void sock_slot_flush(void *);
void sock_slot_eof(void *);
void sock_slot_onmove(void *, int);
void sock_slot_onvol(void *, unsigned int);
void sock_midi_imsg(void *, unsigned char *, int);
void sock_midi_omsg(void *, unsigned char *, int);
void sock_midi_fill(void *, int);
struct sock *sock_new(int);
void sock_slot_mmcstart(void *);
void sock_slot_mmcstop(void *);
void sock_slot_mmcloc(void *, unsigned int);
void sock_exit(void *);
int sock_fdwrite(struct sock *, void *, int);
int sock_fdread(struct sock *, void *, int);
int sock_rmsg(struct sock *);
int sock_wmsg(struct sock *);
int sock_rdata(struct sock *);
int sock_wdata(struct sock *);
int sock_setpar(struct sock *);
int sock_auth(struct sock *);
int sock_hello(struct sock *);
int sock_execmsg(struct sock *);
int sock_buildmsg(struct sock *);
void sock_close(struct sock *);
int sock_read(struct sock *);
int sock_write(struct sock *);
int sock_pollfd(void *, struct pollfd *);
int sock_revents(void *, struct pollfd *);
void sock_in(void *);
void sock_out(void *);
void sock_hup(void *);
/*
* slot call-backs
*/
void sock_slot_onmove(void *, int);
void sock_slot_onvol(void *, unsigned int);
void sock_slot_fill(void *);
void sock_slot_flush(void *);
void sock_slot_eof(void *);
void sock_slot_mmcstart(void *);
void sock_slot_mmcstop(void *);
void sock_slot_mmcloc(void *, unsigned int);
void sock_exit(void *);
/*
* midi call-backs
*/
void sock_midi_imsg(void *, unsigned char *, int);
void sock_midi_omsg(void *, unsigned char *, int);
void sock_midi_fill(void *, int);
struct fileops sock_fileops = {
"sock",
sock_pollfd,