Changeset 17:411717cefded in roaraudio
- Timestamp:
- 06/19/08 22:51:13 (16 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
TODO
r16 r17 6 6 * add a lot other things 7 7 * add code to handle streams with more than ROAR_MAX_CHANNELS channels 8 * fix byte-order bug in *_set_vol() and *_kick() 9 * get the volume changing code working -
include/libroar/ctl.h
r0 r17 30 30 int roar_kick (struct roar_connection * con, int type, int id); 31 31 32 int roar_set_vol (struct roar_connection * con, int id, struct roar_mixer_settings * mixer, int channels); 33 32 34 // filter... 33 35 int roar_ctl_f2m (struct roar_message * m, unsigned char filter, unsigned char cmp, uint32_t id); -
include/roaraudio/audio.h
r16 r17 57 57 #define ROAR_MAX_CHANNELS 64 58 58 59 #define ROAR_SET_VOL_ALL 1 60 #define ROAR_SET_VOL_ONE 2 61 59 62 struct roar_audio_info { 60 63 unsigned int rate; … … 65 68 66 69 struct roar_mixer_settings { 67 unsigned channels;70 //unsigned channels; 68 71 roar_intm16 scale; 69 72 roar_intm16 mixer[ROAR_MAX_CHANNELS]; -
include/roaraudio/proto.h
r0 r17 33 33 #define ROAR_CMD_KICK 18 34 34 35 #define ROAR_CMD_SET_VOL 19 35 36 36 37 #define ROAR_CMD_OK 254 -
libroar/ctl.c
r0 r17 117 117 int roar_kick (struct roar_connection * con, int type, int id) { 118 118 struct roar_message m; 119 uint16_t * info = m.data;119 uint16_t * info = (uint16_t *) m.data; 120 120 121 121 m.cmd = ROAR_CMD_KICK; … … 123 123 info[0] = type; 124 124 info[1] = id; 125 126 if ( roar_req(con, &m, NULL) == -1 ) 127 return -1; 128 129 if ( m.cmd != ROAR_CMD_OK ) 130 return -1; 131 132 return 0; 133 } 134 135 int roar_set_vol (struct roar_connection * con, int id, struct roar_mixer_settings * mixer, int channels) { 136 struct roar_message m; 137 uint16_t * info = (uint16_t *) m.data; 138 int i; 139 140 m.cmd = ROAR_CMD_SET_VOL; 141 m.datalen = (3 + channels) * 2; 142 info[0] = 0; 143 info[1] = id; 144 info[2] = ROAR_SET_VOL_ALL; 145 146 for (i = 0; i < channels; i++) 147 info[i+3] = mixer->mixer[i]; 125 148 126 149 if ( roar_req(con, &m, NULL) == -1 ) … … 261 284 262 285 strncpy(c->name, (m->data)+cur+1, m->data[cur]); 263 c->name[ m->data[cur]] = 0;286 c->name[(int)m->data[cur]] = 0; 264 287 265 288 return 0; -
libroaresd/esdctl.c
r0 r17 277 277 int esd_set_stream_pan( int esd, int stream_id, 278 278 int left_scale, int right_scale ) { 279 return -1; 279 struct roar_connection con; 280 struct roar_mixer_settings mixer; 281 282 con.fh = esd; 283 284 mixer.mixer[0] = left_scale; 285 mixer.mixer[1] = right_scale; 286 287 ROAR_DBG("esd_set_stream_pan(esd=%i, stream_id=%i, left_scale=%i, right_scale=%i) = ?", 288 esd, stream_id, left_scale, right_scale); 289 290 return roar_set_vol(&con, stream_id, &mixer, 2); 280 291 } 281 292 -
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.