Subversion Repositories svnkaklik

Rev

Rev 527 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 527 Rev 530
Line 268... Line 268...
268
	snd_pcm_channel_area_t *areas = data->areas;*/
268
	snd_pcm_channel_area_t *areas = data->areas;*/
269
	snd_pcm_sframes_t avail;
269
	snd_pcm_sframes_t avail;
270
	int err;
270
	int err;
271
	
271
	
272
	avail = snd_pcm_avail_update(handle);
272
	avail = snd_pcm_avail_update(handle);
273
	while ((avail >= period_size) /*&& ((period*period_size) < (CHIRP_SIZE-100))*/ ) {
273
	while ((avail >= period_size) && ((period*period_size) < (CHIRP_SIZE-100)) ) {
274
 
274
 
275
		err = snd_pcm_writei(handle, (chirp+period*period_size), period_size);
275
		err = snd_pcm_writei(handle, (chirp+period*period_size), period_size);
276
		if (err < 0) {
276
		if (err < 0) {
277
			printf("Write error: %s\n", snd_strerror(err));
277
			printf("Write error: %s\n", snd_strerror(err));
278
			exit(EXIT_FAILURE);
278
			exit(EXIT_FAILURE);
Line 357... Line 357...
357
	
357
	
358
	if ((err = set_hwparams(capture_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
358
	if ((err = set_hwparams(capture_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
359
		printf("Setting of hwparams failed: %s\n", snd_strerror(err));
359
		printf("Setting of hwparams failed: %s\n", snd_strerror(err));
360
		exit(EXIT_FAILURE);
360
		exit(EXIT_FAILURE);
361
	}
361
	}
362
/*	if ((err = set_swparams(capture_handle, swparams)) < 0) {
362
	if ((err = set_swparams(capture_handle, swparams)) < 0) {
363
		printf("Setting of swparams failed: %s\n", snd_strerror(err));
363
		printf("Setting of swparams failed: %s\n", snd_strerror(err));
364
		exit(EXIT_FAILURE);
364
		exit(EXIT_FAILURE);
365
	}*/
365
	}
366
 
366
 
367
// allocate memory for frame (package of samples)
367
// allocate memory for frame (package of samples)
368
	frame = malloc((period_size * channels * snd_pcm_format_physical_width(format)) / 8);
368
	frame = malloc((period_size * channels * snd_pcm_format_physical_width(format)) / 8);
369
	if (frame == NULL) {
369
	if (frame == NULL) {
370
		printf("No enough memory\n");
370
		printf("No enough memory\n");
Line 444... Line 444...
444
	
444
	
445
 
445
 
446
 
446
 
447
	/* because all other work is done in the signal handler,
447
	/* because all other work is done in the signal handler,
448
	   suspend the process */
448
	   suspend the process */
449
	while(cperiod<10) {
449
	while(cperiod<3) {
450
		sleep(1);
450
		sleep(1);
451
	}	
451
	}	
452
 
452
 
453
	out=fopen("./output.txt","w");
453
	out=fopen("./output.txt","w");
454
	for(i=0;i<=100000;i++) fprintf(out,"%d ",signal[i]); 
454
	for(i=0;i<=100000;i++) fprintf(out,"%d ",signal[i]);