Subversion Repositories svnkaklik

Rev

Rev 545 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 545 Rev 548
Line 374... Line 374...
374
	if (err < 0) {
374
	if (err < 0) {
375
		printf("Unable to register async handler\n");
375
		printf("Unable to register async handler\n");
376
		exit(EXIT_FAILURE);
376
		exit(EXIT_FAILURE);
377
	}
377
	}
378
 
378
 
-
 
379
        snd_pcm_link(capture_handle,playback_handle); //link capture and playback together
379
 
380
 
380
//start capture
381
//start sream
381
	if ((err = snd_pcm_prepare (capture_handle)) < 0) {
382
	if ((err = snd_pcm_prepare (capture_handle)) < 0) {
382
		fprintf (stderr, "cannot prepare audio interface for use (%s)\n",
383
		fprintf (stderr, "cannot prepare audio interface for use (%s)\n",
383
			 snd_strerror (err));
384
			 snd_strerror (err));
384
		exit (1);
385
		exit (1);
385
	}
386
	}
Line 387... Line 388...
387
	err = snd_pcm_start(capture_handle);
388
	err = snd_pcm_start(capture_handle);
388
	if (err < 0) {
389
	if (err < 0) {
389
			printf("Start error: %s\n", snd_strerror(err));
390
			printf("Start error: %s\n", snd_strerror(err));
390
			exit(EXIT_FAILURE);
391
			exit(EXIT_FAILURE);
391
	}
392
	}
392
 
-
 
393
 
-
 
394
//start playback
-
 
395
	if (snd_pcm_state(playback_handle) == SND_PCM_STATE_PREPARED) {
-
 
396
		err = snd_pcm_start(playback_handle);
-
 
397
		if (err < 0) {
-
 
398
			printf("Start error: %s\n", snd_strerror(err));
-
 
399
			exit(EXIT_FAILURE);
-
 
400
		}
-
 
401
	}
-
 
402
 
-
 
403
	
393
	
404
//wait until all samples aren't transmitted
394
//wait until all samples aren't transmitted
405
	printf("Waiting for transmitt all samples\n");
395
	printf("Waiting for transmitt all samples\n");
406
	while(cperiod<10) {
396
	while(cperiod<10) {
407
		sleep(1);
397
		sleep(1);
408
		printf(".");
398
		printf(".");
409
	}	
399
	}	
-
 
400
 
410
//// 
401
////   stop audio??
-
 
402
 
-
 
403
 
411
	j=0;
404
	j=0;
412
	for(i=0;i < SIGNAL_SAMPLES;i++){
405
	for(i=0;i < SIGNAL_SAMPLES;i++){
413
	  L_signal[i]=signal[j];
406
	  L_signal[i]=signal[j];
414
	  R_signal[i]=signal[j+1];
407
	  R_signal[i]=signal[j+1];
415
	  j+=2;
408
	  j+=2;