mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	Updates for the control interface...
This commit is contained in:
		
							parent
							
								
									d00535cc1b
								
							
						
					
					
						commit
						227fe9d226
					
				
					 4 changed files with 19 additions and 2 deletions
				
			
		| 
						 | 
					@ -38,6 +38,7 @@ int snd_ctl_hw_info(snd_ctl_t *handle, struct snd_ctl_hw_info *info);
 | 
				
			||||||
int snd_ctl_switch_list(snd_ctl_t *handle, snd_switch_list_t * list);
 | 
					int snd_ctl_switch_list(snd_ctl_t *handle, snd_switch_list_t * list);
 | 
				
			||||||
int snd_ctl_switch_read(snd_ctl_t *handle, snd_switch_t * sw);
 | 
					int snd_ctl_switch_read(snd_ctl_t *handle, snd_switch_t * sw);
 | 
				
			||||||
int snd_ctl_switch_write(snd_ctl_t *handle, snd_switch_t * sw);
 | 
					int snd_ctl_switch_write(snd_ctl_t *handle, snd_switch_t * sw);
 | 
				
			||||||
 | 
					int snd_ctl_hwdep_info(snd_ctl_t *handle, int dev, snd_hwdep_info_t * info);
 | 
				
			||||||
int snd_ctl_pcm_info(snd_ctl_t *handle, int dev, snd_pcm_info_t * info);
 | 
					int snd_ctl_pcm_info(snd_ctl_t *handle, int dev, snd_pcm_info_t * info);
 | 
				
			||||||
int snd_ctl_pcm_playback_info(snd_ctl_t *handle, int dev, snd_pcm_playback_info_t * info);
 | 
					int snd_ctl_pcm_playback_info(snd_ctl_t *handle, int dev, snd_pcm_playback_info_t * info);
 | 
				
			||||||
int snd_ctl_pcm_capture_info(snd_ctl_t *handle, int dev, snd_pcm_capture_info_t * info);
 | 
					int snd_ctl_pcm_capture_info(snd_ctl_t *handle, int dev, snd_pcm_capture_info_t * info);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,7 @@ libasound_la_SOURCES = error.c
 | 
				
			||||||
libasound_la_LIBADD = control/libcontrol.la mixer/libmixer.la pcm/libpcm.la \
 | 
					libasound_la_LIBADD = control/libcontrol.la mixer/libmixer.la pcm/libpcm.la \
 | 
				
			||||||
                      rawmidi/librawmidi.la timer/libtimer.la seq/libseq.la \
 | 
					                      rawmidi/librawmidi.la timer/libtimer.la seq/libseq.la \
 | 
				
			||||||
		      instr/libinstr.la
 | 
							      instr/libinstr.la
 | 
				
			||||||
libasound_la_LDFLAGS = -version-info 3:1:3
 | 
					libasound_la_LDFLAGS = -version-info 4:0:4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
control/libcontrol.la:
 | 
					control/libcontrol.la:
 | 
				
			||||||
	$(MAKE) -C control libcontrol.la
 | 
						$(MAKE) -C control libcontrol.la
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,7 @@
 | 
				
			||||||
#include "asoundlib.h"
 | 
					#include "asoundlib.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SND_FILE_CONTROL	"/dev/snd/controlC%i"
 | 
					#define SND_FILE_CONTROL	"/dev/snd/controlC%i"
 | 
				
			||||||
#define SND_CTL_VERSION_MAX	SND_PROTOCOL_VERSION( 1, 0, 0 )
 | 
					#define SND_CTL_VERSION_MAX	SND_PROTOCOL_VERSION(2, 0, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct snd_ctl {
 | 
					struct snd_ctl {
 | 
				
			||||||
	int card;
 | 
						int card;
 | 
				
			||||||
| 
						 | 
					@ -143,6 +143,20 @@ int snd_ctl_switch_write(snd_ctl_t *handle, snd_switch_t *sw)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int snd_ctl_hwdep_info(snd_ctl_t *handle, int dev, snd_hwdep_info_t * info)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						snd_ctl_t *ctl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ctl = handle;
 | 
				
			||||||
 | 
						if (!ctl || !info || dev < 0)
 | 
				
			||||||
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
						if (ioctl(ctl->fd, SND_CTL_IOCTL_HWDEP_DEVICE, &dev) < 0)
 | 
				
			||||||
 | 
							return -errno;
 | 
				
			||||||
 | 
						if (ioctl(ctl->fd, SND_CTL_IOCTL_HWDEP_INFO, info) < 0)
 | 
				
			||||||
 | 
							return -errno;
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int snd_ctl_pcm_info(snd_ctl_t *handle, int dev, snd_pcm_info_t * info)
 | 
					int snd_ctl_pcm_info(snd_ctl_t *handle, int dev, snd_pcm_info_t * info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	snd_ctl_t *ctl;
 | 
						snd_ctl_t *ctl;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,6 +47,8 @@ int main(void)
 | 
				
			||||||
			printf("  flags - 0x%x\n", pcminfo.flags);
 | 
								printf("  flags - 0x%x\n", pcminfo.flags);
 | 
				
			||||||
			printf("  id - '%s'\n", pcminfo.id);
 | 
								printf("  id - '%s'\n", pcminfo.id);
 | 
				
			||||||
			printf("  name - '%s'\n", pcminfo.name);
 | 
								printf("  name - '%s'\n", pcminfo.name);
 | 
				
			||||||
 | 
								printf("  playback - %i\n", pcminfo.playback);
 | 
				
			||||||
 | 
								printf("  capture - %i\n", pcminfo.capture);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		for (idx1 = 0; idx1 < info.mixerdevs; idx1++) {
 | 
							for (idx1 = 0; idx1 < info.mixerdevs; idx1++) {
 | 
				
			||||||
			printf("MIXER info, device #%i:\n", idx1);
 | 
								printf("MIXER info, device #%i:\n", idx1);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue