Changeset 3542:4a10d68e4c70 in roaraudio
- Timestamp:
- 02/20/10 01:28:43 (14 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/include/streams.h
r3517 r3542 52 52 #define ROAR_STREAM_CTL_TYPE_FLOAT 0x00020000 53 53 #define ROAR_STREAM_CTL_TYPE_FPI100 0x00030000 /* fix point integter int/100 */ 54 55 #define STREAM_DIR_NONE 0x00 56 #define STREAM_DIR_IN 0x01 57 #define STREAM_DIR_OUT 0x02 58 #define STREAM_DIR_BIDIR (STREAM_DIR_IN|STREAM_DIR_OUT) 54 59 55 60 struct roar_stream_server { … … 107 112 108 113 int streams_get_subsys (int id); 114 int streams_get_ssdir (int id); 109 115 110 116 int streams_new_virtual (int parent, struct roar_stream_server ** stream); … … 132 138 int streams_calc_delay (int id); 133 139 int streams_set_mixer (int id); 140 141 int streams_set_map (int id, char * map, size_t len); 134 142 135 143 int streams_ctl (int id, int_least32_t cmd, void * data); -
roard/req.c
r3539 r3542 664 664 int i; 665 665 666 if ( mes->datalen != 8)667 return -1; 668 669 for (i = 0; i < mes->datalen/2; i++) {666 if ( mes->datalen < 2*2 ) 667 return -1; 668 669 for (i = 0; i < 2; i++) { 670 670 d[i] = ROAR_NET2HOST16(d[i]); 671 671 } 672 672 673 if ( d[0] != 0 || d[1] != ROAR_STREAM_PARA_FLAGS ) { 674 ROAR_WARN("req_on_set_stream_para(*): unsupported command version: %i, %i", d[0], d[1]); 675 return -1; 676 } 677 678 mes->cmd = ROAR_CMD_OK; 679 mes->datalen = 0; 680 681 ROAR_DBG("req_on_set_stream_para(*): request seems to be valid"); 682 683 if ( d[2] == ROAR_RESET_FLAG ) { 684 return streams_reset_flag(mes->stream, d[3]); 685 } else { 686 return streams_set_flag(mes->stream, d[3]); 687 } 688 689 return -1; 673 if ( d[0] != 0 ) 674 return -1; 675 676 switch (d[1]) { 677 case ROAR_STREAM_PARA_FLAGS: 678 if ( mes->datalen != 2*4 ) 679 return -1; 680 681 d[2] = ROAR_NET2HOST16(d[2]); 682 d[3] = ROAR_NET2HOST16(d[3]); 683 684 ROAR_DBG("req_on_set_stream_para(*): request seems to be valid"); 685 686 if ( d[2] == ROAR_RESET_FLAG ) { 687 if ( streams_reset_flag(mes->stream, d[3]) == -1 ) 688 return -1; 689 } else { 690 if ( streams_set_flag(mes->stream, d[3]) == -1 ) 691 return -1; 692 } 693 break; 694 case ROAR_STREAM_PARA_CHANMAP: 695 if ( streams_set_map(mes->stream, &(mes->data[4]), mes->datalen - 4) == -1 ) 696 return -1; 697 break; 698 default: 699 ROAR_WARN("req_on_set_stream_para(*): unsupported command version: %i, %i", d[0], d[1]); 700 return -1; 701 break; 702 } 703 704 mes->cmd = ROAR_CMD_OK; 705 mes->datalen = 0; 706 707 return 0; 690 708 } 691 709 -
roard/streams.c
r3539 r3542 318 318 roardsp_chanlist_init(ss->chanmap.in, ROAR_STREAM(ss)->info.channels, ROARDSP_CHANLIST_MAP_ROARAUDIO); 319 319 roardsp_chanlist_init(ss->chanmap.out, ROAR_STREAM(ss)->info.channels, ROARDSP_CHANLIST_MAP_ROARAUDIO); 320 roardsp_chanmap_calc(&(ss->chanmap), ROARDSP_CHANMAP_MAP, 0); 320 roardsp_chanmap_calc(&(ss->chanmap), ROARDSP_CHANMAP_MAP, 0); // MAP and INVMAP are the same when in==out 321 321 break; 322 322 #ifndef ROAR_WITHOUT_DCOMP_MIDI … … 415 415 } 416 416 417 int streams_get_ssdir (int id) { 418 struct roar_stream_server * ss; 419 420 _CHECK_SID(id); 421 422 if ( (ss = g_streams[id]) == NULL ) 423 return -1; 424 425 switch (ROAR_STREAM(ss)->dir) { 426 case ROAR_DIR_PLAY: 427 case ROAR_DIR_MIDI_IN: 428 case ROAR_DIR_LIGHT_IN: 429 case ROAR_DIR_RAW_IN: 430 case ROAR_DIR_COMPLEX_IN: 431 return STREAM_DIR_IN; 432 break; 433 case ROAR_DIR_RECORD: 434 case ROAR_DIR_MONITOR: 435 case ROAR_DIR_OUTPUT: 436 case ROAR_DIR_MIDI_OUT: 437 case ROAR_DIR_LIGHT_OUT: 438 case ROAR_DIR_RAW_OUT: 439 case ROAR_DIR_COMPLEX_OUT: 440 return STREAM_DIR_OUT; 441 break; 442 case ROAR_DIR_MIXING: 443 return STREAM_DIR_NONE; 444 break; 445 case ROAR_DIR_FILTER: 446 case ROAR_DIR_BIDIR: 447 return STREAM_DIR_BIDIR; 448 break; 449 case ROAR_DIR_THRU: 450 return streams_get_ssdir(ROAR_STREAM(ss)->pos_rel_id); 451 break; 452 } 453 454 return -1; 455 } 456 417 457 #define _err() streams_delete(id); return -1; 418 458 int streams_new_virtual (int parent, struct roar_stream_server ** stream) { … … 895 935 896 936 return driver_set_volume(id, &(ss->mixer)); 937 } 938 939 int streams_set_map (int id, char * map, size_t len) { 940 struct roar_stream_server * ss; 941 int ssdir; 942 943 _CHECK_SID(id); 944 945 if ( (ss = g_streams[id]) == NULL ) 946 return -1; 947 948 ssdir = streams_get_ssdir(id); 949 if ( ssdir != STREAM_DIR_IN && ssdir != STREAM_DIR_OUT ) 950 return -1; 951 952 if ( map != NULL ) { 953 if ( ROAR_STREAM(ss)->info.channels != len ) 954 return -1; 955 956 memcpy(ss->chanmap.in, map, len); 957 } 958 959 switch (ssdir) { 960 case STREAM_DIR_IN: 961 roardsp_chanmap_calc(&(ss->chanmap), ROARDSP_CHANMAP_MAP, 0); 962 break; 963 case STREAM_DIR_OUT: 964 roardsp_chanmap_calc(&(ss->chanmap), ROARDSP_CHANMAP_INVMAP, 0); 965 break; 966 } 967 968 return 0; 897 969 } 898 970
Note: See TracChangeset
for help on using the changeset viewer.