Changeset 540
- Timestamp:
- 08/21/07 08:10:16 (16 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/echoaudio/tests/streaming/testmidistreaming1.c
r524 r540 128 128 129 129 int encode_midi_bytes(ffado_midi_port_t *port, unsigned char *byte_buff, int len) { 130 return 0; 130 static int cnt=0; 131 cnt++; 132 if (cnt>64) { 133 *byte_buff=0xFF; 134 return 1; 135 } 136 return 0; 131 137 } 132 138 … … 134 140 { 135 141 136 #define PERIOD_SIZE 512142 #define PERIOD_SIZE 1024 137 143 138 144 int samplesread=0, sampleswritten=0; … … 159 165 ffado_options_t dev_options; 160 166 161 dev_options.sample_rate= -1; // -1 = detect from discovery167 dev_options.sample_rate=48000; // -1 = detect from discovery 162 168 dev_options.period_size=PERIOD_SIZE; 163 169 164 170 dev_options.nb_buffers=3; 165 171 166 dev_options.port= 1;172 dev_options.port=0; 167 173 dev_options.node_id=-1; 168 174 169 175 dev_options.realtime=0; 170 176 dev_options.packetizer_priority=60; 177 178 dev_options.directions=0; 171 179 172 180 dev_options.verbose=5; … … 353 361 354 362 // start the streaming layer 363 ffado_streaming_prepare(dev); 355 364 start_flag = ffado_streaming_start(dev); 356 365 … … 384 393 break; 385 394 case ffado_stream_type_midi: 386 samplesread=ffado_streaming_read(dev, i, audiobuffers_in[i], PERIOD_SIZE);395 samplesread=ffado_streaming_read(dev, i, audiobuffers_in[i], 64); 387 396 quadlet_t *buff=(quadlet_t *)audiobuffers_in[i]; 397 if (samplesread) printf("RECV (CH %02X): ", i); 388 398 for (s=0;s<samplesread;s++) { 389 399 quadlet_t *byte=(buff+s) ; 390 //printf("%08X ",*byte);400 printf("%08X ",*byte); 391 401 decode_midi_byte (midi_in_portmap[i], (*byte) & 0xFF); 392 402 } 403 if (samplesread) printf("\n"); 393 404 if(samplesread>0) { 394 405 fprintf(fid_in[i], "---- Period read (%d samples) ----\n",samplesread); … … 425 436 426 437 sampleswritten=encode_midi_bytes(midi_out_portmap[i], byte_buff, max_midi_bytes_to_write); 427 438 if (sampleswritten) printf("SEND (CH %02X): ", i); 428 439 for(b=0;b<sampleswritten;b++) { 429 440 ffado_sample_t tmp_event=*(byte_buff+b); 441 printf("%08X ",*(byte_buff+b)); 430 442 ffado_streaming_write(dev, i, &tmp_event, 1); 431 443 } 432 433 444 if (sampleswritten) printf("\n"); 445 434 446 fprintf(fid_out[i], "---- Period write (%d samples) ----\n",sampleswritten); 435 447 hexDumpToFile(fid_out[i],(unsigned char*)buff,sampleswritten*sizeof(ffado_sample_t));