Changeset 17:411717cefded in roaraudio for roard/req.c
- Timestamp:
- 06/19/08 22:51:13 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/req.c
r0 r17 222 222 223 223 int req_on_kick (int client, struct roar_message * mes, char * data) { 224 uint16_t * info = mes->data;224 uint16_t * info = (uint16_t *) mes->data; 225 225 226 226 if ( mes->datalen != 4 ) … … 241 241 } 242 242 243 int req_on_set_vol (int client, struct roar_message * mes, char * data) { 244 uint16_t * info = (uint16_t *) mes->data; 245 int stream; 246 struct roar_stream_server * s; 247 int i; 248 int chans; 249 250 ROAR_DBG("req_on_set_vol(*) = ?"); 251 ROAR_DBG("req_on_set_vol(*): mes->datalen=%i", mes->datalen); 252 253 if ( mes->datalen < (4*2) ) 254 return -1; 255 256 if ( info[0] != 0 ) // version 257 return -1; 258 259 stream = info[1]; 260 ROAR_DBG("req_on_set_vol(*): stream=%i", stream); 261 262 // TODO: change this code. 263 // we should not directly change the stream object but use some stream_*()-func 264 // for that job. 265 266 if ( stream < 0 || stream >= ROAR_STREAMS_MAX ) 267 return -1; 268 269 s = g_streams[stream]; 270 271 if ( s == NULL ) 272 return -1; 273 274 ROAR_DBG("req_on_set_vol(*): s=%p", s); 275 276 if ( info[2] == ROAR_SET_VOL_ALL ) { 277 chans = (mes->datalen/2) - 3; 278 ROAR_DBG("req_on_set_vol(*): mode is ROAR_SET_VOL_ALL, channes=%i", chans); 279 280 if ( chans >= ROAR_MAX_CHANNELS ) 281 return -1; 282 283 for (i = 0; i < chans; i++) { 284 s->mixer.mixer[i] = info[i+3]; 285 ROAR_DBG("req_on_set_vol(*): channel %i: %i", i, info[i+3]); 286 } 287 288 ROAR_DBG("req_on_set_vol(*): mixer changed!"); 289 290 } else if ( info[2] == ROAR_SET_VOL_ONE ) { 291 ROAR_DBG("req_on_set_vol(*): mode is ROAR_SET_VOL_ONE"); 292 if ( info[3] >= ROAR_MAX_CHANNELS ) 293 return -1; 294 295 s->mixer.mixer[info[3]] = info[4]; 296 } else { 297 return -1; 298 } 299 300 mes->cmd = ROAR_CMD_OK; 301 mes->datalen = 0; 302 303 return 0; 304 } 243 305 244 306 int req_on_add_data (int client, struct roar_message * mes, char * data) {
Note: See TracChangeset
for help on using the changeset viewer.