mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-10-29 05:40:25 -04:00 
			
		
		
		
	Another API cleanups.
Added setup functions for rawmidi and timer interfaces.
This commit is contained in:
		
							parent
							
								
									40fd003a4d
								
							
						
					
					
						commit
						986c1500d2
					
				
					 4 changed files with 25 additions and 0 deletions
				
			
		|  | @ -24,6 +24,7 @@ int snd_rawmidi_file_descriptor(snd_rawmidi_t *handle); | ||||||
| int snd_rawmidi_block_mode(snd_rawmidi_t *handle, int enable); | int snd_rawmidi_block_mode(snd_rawmidi_t *handle, int enable); | ||||||
| int snd_rawmidi_info(snd_rawmidi_t *handle, snd_rawmidi_info_t * info); | int snd_rawmidi_info(snd_rawmidi_t *handle, snd_rawmidi_info_t * info); | ||||||
| int snd_rawmidi_channel_params(snd_rawmidi_t *handle, snd_rawmidi_params_t * params); | int snd_rawmidi_channel_params(snd_rawmidi_t *handle, snd_rawmidi_params_t * params); | ||||||
|  | int snd_rawmidi_channel_setup(snd_rawmidi_t *handle, snd_rawmidi_setup_t * setup); | ||||||
| int snd_rawmidi_channel_status(snd_rawmidi_t *handle, snd_rawmidi_status_t * status); | int snd_rawmidi_channel_status(snd_rawmidi_t *handle, snd_rawmidi_status_t * status); | ||||||
| int snd_rawmidi_output_drain(snd_rawmidi_t *handle); | int snd_rawmidi_output_drain(snd_rawmidi_t *handle); | ||||||
| int snd_rawmidi_output_flush(snd_rawmidi_t *handle); | int snd_rawmidi_output_flush(snd_rawmidi_t *handle); | ||||||
|  |  | ||||||
|  | @ -18,6 +18,7 @@ int snd_timer_general_info(snd_timer_t *handle, snd_timer_general_info_t * info) | ||||||
| int snd_timer_select(snd_timer_t *handle, snd_timer_select_t *tselect); | int snd_timer_select(snd_timer_t *handle, snd_timer_select_t *tselect); | ||||||
| int snd_timer_info(snd_timer_t *handle, snd_timer_info_t *timer); | int snd_timer_info(snd_timer_t *handle, snd_timer_info_t *timer); | ||||||
| int snd_timer_params(snd_timer_t *handle, snd_timer_params_t *params); | int snd_timer_params(snd_timer_t *handle, snd_timer_params_t *params); | ||||||
|  | int snd_timer_setup(snd_timer_t *handle, snd_timer_setup_t *setup); | ||||||
| int snd_timer_status(snd_timer_t *handle, snd_timer_status_t *status); | int snd_timer_status(snd_timer_t *handle, snd_timer_status_t *status); | ||||||
| int snd_timer_start(snd_timer_t *handle); | int snd_timer_start(snd_timer_t *handle); | ||||||
| int snd_timer_stop(snd_timer_t *handle); | int snd_timer_stop(snd_timer_t *handle); | ||||||
|  |  | ||||||
|  | @ -133,6 +133,17 @@ int snd_rawmidi_channel_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * para | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | int snd_rawmidi_channel_setup(snd_rawmidi_t *rmidi, snd_rawmidi_setup_t * setup) | ||||||
|  | { | ||||||
|  | 	if (!rmidi || !setup) | ||||||
|  | 		return -EINVAL; | ||||||
|  | 	if (setup->channel < 0 || setup->channel > 1) | ||||||
|  | 		return -EINVAL; | ||||||
|  | 	if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_CHANNEL_SETUP, setup) < 0) | ||||||
|  | 		return -errno; | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| int snd_rawmidi_channel_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status) | int snd_rawmidi_channel_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status) | ||||||
| { | { | ||||||
| 	if (!rmidi || !status) | 	if (!rmidi || !status) | ||||||
|  |  | ||||||
|  | @ -136,6 +136,18 @@ int snd_timer_params(snd_timer_t *handle, snd_timer_params_t * params) | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | int snd_timer_setup(snd_timer_t *handle, snd_timer_setup_t * setup) | ||||||
|  | { | ||||||
|  | 	snd_timer_t *tmr; | ||||||
|  | 
 | ||||||
|  | 	tmr = handle; | ||||||
|  | 	if (!tmr || !setup) | ||||||
|  | 		return -EINVAL; | ||||||
|  | 	if (ioctl(tmr->fd, SND_TIMER_IOCTL_SETUP, setup) < 0) | ||||||
|  | 		return -errno; | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| int snd_timer_status(snd_timer_t *handle, snd_timer_status_t * status) | int snd_timer_status(snd_timer_t *handle, snd_timer_status_t * status) | ||||||
| { | { | ||||||
| 	snd_timer_t *tmr; | 	snd_timer_t *tmr; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jaroslav Kysela
						Jaroslav Kysela