Changeset 4969:d0b8acb5121f in roaraudio for libroarsndio
- Timestamp:
- 05/16/11 12:11:55 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroarsndio/libroarsndio.c
r4708 r4969 71 71 } 72 72 73 if ( (optsoffset = strstr(unitoffset, ".")) != NULL ) { 73 if ( (optsoffset = strstr(unitoffset, "/")) != NULL ) { 74 *optsoffset = 0; 75 return unitoffset; 76 } else if ( (optsoffset = strstr(unitoffset, ".")) != NULL ) { 74 77 // TODO: add some code to strip the options of the end 75 78 return name; … … 103 106 struct sio_hdl * hdl = NULL; 104 107 int is_midi = 0; 108 char * tmp; 105 109 106 110 if ( (hdl = roar_mm_malloc(sizeof(struct sio_hdl))) == NULL ) … … 108 112 109 113 memset(hdl, 0, sizeof(struct sio_hdl)); 114 hdl->device = NULL; 110 115 111 116 switch (mode) { … … 113 118 hdl->dir = ROAR_DIR_PLAY; 114 119 break; 120 case SIO_REC: 121 hdl->dir = ROAR_DIR_PLAY; 122 break; 115 123 case MIO_OUT: 116 124 is_midi = 1; … … 123 131 124 132 // unsupported: 125 case SIO_REC:126 133 case SIO_PLAY|SIO_REC: 127 134 case MIO_OUT|MIO_IN: … … 141 148 } 142 149 143 name = sndio_to_roar_names((char*) name); 144 145 if ( roar_simple_connect(&(hdl->con), (char*) name, "libroarsndio") == -1 ) { 150 if ( name != NULL ) { 151 tmp = roar_mm_strdup(name); 152 name = sndio_to_roar_names(tmp); 153 154 if ( name != NULL ) 155 hdl->device = roar_mm_strdup(name); 156 157 roar_mm_free(tmp); 158 } 159 160 if ( roar_simple_connect(&(hdl->con), hdl->device, "libroarsndio") == -1 ) { 161 roar_mm_free(hdl->device); 146 162 roar_mm_free(hdl); 147 163 return NULL; … … 151 167 152 168 hdl->stream_opened = 0; 153 154 if ( name != NULL )155 hdl->device = strdup(name);156 169 157 170 if ( is_midi ) { … … 179 192 roar_disconnect(&(hdl->con)); 180 193 194 if ( hdl->device != NULL ) 195 roar_mm_free(hdl->device); 181 196 roar_mm_free(hdl); 182 197 }
Note: See TracChangeset
for help on using the changeset viewer.