Changeset 17:411717cefded in roaraudio for roard


Ignore:
Timestamp:
06/19/08 22:51:13 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

now we can change the volume, but it will not work if you set it... haha...

Location:
roard
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • roard/commands.c

    r0 r17  
    2222  {ROAR_CMD_GET_STREAM,   "GET_STREAM",   req_on_get_stream}, 
    2323  {ROAR_CMD_KICK,         "KICK",         req_on_kick}, 
     24  {ROAR_CMD_SET_VOL,      "SET_VOL",      req_on_set_vol}, 
    2425 
    2526  {ROAR_CMD_ADD_DATA,     "ADD_DATA",     req_on_add_data}, 
  • roard/include/req.h

    r0 r17  
    3131int req_on_kick        (int client, struct roar_message * mes, char * data); 
    3232 
     33int req_on_set_vol     (int client, struct roar_message * mes, char * data); 
     34 
    3335int req_on_add_data    (int client, struct roar_message * mes, char * data); 
    3436 
  • roard/mixer.c

    r16 r17  
    118118 
    119119int change_vol_8bit (void * output, void * input, int samples, int channels, struct roar_mixer_settings * set) { 
    120  char * in = input, out = output; 
     120 char * in = input, * out = output; 
    121121 int    i; 
    122122 int    s; 
     
    136136 
    137137int change_vol_16bit (void * output, void * input, int samples, int channels, struct roar_mixer_settings * set) { 
    138  int16_t * in = input, out = output; 
     138 int16_t * in = input, * out = output; 
    139139 int       i; 
    140140 int       s; 
  • roard/req.c

    r0 r17  
    222222 
    223223int 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; 
    225225 
    226226 if ( mes->datalen != 4 ) 
     
    241241} 
    242242 
     243int 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} 
    243305 
    244306int req_on_add_data (int client, struct roar_message * mes, char * data) { 
  • roard/streams.c

    r16 r17  
    312312  } 
    313313 
     314  if ( change_vol(rest, info->bits, rest, 8*outlen / info->bits, info->channels, &(((struct roar_stream_server*)g_streams[id])->mixer)) == -1 ) 
     315   return -1; 
     316 
    314317  // we habe outlen bytes more... 
    315318  todo    -= outlen; 
Note: See TracChangeset for help on using the changeset viewer.