Changeset 23:ef529a9bb70f in roaraudio


Ignore:
Timestamp:
06/21/08 13:30:04 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added req_on_get_vol()

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/commands.c

    r17 r23  
    2323  {ROAR_CMD_KICK,         "KICK",         req_on_kick}, 
    2424  {ROAR_CMD_SET_VOL,      "SET_VOL",      req_on_set_vol}, 
     25  {ROAR_CMD_GET_VOL,      "GET_VOL",      req_on_get_vol}, 
    2526 
    2627  {ROAR_CMD_ADD_DATA,     "ADD_DATA",     req_on_add_data}, 
  • roard/req.c

    r18 r23  
    306306} 
    307307 
     308int req_on_get_vol (int client, struct roar_message * mes, char * data) { 
     309 uint16_t * info = (uint16_t *) mes->data; 
     310 int stream; 
     311 struct roar_stream_server * s; 
     312 int i; 
     313 int chans; 
     314 
     315 ROAR_DBG("req_on_get_vol(*) = ?"); 
     316 ROAR_DBG("req_on_get_vol(*): mes->datalen=%i", mes->datalen); 
     317 
     318 if ( mes->datalen < (2*2) ) 
     319  return -1; 
     320 
     321 if ( info[0] != 0 ) // version 
     322  return -1; 
     323 
     324 stream = info[1]; 
     325 ROAR_DBG("req_on_get_vol(*): stream=%i", stream); 
     326 
     327 // TODO: change this code. 
     328 //       we should not directly change the stream object but use some stream_*()-func 
     329 //       for that job. 
     330 
     331 if ( stream < 0 || stream >= ROAR_STREAMS_MAX ) 
     332  return -1; 
     333 
     334 s = g_streams[stream]; 
     335 
     336 if ( s == NULL ) 
     337  return -1; 
     338 
     339 ROAR_DBG("req_on_get_vol(*): s=%p", s); 
     340 
     341 // ok, we have everything 
     342 
     343 info[0] = 0; 
     344 info[1] = chans = ROAR_STREAM(s)->info.channels; 
     345 
     346 for (i = 0; i < chans; i++) 
     347  info[2+i] = s->mixer.mixer[i]; 
     348 
     349 mes->datalen = (2 + chans)*2; 
     350 mes->cmd = ROAR_CMD_OK; 
     351 
     352 return 0; 
     353} 
     354 
    308355int req_on_add_data (int client, struct roar_message * mes, char * data) { 
    309356 struct roar_buffer * b; 
Note: See TracChangeset for help on using the changeset viewer.