Changeset 3143:5a5427b1a757 in roaraudio


Ignore:
Timestamp:
01/15/10 12:46:54 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

wrote _open_file(), fixed _open_session()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroaross/libroaross.c

    r3142 r3143  
    145145  if ( roar_simple_connect(&(_session.con), server, name) == -1 ) 
    146146   return NULL; 
    147  
    148   _session.refc++; 
    149  } else { 
    150   _session.refc++; 
    151   return &_session; 
    152  } 
     147 } 
     148 
     149 _session.refc++; 
     150 return &_session; 
    153151} 
    154152 
     
    242240 
    243241static int _open_file (const char *pathname, int flags) { 
    244  return -1; 
     242 struct session * session; 
     243 struct handle  * handle; 
     244 struct pointer * pointer; 
     245 struct { 
     246  char * prefix; 
     247  int type; 
     248 } * ptr = NULL, p[] = { 
     249  {"/dev/dsp", HT_STREAM}, 
     250  {NULL, HT_NONE}, 
     251 }; 
     252 int i; 
     253 
     254 for (i = 0; p[i].prefix != NULL; i++) { 
     255  if ( !strcmp(pathname, p[i].prefix) ) { 
     256   ptr = &(p[i]); 
     257  } 
     258 } 
     259 
     260 if ( ptr == NULL ) 
     261  return -2; 
     262 
     263 _os.write(1, "DOOF!\n", 6); 
     264 
     265 if ( (session = _open_session(NULL, NULL)) == NULL ) { 
     266  return -1; 
     267 } 
     268 
     269 if ( (handle = _open_handle(session)) == NULL ) { 
     270  _close_session(session); 
     271  return -1; 
     272 } 
     273 
     274 handle->type = ptr->type; 
     275 
     276 if ( (pointer = _open_pointer(handle)) == NULL ) { 
     277  _close_handle(handle); 
     278  return -1; 
     279 } 
     280 
     281 return pointer->fh; 
    245282} 
    246283 
     
    255292 
    256293 _init(); 
    257  
    258  _os.write(1, "DOOF!\n", 6); 
    259294 
    260295 ret = _open_file(pathname, flags); 
Note: See TracChangeset for help on using the changeset viewer.