Changeset 1560:c7f40b469c33 in roaraudio for libroarsndio


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

wrote some basic calls

Location:
libroarsndio
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libroarsndio/Makefile

    r1557 r1560  
    22 
    33TARGETS=libroarsndio.so 
    4 OBJS=libroarsndio.o 
     4OBJS=libroarsndio.o para.o stream.o events.o volume.o 
    55 
    66#DEFINES        = -DDEBUG 
  • libroarsndio/libroarsndio.c

    r1555 r1560  
    3333#include "libroarsndio.h" 
    3434 
     35struct sio_hdl * sio_open(char * name, unsigned mode, int nbio_flag) { 
     36 struct sio_hdl * hdl = NULL; 
     37 
     38 if ( mode != SIO_PLAY ) /* currently we only support playback */ 
     39  return NULL; 
     40 
     41 if ( (hdl = malloc(sizeof(struct sio_hdl))) == NULL ) 
     42  return NULL; 
     43 
     44 memset(hdl, 0, sizeof(struct sio_hdl)); 
     45 
     46 sio_initpar(&(hdl->para)); 
     47 
     48 hdl->fh = -1; 
     49 
     50 if ( name != NULL ) 
     51  hdl->device = strdup(name); 
     52 
     53 return hdl; 
     54} 
     55 
     56void   sio_close  (struct sio_hdl * hdl) { 
     57 if ( hdl == NULL ) 
     58  return; 
     59 
     60 if ( hdl->fh == -1 ) 
     61  close(hdl->fh); 
     62 
     63 free(hdl); 
     64} 
     65 
     66int    sio_eof    (struct sio_hdl * hdl) { 
     67 return 0; 
     68} 
     69 
     70void   sio_onmove (struct sio_hdl * hdl, void (*cb)(void * arg, int delta), void * arg) { 
     71 if ( hdl == NULL ) 
     72  return; 
     73 
     74 hdl->on_move     = cb; 
     75 hdl->on_move_arg = arg; 
     76} 
     77 
     78void   sio_onvol  (struct sio_hdl * hdl, void (*cb)(void * arg, unsigned vol), void * arg) { 
     79 if ( hdl == NULL ) 
     80  return; 
     81 
     82 hdl->on_vol     = cb; 
     83 hdl->on_vol_arg = arg; 
     84} 
     85 
    3586//ll 
Note: See TracChangeset for help on using the changeset viewer.