Changeset 17:411717cefded in roaraudio for roard
- Timestamp:
- 06/19/08 22:51:13 (16 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/commands.c
r0 r17 22 22 {ROAR_CMD_GET_STREAM, "GET_STREAM", req_on_get_stream}, 23 23 {ROAR_CMD_KICK, "KICK", req_on_kick}, 24 {ROAR_CMD_SET_VOL, "SET_VOL", req_on_set_vol}, 24 25 25 26 {ROAR_CMD_ADD_DATA, "ADD_DATA", req_on_add_data}, -
roard/include/req.h
r0 r17 31 31 int req_on_kick (int client, struct roar_message * mes, char * data); 32 32 33 int req_on_set_vol (int client, struct roar_message * mes, char * data); 34 33 35 int req_on_add_data (int client, struct roar_message * mes, char * data); 34 36 -
roard/mixer.c
r16 r17 118 118 119 119 int 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; 121 121 int i; 122 122 int s; … … 136 136 137 137 int 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; 139 139 int i; 140 140 int s; -
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) { -
roard/streams.c
r16 r17 312 312 } 313 313 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 314 317 // we habe outlen bytes more... 315 318 todo -= outlen;
Note: See TracChangeset
for help on using the changeset viewer.