Changeset 1554:075fb6bf5c2c in roaraudio


Ignore:
Timestamp:
04/13/09 00:04:46 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added macros, defines, structs and proto types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/libroarsndio/sndiosym.h

    r1552 r1554  
    3636#include <roaraudio.h> 
    3737 
     38#ifdef ROAR_HAVE_H_POLL 
     39#include <poll.h> 
     40#else 
     41struct pollfd; 
     42#endif 
     43 
     44#define SIO_PLAY        1 
     45#define SIO_REC         2 
     46 
     47#define SIO_IGNORE      0       /* pause during xrun */ 
     48#define SIO_SYNC        1       /* resync after xrun */ 
     49#define SIO_ERROR       2       /* terminate on xrun */ 
     50 
     51#if BYTE_ORDER == BIG_ENDIAN && !defined(ROAR_TARGET_WIN32) 
     52#define SIO_LE_NATIVE   0 
     53#else 
     54#if BYTE_ORDER == LITTLE_ENDIAN 
     55#define SIO_LE_NATIVE   1 
     56#else 
     57#error Byte Order of this system is not supported within the sndio interface. 
     58#endif 
     59#endif 
     60 
     61#define SIO_BPS(bits) (((bits)/8) + ((bits) % 8 ? 1 : 0)) 
     62 
     63struct sio_par { 
     64 unsigned bits;          /* bits per sample */ 
     65 unsigned bps;           /* bytes per sample */ 
     66 unsigned sig;           /* 1 = signed, 0 = unsigned */ 
     67 unsigned le;            /* 1 = LE, 0 = BE byte order */ 
     68 unsigned msb;           /* 1 = MSB, 0 = LSB aligned */ 
     69 unsigned rchan;         /* number channels for recording */ 
     70 unsigned pchan;         /* number channels for playback */ 
     71 unsigned rate;          /* frames per second */ 
     72 unsigned appbufsz;      /* minimum buffer size without xruns */ 
     73 unsigned bufsz;         /* end-to-end buffer size (read-only) */ 
     74 unsigned round;         /* optimal buffer size divisor */ 
     75 unsigned xrun;          /* what to do on overrun/underrun */ 
     76}; 
     77 
     78struct sio_hdl { 
     79 int              fh; 
     80 struct sio_par   para; 
     81 void           (*on_move)(void * arg, int delta); 
     82 void           * on_move_arg; 
     83 void           (*on_vol )(void * arg, unsigned vol); 
     84 void           * on_vol_arg; 
     85}; 
     86 
     87struct sio_hdl * sio_open(char * name, unsigned mode, int nbio_flag); 
     88void   sio_close  (struct sio_hdl * hdl); 
     89 
     90void   sio_initpar(struct sio_par * par); 
     91int    sio_setpar (struct sio_hdl * hdl, struct sio_par * par); 
     92int    sio_getpar (struct sio_hdl * hdl, struct sio_par * par); 
     93 
     94int    sio_getcap (struct sio_hdl * hdl, struct sio_cap * cap); 
     95 
     96int    sio_start  (struct sio_hdl * hdl); 
     97int    sio_stop   (struct sio_hdl * hdl); 
     98 
     99size_t sio_read   (struct sio_hdl * hdl, void * addr, size_t nbytes); 
     100size_t sio_write  (struct sio_hdl * hdl, void * addr, size_t nbytes); 
     101 
     102void   sio_onmove (struct sio_hdl * hdl, void (*cb)(void * arg, int delta), void * arg); 
     103 
     104int    sio_nfds   (struct sio_hdl * hdl); 
     105 
     106int    sio_pollfd (struct sio_hdl * hdl, struct pollfd * pfd, int events); 
     107 
     108int    sio_revents(struct sio_hdl * hdl, struct pollfd * pfd); 
     109 
     110int    sio_eof    (struct sio_hdl * hdl); 
     111 
     112int    sio_setvol (struct sio_hdl * hdl, unsigned vol); 
     113void   sio_onvol  (struct sio_hdl * hdl, void (*cb)(void * arg, unsigned vol), void * arg); 
     114 
    38115#endif 
    39116 
Note: See TracChangeset for help on using the changeset viewer.