mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	Fixes for new types...
This commit is contained in:
		
							parent
							
								
									3d5115b325
								
							
						
					
					
						commit
						c6d9012d55
					
				
					 13 changed files with 59 additions and 52 deletions
				
			
		| 
						 | 
					@ -27,7 +27,7 @@ stamp-vh: $(top_builddir)/configure.in
 | 
				
			||||||
	@echo "				  SND_LIB_SUBMINOR)" >> ver.tmp
 | 
						@echo "				  SND_LIB_SUBMINOR)" >> ver.tmp
 | 
				
			||||||
	@echo "#define SND_LIB_VERSION_STR	\"$(SND_LIB_VERSION)\"" >> ver.tmp
 | 
						@echo "#define SND_LIB_VERSION_STR	\"$(SND_LIB_VERSION)\"" >> ver.tmp
 | 
				
			||||||
	@echo >> ver.tmp
 | 
						@echo >> ver.tmp
 | 
				
			||||||
	@echo "/* OBSOLETE DEFINES WHICH WILLN'T BE IN 0.3.0 FINAL!!! */" >> ver.tmp
 | 
						@echo "/* OBSOLETE DEFINES WHICH WON'T BE IN 0.3.0 FINAL!!! */" >> ver.tmp
 | 
				
			||||||
	@echo "#define SOUNDLIB_VERSION_MAJOR		SND_LIB_MAJOR" >> ver.tmp
 | 
						@echo "#define SOUNDLIB_VERSION_MAJOR		SND_LIB_MAJOR" >> ver.tmp
 | 
				
			||||||
	@echo "#define SOUNDLIB_VERSION_MINOR		SND_LIB_MINOR" >> ver.tmp
 | 
						@echo "#define SOUNDLIB_VERSION_MINOR		SND_LIB_MINOR" >> ver.tmp
 | 
				
			||||||
	@echo "#define SOUNDLIB_VERSION_SUBMINOR	SND_LIB_SUBMINOR" >> ver.tmp
 | 
						@echo "#define SOUNDLIB_VERSION_SUBMINOR	SND_LIB_SUBMINOR" >> ver.tmp
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,20 +2,20 @@
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include "../include/asoundlib.h"
 | 
					#include "../include/asoundlib.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void main(void)
 | 
					int main(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int idx, idx1, cards, err;
 | 
						int idx, idx1, cards, err;
 | 
				
			||||||
	void *handle;
 | 
						snd_ctl_t *handle;
 | 
				
			||||||
	struct snd_ctl_hw_info info;
 | 
						struct snd_ctl_hw_info info;
 | 
				
			||||||
	snd_pcm_info_t pcminfo;
 | 
						snd_pcm_info_t pcminfo;
 | 
				
			||||||
	snd_mixer_info_t mixerinfo;
 | 
						snd_mixer_info_t mixerinfo;
 | 
				
			||||||
	char str[128];
 | 
						char str[128];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cards = snd_cards();
 | 
						cards = snd_cards();
 | 
				
			||||||
	printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
 | 
						printf("Detected %i soundcard%s...\n", cards, cards != 1 ? "s" : "");
 | 
				
			||||||
	if (cards <= 0) {
 | 
						if (cards <= 0) {
 | 
				
			||||||
		printf("Giving up...\n");
 | 
							printf("Giving up...\n");
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (idx = 0; idx < cards; idx++) {
 | 
						for (idx = 0; idx < cards; idx++) {
 | 
				
			||||||
		if ((err = snd_ctl_open(&handle, idx)) < 0) {
 | 
							if ((err = snd_ctl_open(&handle, idx)) < 0) {
 | 
				
			||||||
| 
						 | 
					@ -58,10 +58,11 @@ void main(void)
 | 
				
			||||||
			printf("  elements - %i\n", mixerinfo.elements);
 | 
								printf("  elements - %i\n", mixerinfo.elements);
 | 
				
			||||||
			printf("  groups - %i\n", mixerinfo.groups);
 | 
								printf("  groups - %i\n", mixerinfo.groups);
 | 
				
			||||||
			printf("  switches - %i\n", mixerinfo.switches);
 | 
								printf("  switches - %i\n", mixerinfo.switches);
 | 
				
			||||||
			printf("  attribute - 0x%x\n", mixerinfo.attribute);
 | 
								printf("  attrib - 0x%x\n", mixerinfo.attrib);
 | 
				
			||||||
			printf("  id - '%s'\n", mixerinfo.id);
 | 
								printf("  id - '%s'\n", mixerinfo.id);
 | 
				
			||||||
			printf("  name - '%s'\n", mixerinfo.name);
 | 
								printf("  name - '%s'\n", mixerinfo.name);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		snd_ctl_close(handle);
 | 
							snd_ctl_close(handle);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -175,9 +175,9 @@ long timediff(struct timeval t1, struct timeval t2)
 | 
				
			||||||
	return (t1.tv_sec * 1000000) + l;
 | 
						return (t1.tv_sec * 1000000) + l;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void main(void)
 | 
					int main(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	void *phandle, *rhandle;
 | 
						snd_pcm_t *phandle, *rhandle;
 | 
				
			||||||
	char buffer[4096 * 2];	/* max two fragments by 4096 bytes */
 | 
						char buffer[4096 * 2];	/* max two fragments by 4096 bytes */
 | 
				
			||||||
	int pcard = 0, pdevice = 0;
 | 
						int pcard = 0, pdevice = 0;
 | 
				
			||||||
	int rcard = 0, rdevice = 0;
 | 
						int rcard = 0, rdevice = 0;
 | 
				
			||||||
| 
						 | 
					@ -189,11 +189,11 @@ void main(void)
 | 
				
			||||||
	setscheduler();
 | 
						setscheduler();
 | 
				
			||||||
	if ((err = snd_pcm_open(&phandle, pcard, pdevice, SND_PCM_OPEN_PLAYBACK)) < 0) {
 | 
						if ((err = snd_pcm_open(&phandle, pcard, pdevice, SND_PCM_OPEN_PLAYBACK)) < 0) {
 | 
				
			||||||
		printf("Playback open error: %s\n", snd_strerror(err));
 | 
							printf("Playback open error: %s\n", snd_strerror(err));
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if ((err = snd_pcm_open(&rhandle, rcard, rdevice, SND_PCM_OPEN_RECORD)) < 0) {
 | 
						if ((err = snd_pcm_open(&rhandle, rcard, rdevice, SND_PCM_OPEN_RECORD)) < 0) {
 | 
				
			||||||
		printf("Record open error: %s\n", snd_strerror(err));
 | 
							printf("Record open error: %s\n", snd_strerror(err));
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	setformat(phandle, rhandle);
 | 
						setformat(phandle, rhandle);
 | 
				
			||||||
	while (1) {
 | 
						while (1) {
 | 
				
			||||||
| 
						 | 
					@ -231,13 +231,14 @@ void main(void)
 | 
				
			||||||
			printf("Playback OK!!!\n");
 | 
								printf("Playback OK!!!\n");
 | 
				
			||||||
			printf("Playback time = %li.%i, Record time = %li.%i, diff = %li\n",
 | 
								printf("Playback time = %li.%i, Record time = %li.%i, diff = %li\n",
 | 
				
			||||||
			       pstatus.stime.tv_sec,
 | 
								       pstatus.stime.tv_sec,
 | 
				
			||||||
			       pstatus.stime.tv_usec,
 | 
								       (int)pstatus.stime.tv_usec,
 | 
				
			||||||
			       rstatus.stime.tv_sec,
 | 
								       rstatus.stime.tv_sec,
 | 
				
			||||||
			       rstatus.stime.tv_usec,
 | 
								       (int)rstatus.stime.tv_usec,
 | 
				
			||||||
			       timediff(pstatus.stime, rstatus.stime));
 | 
								       timediff(pstatus.stime, rstatus.stime));
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	snd_pcm_close(phandle);
 | 
						snd_pcm_close(phandle);
 | 
				
			||||||
	snd_pcm_close(rhandle);
 | 
						snd_pcm_close(rhandle);
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
int main(int argc, char *argv[])
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	void *handle;
 | 
						snd_pcm_loopback_t *handle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = snd_pcm_loopback_open(&handle, 0, 0, SND_PCM_LB_OPEN_PLAYBACK);
 | 
						err = snd_pcm_loopback_open(&handle, 0, 0, SND_PCM_LB_OPEN_PLAYBACK);
 | 
				
			||||||
	if (err < 0) {
 | 
						if (err < 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										11
									
								
								test/mixer.c
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								test/mixer.c
									
										
									
									
									
								
							| 
						 | 
					@ -5,7 +5,7 @@
 | 
				
			||||||
static void mixer_test(int card, int device)
 | 
					static void mixer_test(int card, int device)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	void *handle;
 | 
						snd_mixer_t *handle;
 | 
				
			||||||
	snd_mixer_info_t info;
 | 
						snd_mixer_info_t info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((err = snd_mixer_open(&handle, card, device)) < 0) {
 | 
						if ((err = snd_mixer_open(&handle, card, device)) < 0) {
 | 
				
			||||||
| 
						 | 
					@ -22,23 +22,23 @@ static void mixer_test(int card, int device)
 | 
				
			||||||
	printf("    elements - %i\n", info.elements);
 | 
						printf("    elements - %i\n", info.elements);
 | 
				
			||||||
	printf("    groups - %i\n", info.groups);
 | 
						printf("    groups - %i\n", info.groups);
 | 
				
			||||||
	printf("    switches - %i\n", info.switches);
 | 
						printf("    switches - %i\n", info.switches);
 | 
				
			||||||
	printf("    attribute - 0x%x\n", info.attribute);
 | 
						printf("    attrib - 0x%x\n", info.attrib);
 | 
				
			||||||
	printf("    id - '%s'\n", info.id);
 | 
						printf("    id - '%s'\n", info.id);
 | 
				
			||||||
	printf("    name - '%s'\n", info.name);
 | 
						printf("    name - '%s'\n", info.name);
 | 
				
			||||||
	snd_mixer_close(handle);
 | 
						snd_mixer_close(handle);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void main(void)
 | 
					int main(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int idx, idx1, cards, err;
 | 
						int idx, idx1, cards, err;
 | 
				
			||||||
	void *handle;
 | 
						snd_ctl_t *handle;
 | 
				
			||||||
	struct snd_ctl_hw_info info;
 | 
						struct snd_ctl_hw_info info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cards = snd_cards();
 | 
						cards = snd_cards();
 | 
				
			||||||
	printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
 | 
						printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
 | 
				
			||||||
	if (cards <= 0) {
 | 
						if (cards <= 0) {
 | 
				
			||||||
		printf("Giving up...\n");
 | 
							printf("Giving up...\n");
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for (idx = 0; idx < cards; idx++) {
 | 
						for (idx = 0; idx < cards; idx++) {
 | 
				
			||||||
		if ((err = snd_ctl_open(&handle, idx)) < 0) {
 | 
							if ((err = snd_ctl_open(&handle, idx)) < 0) {
 | 
				
			||||||
| 
						 | 
					@ -53,4 +53,5 @@ void main(void)
 | 
				
			||||||
			mixer_test(idx, idx1);
 | 
								mixer_test(idx, idx1);
 | 
				
			||||||
		snd_ctl_close(handle);
 | 
							snd_ctl_close(handle);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										19
									
								
								test/pause.c
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								test/pause.c
									
										
									
									
									
								
							| 
						 | 
					@ -24,20 +24,20 @@ static void show_playback_status(void *handle)
 | 
				
			||||||
	printf("  scount = %i\n", pstatus.scount);
 | 
						printf("  scount = %i\n", pstatus.scount);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void main(void)
 | 
					int main(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int card = 0, device = 0, err, fd, count, count1, size, idx;
 | 
						int card = 0, device = 0, err, fd, count, count1, size, idx;
 | 
				
			||||||
	void *handle;
 | 
						snd_pcm_t *handle;
 | 
				
			||||||
	snd_pcm_format_t format;
 | 
						snd_pcm_format_t format;
 | 
				
			||||||
	snd_pcm_playback_status_t status;
 | 
						snd_pcm_playback_status_t status;
 | 
				
			||||||
	char *buffer, *buffer1;
 | 
						char *buffer, *buffer1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	buffer = (char *) malloc(512 * 1024);
 | 
						buffer = (char *) malloc(512 * 1024);
 | 
				
			||||||
	if (!buffer)
 | 
						if (!buffer)
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	if ((err = snd_pcm_open(&handle, card, device, SND_PCM_OPEN_PLAYBACK)) < 0) {
 | 
						if ((err = snd_pcm_open(&handle, card, device, SND_PCM_OPEN_PLAYBACK)) < 0) {
 | 
				
			||||||
		fprintf(stderr, "open failed: %s\n", snd_strerror(err));
 | 
							fprintf(stderr, "open failed: %s\n", snd_strerror(err));
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	format.format = SND_PCM_SFMT_MU_LAW;
 | 
						format.format = SND_PCM_SFMT_MU_LAW;
 | 
				
			||||||
	format.rate = 8000;
 | 
						format.rate = 8000;
 | 
				
			||||||
| 
						 | 
					@ -45,25 +45,25 @@ void main(void)
 | 
				
			||||||
	if ((err = snd_pcm_playback_format(handle, &format)) < 0) {
 | 
						if ((err = snd_pcm_playback_format(handle, &format)) < 0) {
 | 
				
			||||||
		fprintf(stderr, "format setup failed: %s\n", snd_strerror(err));
 | 
							fprintf(stderr, "format setup failed: %s\n", snd_strerror(err));
 | 
				
			||||||
		snd_pcm_close(handle);
 | 
							snd_pcm_close(handle);
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if ((err = snd_pcm_playback_status(handle, &status)) < 0) {
 | 
						if ((err = snd_pcm_playback_status(handle, &status)) < 0) {
 | 
				
			||||||
		fprintf(stderr, "status failed: %s\n", snd_strerror(err));
 | 
							fprintf(stderr, "status failed: %s\n", snd_strerror(err));
 | 
				
			||||||
		snd_pcm_close(handle);
 | 
							snd_pcm_close(handle);
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fd = open(AU_FILE, O_RDONLY);
 | 
						fd = open(AU_FILE, O_RDONLY);
 | 
				
			||||||
	if (fd < 0) {
 | 
						if (fd < 0) {
 | 
				
			||||||
		perror("open file");
 | 
							perror("open file");
 | 
				
			||||||
		snd_pcm_close(handle);
 | 
							snd_pcm_close(handle);
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	idx = 0;
 | 
						idx = 0;
 | 
				
			||||||
	count = read(fd, buffer, 512 * 1024);
 | 
						count = read(fd, buffer, 512 * 1024);
 | 
				
			||||||
	if (count <= 0) {
 | 
						if (count <= 0) {
 | 
				
			||||||
		perror("read from file");
 | 
							perror("read from file");
 | 
				
			||||||
		snd_pcm_close(handle);
 | 
							snd_pcm_close(handle);
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	close(fd);
 | 
						close(fd);
 | 
				
			||||||
	if (!memcmp(buffer, ".snd", 4)) {
 | 
						if (!memcmp(buffer, ".snd", 4)) {
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@ void main(void)
 | 
				
			||||||
	if (count < 256 * 1024) {
 | 
						if (count < 256 * 1024) {
 | 
				
			||||||
		perror("small count < 256k");
 | 
							perror("small count < 256k");
 | 
				
			||||||
		snd_pcm_close(handle);
 | 
							snd_pcm_close(handle);
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	count1 = status.fragment_size * 12;
 | 
						count1 = status.fragment_size * 12;
 | 
				
			||||||
	show_playback_status(handle);
 | 
						show_playback_status(handle);
 | 
				
			||||||
| 
						 | 
					@ -98,4 +98,5 @@ void main(void)
 | 
				
			||||||
	printf("Pause end.. Bytes written %i from %i...\n", size, count);
 | 
						printf("Pause end.. Bytes written %i from %i...\n", size, count);
 | 
				
			||||||
	snd_pcm_close(handle);
 | 
						snd_pcm_close(handle);
 | 
				
			||||||
	free(buffer);
 | 
						free(buffer);
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,7 @@ void setformat(void *phandle, void *rhandle)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void method1(void)
 | 
					void method1(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	void *phandle, *rhandle;
 | 
						snd_pcm_t *phandle, *rhandle;
 | 
				
			||||||
	char buffer[BUFFER_SIZE];
 | 
						char buffer[BUFFER_SIZE];
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,7 +66,7 @@ void method1(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void method2(void)
 | 
					void method2(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	void *phandle, *rhandle;
 | 
						snd_pcm_t *phandle, *rhandle;
 | 
				
			||||||
	char buffer[BUFFER_SIZE];
 | 
						char buffer[BUFFER_SIZE];
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -111,7 +111,7 @@ void method2(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void method3(void)
 | 
					void method3(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	void *handle;
 | 
						snd_pcm_t *handle;
 | 
				
			||||||
	char buffer[BUFFER_SIZE];
 | 
						char buffer[BUFFER_SIZE];
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -149,7 +149,7 @@ void method3(void)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void main(void)
 | 
					int main(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	printf(">>>>> METHOD 1\n");
 | 
						printf(">>>>> METHOD 1\n");
 | 
				
			||||||
	method1();
 | 
						method1();
 | 
				
			||||||
| 
						 | 
					@ -157,4 +157,5 @@ void main(void)
 | 
				
			||||||
	method2();
 | 
						method2();
 | 
				
			||||||
	printf(">>>>> METHOD 3\n");
 | 
						printf(">>>>> METHOD 3\n");
 | 
				
			||||||
	method3();
 | 
						method3();
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@
 | 
				
			||||||
#include "midifile.h"		/* SMF library header */
 | 
					#include "midifile.h"		/* SMF library header */
 | 
				
			||||||
#include "midifile.c"		/* SMF library code */
 | 
					#include "midifile.c"		/* SMF library code */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "sys/asoundlib.h"
 | 
					#include "../include/asoundlib.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//#define DEST_QUEUE_NUMBER 0
 | 
					//#define DEST_QUEUE_NUMBER 0
 | 
				
			||||||
#define DEST_QUEUE_NUMBER 7
 | 
					#define DEST_QUEUE_NUMBER 7
 | 
				
			||||||
| 
						 | 
					@ -55,7 +55,7 @@
 | 
				
			||||||
//#define USE_REALTIME
 | 
					//#define USE_REALTIME
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FILE *F;
 | 
					FILE *F;
 | 
				
			||||||
void* seq_handle = NULL;
 | 
					snd_seq_t *seq_handle = NULL;
 | 
				
			||||||
int ppq = 96;
 | 
					int ppq = 96;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
double local_secs = 0;
 | 
					double local_secs = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -399,7 +399,7 @@ int decode_event(snd_seq_event_t * ev)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void event_decoder_start_timer(void *handle, int queue, int client, int port)
 | 
					void event_decoder_start_timer(snd_seq_t *handle, int queue, int client, int port)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	snd_seq_event_t ev;
 | 
						snd_seq_event_t ev;
 | 
				
			||||||
| 
						 | 
					@ -419,7 +419,7 @@ void event_decoder_start_timer(void *handle, int queue, int client, int port)
 | 
				
			||||||
		sleep(1);
 | 
							sleep(1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void event_decoder(void *handle, int argc, char *argv[])
 | 
					void event_decoder(snd_seq_t *handle, int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	snd_seq_event_t *ev;
 | 
						snd_seq_event_t *ev;
 | 
				
			||||||
	snd_seq_port_info_t port;
 | 
						snd_seq_port_info_t port;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
 *  Simple event sender
 | 
					 *  Simple event sender
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void event_sender_start_timer(void *handle, int client, int queue)
 | 
					void event_sender_start_timer(snd_seq_t *handle, int client, int queue)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	snd_seq_event_t ev;
 | 
						snd_seq_event_t ev;
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@ void event_sender_start_timer(void *handle, int client, int queue)
 | 
				
			||||||
		sleep(1);
 | 
							sleep(1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void event_sender_filter(void *handle)
 | 
					void event_sender_filter(snd_seq_t *handle)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	snd_seq_client_info_t info;
 | 
						snd_seq_client_info_t info;
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ void event_sender_filter(void *handle)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void send_event(void *handle, int queue, int client, int port,
 | 
					void send_event(snd_seq_t *handle, int queue, int client, int port,
 | 
				
			||||||
                snd_seq_port_subscribe_t *sub, int *time)
 | 
					                snd_seq_port_subscribe_t *sub, int *time)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
| 
						 | 
					@ -68,7 +68,7 @@ void send_event(void *handle, int queue, int client, int port,
 | 
				
			||||||
		fprintf(stderr, "Event flush error: %s\n", snd_strerror(err));
 | 
							fprintf(stderr, "Event flush error: %s\n", snd_strerror(err));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void event_sender(void *handle, int argc, char *argv[])
 | 
					void event_sender(snd_seq_t *handle, int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	snd_seq_event_t *ev;
 | 
						snd_seq_event_t *ev;
 | 
				
			||||||
	snd_seq_port_info_t port;
 | 
						snd_seq_port_info_t port;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								test/seq.c
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								test/seq.c
									
										
									
									
									
								
							| 
						 | 
					@ -20,7 +20,7 @@ snd_seq_system_info_t sysinfo;
 | 
				
			||||||
int debug = 0;
 | 
					int debug = 0;
 | 
				
			||||||
int verbose = 0;
 | 
					int verbose = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void set_name(void *handle)
 | 
					void set_name(snd_seq_t *handle)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	snd_seq_client_info_t info;
 | 
						snd_seq_client_info_t info;
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,7 @@ void set_name(void *handle)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void system_info(void *handle)
 | 
					void system_info(snd_seq_t *handle)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,7 @@ void system_info(void *handle)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void show_system_info(void *handle)
 | 
					void show_system_info(snd_seq_t *handle)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	printf("System info\n");
 | 
						printf("System info\n");
 | 
				
			||||||
	printf("  Max queues    : %i\n", sysinfo.queues);
 | 
						printf("  Max queues    : %i\n", sysinfo.queues);
 | 
				
			||||||
| 
						 | 
					@ -53,7 +53,7 @@ void show_system_info(void *handle)
 | 
				
			||||||
	printf("  Max ports     : %i\n", sysinfo.ports);
 | 
						printf("  Max ports     : %i\n", sysinfo.ports);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void show_queue_status(void *handle, int queue)
 | 
					void show_queue_status(snd_seq_t *handle, int queue)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err, idx, min, max;
 | 
						int err, idx, min, max;
 | 
				
			||||||
	snd_seq_queue_status_t status;
 | 
						snd_seq_queue_status_t status;
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ void show_queue_status(void *handle, int queue)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void show_port_info(void *handle, int client, int port)
 | 
					void show_port_info(snd_seq_t *handle, int client, int port)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err, idx, min, max;
 | 
						int err, idx, min, max;
 | 
				
			||||||
	snd_seq_port_info_t info;
 | 
						snd_seq_port_info_t info;
 | 
				
			||||||
| 
						 | 
					@ -101,7 +101,7 @@ void show_port_info(void *handle, int client, int port)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void show_client_info(void *handle, int client)
 | 
					void show_client_info(snd_seq_t *handle, int client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err, idx, min, max;
 | 
						int err, idx, min, max;
 | 
				
			||||||
	snd_seq_client_info_t info;
 | 
						snd_seq_client_info_t info;
 | 
				
			||||||
| 
						 | 
					@ -142,7 +142,7 @@ static void help(void)
 | 
				
			||||||
int main(int argc, char *argv[])
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int morehelp, err, arg, arg1;
 | 
						int morehelp, err, arg, arg1;
 | 
				
			||||||
	void *handle;
 | 
						snd_seq_t *handle;
 | 
				
			||||||
	static struct option long_option[] =
 | 
						static struct option long_option[] =
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		{"help", 0, NULL, HELPID_HELP},
 | 
							{"help", 0, NULL, HELPID_HELP},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,7 @@
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
#include "../include/asoundlib.h"
 | 
					#include "../include/asoundlib.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void *ctl_handle;
 | 
					static snd_ctl_t *ctl_handle;
 | 
				
			||||||
static int sw_interface;
 | 
					static int sw_interface;
 | 
				
			||||||
static int sw_device;
 | 
					static int sw_device;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -168,7 +168,7 @@ void process(char *space, char *prefix, int interface, int device)
 | 
				
			||||||
	free(list.pswitches);
 | 
						free(list.pswitches);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void main(void)
 | 
					int main(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int cards, card, err, idx;
 | 
						int cards, card, err, idx;
 | 
				
			||||||
	snd_ctl_hw_info_t info;
 | 
						snd_ctl_hw_info_t info;
 | 
				
			||||||
| 
						 | 
					@ -177,7 +177,7 @@ void main(void)
 | 
				
			||||||
	printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
 | 
						printf("Detected %i soundcard%s...\n", cards, cards > 1 ? "s" : "");
 | 
				
			||||||
	if (cards <= 0) {
 | 
						if (cards <= 0) {
 | 
				
			||||||
		printf("Giving up...\n");
 | 
							printf("Giving up...\n");
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	/* control interface */
 | 
						/* control interface */
 | 
				
			||||||
	for (card = 0; card < cards; card++) {
 | 
						for (card = 0; card < cards; card++) {
 | 
				
			||||||
| 
						 | 
					@ -199,4 +199,5 @@ void main(void)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		snd_ctl_close(ctl_handle);
 | 
							snd_ctl_close(ctl_handle);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,13 +47,13 @@ void read_loop(void *handle, int master_ticks, int timeout)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void main(int argc, char *argv[])
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int idx, err;
 | 
						int idx, err;
 | 
				
			||||||
	int timer = SND_TIMER_SYSTEM;
 | 
						int timer = SND_TIMER_GLOBAL(SND_TIMER_GLOBAL_SYSTEM);
 | 
				
			||||||
	int slave = 0;
 | 
						int slave = 0;
 | 
				
			||||||
	int slave_type = SND_TIMER_STYPE_SEQUENCER, slave_id = 0;
 | 
						int slave_type = SND_TIMER_STYPE_SEQUENCER, slave_id = 0;
 | 
				
			||||||
	void *handle;
 | 
						snd_timer_t *handle;
 | 
				
			||||||
	snd_timer_general_info_t ginfo;
 | 
						snd_timer_general_info_t ginfo;
 | 
				
			||||||
	snd_timer_select_t sel;
 | 
						snd_timer_select_t sel;
 | 
				
			||||||
	snd_timer_info_t info;
 | 
						snd_timer_info_t info;
 | 
				
			||||||
| 
						 | 
					@ -128,4 +128,5 @@ void main(int argc, char *argv[])
 | 
				
			||||||
	read_loop(handle, 25, sel.slave ? 10000 : 1);
 | 
						read_loop(handle, 25, sel.slave ? 10000 : 1);
 | 
				
			||||||
	show_status(handle);
 | 
						show_status(handle);
 | 
				
			||||||
	snd_timer_close(handle);
 | 
						snd_timer_close(handle);
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue