mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-10-29 05:40:25 -04:00 
			
		
		
		
	Renamed samples in frames where appropriated. Added a compatibility hack for gcc 2.7.2.3
This commit is contained in:
		
							parent
							
								
									cc5730a49e
								
							
						
					
					
						commit
						9eb2c42445
					
				
					 15 changed files with 365 additions and 361 deletions
				
			
		|  | @ -130,15 +130,15 @@ ssize_t snd_pcm_mmap_write(snd_pcm_t *handle, const void *buffer, size_t size); | |||
| ssize_t snd_pcm_mmap_read(snd_pcm_t *handle, void *buffer, size_t size); | ||||
| ssize_t snd_pcm_mmap_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned long  count); | ||||
| ssize_t snd_pcm_mmap_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned long count); | ||||
| int snd_pcm_mmap_samples_used(snd_pcm_t *pcm, int channel, ssize_t *samples); | ||||
| int snd_pcm_mmap_samples_free(snd_pcm_t *pcm, int channel, ssize_t *samples); | ||||
| ssize_t snd_pcm_mmap_samples_xfer(snd_pcm_t *pcm, int channel, size_t samples); | ||||
| ssize_t snd_pcm_mmap_samples_offset(snd_pcm_t *pcm, int channel); | ||||
| int snd_pcm_mmap_commit_samples(snd_pcm_t *pcm, int channel, int samples); | ||||
| ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t samples); | ||||
| ssize_t snd_pcm_mmap_write_samples(snd_pcm_t *pcm, const void *buffer, size_t samples); | ||||
| ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t samples); | ||||
| ssize_t snd_pcm_mmap_read_samples(snd_pcm_t *pcm, const void *buffer, size_t samples); | ||||
| int snd_pcm_mmap_frames_used(snd_pcm_t *pcm, int channel, ssize_t *frames); | ||||
| int snd_pcm_mmap_frames_free(snd_pcm_t *pcm, int channel, ssize_t *frames); | ||||
| ssize_t snd_pcm_mmap_frames_xfer(snd_pcm_t *pcm, int channel, size_t frames); | ||||
| ssize_t snd_pcm_mmap_frames_offset(snd_pcm_t *pcm, int channel); | ||||
| int snd_pcm_mmap_commit_frames(snd_pcm_t *pcm, int channel, int frames); | ||||
| ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t frames); | ||||
| ssize_t snd_pcm_mmap_write_frames(snd_pcm_t *pcm, const void *buffer, size_t frames); | ||||
| ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t frames); | ||||
| ssize_t snd_pcm_mmap_read_frames(snd_pcm_t *pcm, const void *buffer, size_t frames); | ||||
| int snd_pcm_mmap_get_areas(snd_pcm_t *pcm, int channel, snd_pcm_voice_area_t *areas); | ||||
| 
 | ||||
| 
 | ||||
|  | @ -147,13 +147,13 @@ ssize_t snd_pcm_bytes_per_second(snd_pcm_t *pcm, int channel); | |||
| int snd_pcm_area_silence(const snd_pcm_voice_area_t *dst_voice, size_t dst_offset, | ||||
| 			 size_t samples, int format); | ||||
| int snd_pcm_areas_silence(const snd_pcm_voice_area_t *dst_voices, size_t dst_offset, | ||||
| 			  size_t vcount, size_t samples, int format); | ||||
| 			  size_t vcount, size_t frames, int format); | ||||
| int snd_pcm_area_copy(const snd_pcm_voice_area_t *src_voice, size_t src_offset, | ||||
| 		      const snd_pcm_voice_area_t *dst_voice, size_t dst_offset, | ||||
| 		      size_t samples, int format); | ||||
| int snd_pcm_areas_copy(const snd_pcm_voice_area_t *src_voices, size_t src_offset, | ||||
| 		       const snd_pcm_voice_area_t *dst_voices, size_t dst_offset, | ||||
| 		       size_t vcount, size_t samples, int format); | ||||
| 		       size_t vcount, size_t frames, int format); | ||||
| 
 | ||||
| /* misc */ | ||||
| 
 | ||||
|  | @ -211,10 +211,10 @@ struct snd_stru_pcm_plugin { | |||
| 	snd_pcm_format_t dst_format;	/* destination format */ | ||||
| 	int src_width;			/* sample width in bits */ | ||||
| 	int dst_width;			/* sample width in bits */ | ||||
| 	ssize_t (*src_samples)(snd_pcm_plugin_t *plugin, size_t dst_samples); | ||||
| 	ssize_t (*dst_samples)(snd_pcm_plugin_t *plugin, size_t src_samples); | ||||
| 	ssize_t (*src_frames)(snd_pcm_plugin_t *plugin, size_t dst_frames); | ||||
| 	ssize_t (*dst_frames)(snd_pcm_plugin_t *plugin, size_t src_frames); | ||||
| 	ssize_t (*client_voices)(snd_pcm_plugin_t *plugin, | ||||
| 				 size_t samples, | ||||
| 				 size_t frames, | ||||
| 				 snd_pcm_plugin_voice_t **voices); | ||||
| 	int (*src_voices_mask)(snd_pcm_plugin_t *plugin, | ||||
| 			       bitset_t *dst_vmask, | ||||
|  | @ -225,7 +225,7 @@ struct snd_stru_pcm_plugin { | |||
| 	ssize_t (*transfer)(snd_pcm_plugin_t *plugin, | ||||
| 			    const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			    snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			    size_t samples); | ||||
| 			    size_t frames); | ||||
| 	int (*action)(snd_pcm_plugin_t *plugin, | ||||
| 		      snd_pcm_plugin_action_t action, | ||||
| 		      unsigned long data); | ||||
|  | @ -262,8 +262,8 @@ int snd_pcm_plug_remove_first(snd_pcm_t *handle, int channel); | |||
| snd_pcm_plugin_t *snd_pcm_plug_first(snd_pcm_t *handle, int channel); | ||||
| snd_pcm_plugin_t *snd_pcm_plug_last(snd_pcm_t *handle, int channel); | ||||
| int snd_pcm_plug_direct(snd_pcm_t *pcm, int channel); | ||||
| ssize_t snd_pcm_plug_client_samples(snd_pcm_t *handle, int channel, size_t drv_samples); | ||||
| ssize_t snd_pcm_plug_slave_samples(snd_pcm_t *handle, int channel, size_t clt_samples); | ||||
| ssize_t snd_pcm_plug_client_frames(snd_pcm_t *handle, int channel, size_t drv_frames); | ||||
| ssize_t snd_pcm_plug_slave_frames(snd_pcm_t *handle, int channel, size_t clt_frames); | ||||
| ssize_t snd_pcm_plug_client_size(snd_pcm_t *handle, int channel, size_t drv_size); | ||||
| ssize_t snd_pcm_plug_slave_size(snd_pcm_t *handle, int channel, size_t clt_size); | ||||
| 
 | ||||
|  | @ -271,10 +271,10 @@ ssize_t snd_pcm_plug_slave_size(snd_pcm_t *handle, int channel, size_t clt_size) | |||
|  *  Plug-In helpers | ||||
|  */ | ||||
| 
 | ||||
| ssize_t snd_pcm_plugin_src_samples_to_size(snd_pcm_plugin_t *plugin, size_t samples); | ||||
| ssize_t snd_pcm_plugin_dst_samples_to_size(snd_pcm_plugin_t *plugin, size_t samples); | ||||
| ssize_t snd_pcm_plugin_src_size_to_samples(snd_pcm_plugin_t *plugin, size_t size); | ||||
| ssize_t snd_pcm_plugin_dst_size_to_samples(snd_pcm_plugin_t *plugin, size_t size); | ||||
| ssize_t snd_pcm_plugin_src_frames_to_size(snd_pcm_plugin_t *plugin, size_t frames); | ||||
| ssize_t snd_pcm_plugin_dst_frames_to_size(snd_pcm_plugin_t *plugin, size_t frames); | ||||
| ssize_t snd_pcm_plugin_src_size_to_frames(snd_pcm_plugin_t *plugin, size_t size); | ||||
| ssize_t snd_pcm_plugin_dst_size_to_frames(snd_pcm_plugin_t *plugin, size_t size); | ||||
| 
 | ||||
| /*
 | ||||
|  *  Plug-In constructors | ||||
|  |  | |||
|  | @ -179,8 +179,8 @@ int snd_pcm_channel_setup(snd_pcm_t *pcm, snd_pcm_channel_setup_t *setup) | |||
| 		return err; | ||||
| 	memcpy(&chan->setup, setup, sizeof(*setup)); | ||||
| 	chan->sample_width = snd_pcm_format_physical_width(setup->format.format); | ||||
| 	chan->bits_per_sample = chan->sample_width * setup->format.voices; | ||||
| 	chan->samples_per_frag = setup->frag_size * 8 / chan->bits_per_sample; | ||||
| 	chan->bits_per_frame = chan->sample_width * setup->format.voices; | ||||
| 	chan->frames_per_frag = setup->frag_size * 8 / chan->bits_per_frame; | ||||
| 	chan->valid_setup = 1; | ||||
| 	return 0; | ||||
| } | ||||
|  |  | |||
|  | @ -59,7 +59,7 @@ static int snd_pcm_plugin_dst_voices_mask(snd_pcm_plugin_t *plugin, | |||
| 
 | ||||
| static ssize_t snd_pcm_plugin_side_voices(snd_pcm_plugin_t *plugin, | ||||
| 					  int client_side, | ||||
| 					  size_t samples, | ||||
| 					  size_t frames, | ||||
| 					  snd_pcm_plugin_voice_t **voices) | ||||
| { | ||||
| 	char *ptr; | ||||
|  | @ -80,7 +80,7 @@ static ssize_t snd_pcm_plugin_side_voices(snd_pcm_plugin_t *plugin, | |||
| 	*voices = v; | ||||
| 	if ((width = snd_pcm_format_physical_width(format->format)) < 0) | ||||
| 		return width;	 | ||||
| 	size = format->voices * samples * width; | ||||
| 	size = format->voices * frames * width; | ||||
| 	if ((size % 8) != 0) | ||||
| 		return -EINVAL; | ||||
| 	size /= 8; | ||||
|  | @ -104,21 +104,21 @@ static ssize_t snd_pcm_plugin_side_voices(snd_pcm_plugin_t *plugin, | |||
| 			v->area.step = width; | ||||
| 		} | ||||
| 	} | ||||
| 	return samples; | ||||
| 	return frames; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_plugin_client_voices(snd_pcm_plugin_t *plugin, | ||||
| 				     size_t samples, | ||||
| 				     size_t frames, | ||||
| 				     snd_pcm_plugin_voice_t **voices) | ||||
| { | ||||
| 	return snd_pcm_plugin_side_voices(plugin, 1, samples, voices); | ||||
| 	return snd_pcm_plugin_side_voices(plugin, 1, frames, voices); | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_plugin_slave_voices(snd_pcm_plugin_t *plugin, | ||||
| 				    size_t samples, | ||||
| 				    size_t frames, | ||||
| 				    snd_pcm_plugin_voice_t **voices) | ||||
| { | ||||
| 	return snd_pcm_plugin_side_voices(plugin, 0, samples, voices); | ||||
| 	return snd_pcm_plugin_side_voices(plugin, 0, frames, voices); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -201,31 +201,31 @@ int snd_pcm_plugin_free(snd_pcm_plugin_t *plugin) | |||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_plugin_src_samples_to_size(snd_pcm_plugin_t *plugin, size_t samples) | ||||
| ssize_t snd_pcm_plugin_src_frames_to_size(snd_pcm_plugin_t *plugin, size_t frames) | ||||
| { | ||||
| 	ssize_t result; | ||||
| 
 | ||||
| 	if (plugin == NULL) | ||||
| 		return -EFAULT; | ||||
| 	result = samples * plugin->src_format.voices * plugin->src_width; | ||||
| 	result = frames * plugin->src_format.voices * plugin->src_width; | ||||
| 	if (result % 8 != 0) | ||||
| 		return -EINVAL; | ||||
| 	return result / 8; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_plugin_dst_samples_to_size(snd_pcm_plugin_t *plugin, size_t samples) | ||||
| ssize_t snd_pcm_plugin_dst_frames_to_size(snd_pcm_plugin_t *plugin, size_t frames) | ||||
| { | ||||
| 	ssize_t result; | ||||
| 
 | ||||
| 	if (plugin == NULL) | ||||
| 		return -EFAULT; | ||||
| 	result = samples * plugin->dst_format.voices * plugin->dst_width; | ||||
| 	result = frames * plugin->dst_format.voices * plugin->dst_width; | ||||
| 	if (result % 8 != 0) | ||||
| 		return -EINVAL; | ||||
| 	return result / 8; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_plugin_src_size_to_samples(snd_pcm_plugin_t *plugin, size_t size) | ||||
| ssize_t snd_pcm_plugin_src_size_to_frames(snd_pcm_plugin_t *plugin, size_t size) | ||||
| { | ||||
| 	ssize_t result; | ||||
| 	long tmp; | ||||
|  | @ -239,7 +239,7 @@ ssize_t snd_pcm_plugin_src_size_to_samples(snd_pcm_plugin_t *plugin, size_t size | |||
| 	return result / tmp; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_plugin_dst_size_to_samples(snd_pcm_plugin_t *plugin, size_t size) | ||||
| ssize_t snd_pcm_plugin_dst_size_to_frames(snd_pcm_plugin_t *plugin, size_t size) | ||||
| { | ||||
| 	ssize_t result; | ||||
| 	long tmp; | ||||
|  | @ -253,7 +253,7 @@ ssize_t snd_pcm_plugin_dst_size_to_samples(snd_pcm_plugin_t *plugin, size_t size | |||
| 	return result / tmp; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_plug_client_samples(snd_pcm_plugin_handle_t *handle, int channel, size_t drv_samples) | ||||
| ssize_t snd_pcm_plug_client_frames(snd_pcm_plugin_handle_t *handle, int channel, size_t drv_frames) | ||||
| { | ||||
| 	snd_pcm_plugin_t *plugin, *plugin_prev, *plugin_next; | ||||
| 	 | ||||
|  | @ -262,49 +262,49 @@ ssize_t snd_pcm_plug_client_samples(snd_pcm_plugin_handle_t *handle, int channel | |||
| 	if (channel != SND_PCM_CHANNEL_PLAYBACK && | ||||
| 	    channel != SND_PCM_CHANNEL_CAPTURE) | ||||
| 		return -EINVAL; | ||||
| 	if (drv_samples == 0) | ||||
| 	if (drv_frames == 0) | ||||
| 		return 0; | ||||
| 	if (channel == SND_PCM_CHANNEL_PLAYBACK) { | ||||
| 		plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_PLAYBACK); | ||||
| 		while (plugin && drv_samples > 0) { | ||||
| 		while (plugin && drv_frames > 0) { | ||||
| 			plugin_prev = plugin->prev; | ||||
| 			if (plugin->src_samples) | ||||
| 				drv_samples = plugin->src_samples(plugin, drv_samples); | ||||
| 			if (plugin->src_frames) | ||||
| 				drv_frames = plugin->src_frames(plugin, drv_frames); | ||||
| 			plugin = plugin_prev; | ||||
| 		} | ||||
| 	} else if (channel == SND_PCM_CHANNEL_CAPTURE) { | ||||
| 		plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_CAPTURE); | ||||
| 		while (plugin && drv_samples > 0) { | ||||
| 		while (plugin && drv_frames > 0) { | ||||
| 			plugin_next = plugin->next; | ||||
| 			if (plugin->dst_samples) | ||||
| 				drv_samples = plugin->dst_samples(plugin, drv_samples); | ||||
| 			if (plugin->dst_frames) | ||||
| 				drv_frames = plugin->dst_frames(plugin, drv_frames); | ||||
| 			plugin = plugin_next; | ||||
| 		} | ||||
| 	} | ||||
| 	return drv_samples; | ||||
| 	return drv_frames; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_plug_slave_samples(snd_pcm_plugin_handle_t *handle, int channel, size_t clt_samples) | ||||
| ssize_t snd_pcm_plug_slave_frames(snd_pcm_plugin_handle_t *handle, int channel, size_t clt_frames) | ||||
| { | ||||
| 	snd_pcm_plugin_t *plugin, *plugin_prev, *plugin_next; | ||||
| 	ssize_t samples; | ||||
| 	ssize_t frames; | ||||
| 	 | ||||
| 	if (handle == NULL) | ||||
| 		return -EFAULT; | ||||
| 	if (channel != SND_PCM_CHANNEL_PLAYBACK && | ||||
| 	    channel != SND_PCM_CHANNEL_CAPTURE) | ||||
| 		return -EINVAL; | ||||
| 	if (clt_samples == 0) | ||||
| 	if (clt_frames == 0) | ||||
| 		return 0; | ||||
| 	samples = clt_samples; | ||||
| 	frames = clt_frames; | ||||
| 	if (channel == SND_PCM_CHANNEL_PLAYBACK) { | ||||
| 		plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK); | ||||
| 		while (plugin && samples > 0) { | ||||
| 		while (plugin && frames > 0) { | ||||
| 			plugin_next = plugin->next; | ||||
| 			if (plugin->dst_samples) { | ||||
| 				samples = plugin->dst_samples(plugin, samples); | ||||
| 				if (samples < 0) | ||||
| 					return samples; | ||||
| 			if (plugin->dst_frames) { | ||||
| 				frames = plugin->dst_frames(plugin, frames); | ||||
| 				if (frames < 0) | ||||
| 					return frames; | ||||
| 			} | ||||
| 			plugin = plugin_next; | ||||
| 		} | ||||
|  | @ -312,15 +312,15 @@ ssize_t snd_pcm_plug_slave_samples(snd_pcm_plugin_handle_t *handle, int channel, | |||
| 		plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE); | ||||
| 		while (plugin) { | ||||
| 			plugin_prev = plugin->prev; | ||||
| 			if (plugin->src_samples) { | ||||
| 				samples = plugin->src_samples(plugin, samples); | ||||
| 				if (samples < 0) | ||||
| 					return samples; | ||||
| 			if (plugin->src_frames) { | ||||
| 				frames = plugin->src_frames(plugin, frames); | ||||
| 				if (frames < 0) | ||||
| 					return frames; | ||||
| 			} | ||||
| 			plugin = plugin_prev; | ||||
| 		} | ||||
| 	}  | ||||
| 	return samples; | ||||
| 	return frames; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_plug_client_size(snd_pcm_plugin_handle_t *handle, int channel, size_t drv_size) | ||||
|  | @ -339,26 +339,26 @@ ssize_t snd_pcm_plug_client_size(snd_pcm_plugin_handle_t *handle, int channel, s | |||
| 		plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_PLAYBACK); | ||||
| 		if (plugin == NULL) | ||||
| 			return drv_size; | ||||
| 		result = snd_pcm_plugin_dst_size_to_samples(plugin, drv_size); | ||||
| 		result = snd_pcm_plugin_dst_size_to_frames(plugin, drv_size); | ||||
| 		if (result < 0) | ||||
| 			return result; | ||||
| 		result = snd_pcm_plug_client_samples(handle, SND_PCM_CHANNEL_PLAYBACK, result); | ||||
| 		result = snd_pcm_plug_client_frames(handle, SND_PCM_CHANNEL_PLAYBACK, result); | ||||
| 		if (result < 0) | ||||
| 			return result; | ||||
| 		plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK); | ||||
| 		result = snd_pcm_plugin_src_samples_to_size(plugin, result); | ||||
| 		result = snd_pcm_plugin_src_frames_to_size(plugin, result); | ||||
| 	} else if (channel == SND_PCM_CHANNEL_CAPTURE) { | ||||
| 		plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_CAPTURE); | ||||
| 		if (plugin == NULL) | ||||
| 			return drv_size; | ||||
| 		result = snd_pcm_plugin_src_size_to_samples(plugin, drv_size); | ||||
| 		result = snd_pcm_plugin_src_size_to_frames(plugin, drv_size); | ||||
| 		if (result < 0) | ||||
| 			return result; | ||||
| 		result = snd_pcm_plug_client_samples(handle, SND_PCM_CHANNEL_CAPTURE, result); | ||||
| 		result = snd_pcm_plug_client_frames(handle, SND_PCM_CHANNEL_CAPTURE, result); | ||||
| 		if (result < 0) | ||||
| 			return result; | ||||
| 		plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE); | ||||
| 		result = snd_pcm_plugin_dst_samples_to_size(plugin, result); | ||||
| 		result = snd_pcm_plugin_dst_frames_to_size(plugin, result); | ||||
| 	} | ||||
| 	return result; | ||||
| } | ||||
|  | @ -379,26 +379,26 @@ ssize_t snd_pcm_plug_slave_size(snd_pcm_plugin_handle_t *handle, int channel, si | |||
| 		plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK); | ||||
| 		if (plugin == NULL) | ||||
| 			return clt_size; | ||||
| 		result = snd_pcm_plugin_src_size_to_samples(plugin, clt_size); | ||||
| 		result = snd_pcm_plugin_src_size_to_frames(plugin, clt_size); | ||||
| 		if (result < 0) | ||||
| 			return result; | ||||
| 		result = snd_pcm_plug_slave_samples(handle, SND_PCM_CHANNEL_PLAYBACK, result); | ||||
| 		result = snd_pcm_plug_slave_frames(handle, SND_PCM_CHANNEL_PLAYBACK, result); | ||||
| 		if (result < 0) | ||||
| 			return result; | ||||
| 		plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_PLAYBACK); | ||||
| 		result = snd_pcm_plugin_dst_samples_to_size(plugin, result); | ||||
| 		result = snd_pcm_plugin_dst_frames_to_size(plugin, result); | ||||
| 	} else if (channel == SND_PCM_CHANNEL_CAPTURE) { | ||||
| 		plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE); | ||||
| 		if (plugin == NULL) | ||||
| 			return clt_size; | ||||
| 		result = snd_pcm_plugin_dst_size_to_samples(plugin, clt_size); | ||||
| 		result = snd_pcm_plugin_dst_size_to_frames(plugin, clt_size); | ||||
| 		if (result < 0) | ||||
| 			return result; | ||||
| 		result = snd_pcm_plug_slave_samples(handle, SND_PCM_CHANNEL_CAPTURE, result); | ||||
| 		result = snd_pcm_plug_slave_frames(handle, SND_PCM_CHANNEL_CAPTURE, result); | ||||
| 		if (result < 0) | ||||
| 			return result; | ||||
| 		plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_CAPTURE); | ||||
| 		result = snd_pcm_plugin_src_samples_to_size(plugin, result); | ||||
| 		result = snd_pcm_plugin_src_frames_to_size(plugin, result); | ||||
| 	}  | ||||
| 	return result; | ||||
| } | ||||
|  | @ -1054,87 +1054,87 @@ ssize_t snd_pcm_plug_write_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plu | |||
| { | ||||
| 	snd_pcm_plugin_t *plugin, *next; | ||||
| 	snd_pcm_plugin_voice_t *dst_voices; | ||||
| 	ssize_t samples; | ||||
| 	ssize_t frames; | ||||
| 	int err; | ||||
| 
 | ||||
| 	if ((err = snd_pcm_plug_playback_disable_useless_voices(handle, src_voices)) < 0) | ||||
| 		return err; | ||||
| 	 | ||||
| 	plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK); | ||||
| 	samples = snd_pcm_plugin_src_size_to_samples(plugin, size); | ||||
| 	if (samples < 0) | ||||
| 		return samples; | ||||
| 	while (plugin && samples > 0) { | ||||
| 	frames = snd_pcm_plugin_src_size_to_frames(plugin, size); | ||||
| 	if (frames < 0) | ||||
| 		return frames; | ||||
| 	while (plugin && frames > 0) { | ||||
| 		if ((next = plugin->next) != NULL) { | ||||
| 			ssize_t samples1 = samples; | ||||
| 			if (plugin->dst_samples) | ||||
| 				samples1 = plugin->dst_samples(plugin, samples); | ||||
| 			if ((err = next->client_voices(next, samples1, &dst_voices)) < 0) { | ||||
| 			ssize_t frames1 = frames; | ||||
| 			if (plugin->dst_frames) | ||||
| 				frames1 = plugin->dst_frames(plugin, frames); | ||||
| 			if ((err = next->client_voices(next, frames1, &dst_voices)) < 0) { | ||||
| 				snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_PLAYBACK, src_voices->aptr); | ||||
| 				return err; | ||||
| 			} | ||||
| 			if (err != samples1) { | ||||
| 				samples = err; | ||||
| 				if (plugin->src_samples) | ||||
| 					samples = plugin->src_samples(plugin, samples1); | ||||
| 			if (err != frames1) { | ||||
| 				frames = err; | ||||
| 				if (plugin->src_frames) | ||||
| 					frames = plugin->src_frames(plugin, frames1); | ||||
| 			} | ||||
| 		} else { | ||||
| 			if ((err = snd_pcm_plugin_slave_voices(plugin, samples, &dst_voices)) < 0) | ||||
| 			if ((err = snd_pcm_plugin_slave_voices(plugin, frames, &dst_voices)) < 0) | ||||
| 				return err; | ||||
| 		} | ||||
| 		pdprintf("write plugin: %s, %i\n", plugin->name, samples); | ||||
| 		if ((samples = plugin->transfer(plugin, src_voices, dst_voices, samples)) < 0) { | ||||
| 		pdprintf("write plugin: %s, %i\n", plugin->name, frames); | ||||
| 		if ((frames = plugin->transfer(plugin, src_voices, dst_voices, frames)) < 0) { | ||||
| 			snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_PLAYBACK, src_voices->aptr); | ||||
| 			snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_PLAYBACK, dst_voices->aptr); | ||||
| 			return samples; | ||||
| 			return frames; | ||||
| 		} | ||||
| 		snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_PLAYBACK, src_voices->aptr); | ||||
| 		src_voices = dst_voices; | ||||
| 		plugin = next; | ||||
| 	} | ||||
| 	snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_PLAYBACK, src_voices->aptr); | ||||
| 	samples = snd_pcm_plug_client_samples(handle, SND_PCM_CHANNEL_PLAYBACK, samples); | ||||
| 	if (samples < 0) | ||||
| 		return samples; | ||||
| 	return snd_pcm_plugin_src_samples_to_size(snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK), samples); | ||||
| 	frames = snd_pcm_plug_client_frames(handle, SND_PCM_CHANNEL_PLAYBACK, frames); | ||||
| 	if (frames < 0) | ||||
| 		return frames; | ||||
| 	return snd_pcm_plugin_src_frames_to_size(snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK), frames); | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_plug_read_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_voice_t *dst_voices_final, size_t size) | ||||
| { | ||||
| 	snd_pcm_plugin_t *plugin, *next; | ||||
| 	snd_pcm_plugin_voice_t *src_voices, *dst_voices; | ||||
| 	ssize_t samples; | ||||
| 	ssize_t frames; | ||||
| 	int err; | ||||
| 
 | ||||
| 	plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE); | ||||
| 	samples = snd_pcm_plugin_dst_size_to_samples(plugin, size); | ||||
| 	if (samples < 0) | ||||
| 		return samples; | ||||
| 	samples = snd_pcm_plug_slave_samples(handle, SND_PCM_CHANNEL_CAPTURE, samples); | ||||
| 	if (samples < 0) | ||||
| 		return samples; | ||||
| 	frames = snd_pcm_plugin_dst_size_to_frames(plugin, size); | ||||
| 	if (frames < 0) | ||||
| 		return frames; | ||||
| 	frames = snd_pcm_plug_slave_frames(handle, SND_PCM_CHANNEL_CAPTURE, frames); | ||||
| 	if (frames < 0) | ||||
| 		return frames; | ||||
| 
 | ||||
| 	plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_CAPTURE); | ||||
| 	if ((err = snd_pcm_plugin_slave_voices(plugin, samples, &src_voices)) < 0) | ||||
| 	if ((err = snd_pcm_plugin_slave_voices(plugin, frames, &src_voices)) < 0) | ||||
| 		return err; | ||||
| 	if ((err = snd_pcm_plug_capture_disable_useless_voices(handle, src_voices, dst_voices_final) < 0)) | ||||
| 		return err; | ||||
| 	 | ||||
| 	while (plugin && samples > 0) { | ||||
| 	while (plugin && frames > 0) { | ||||
| 		if ((next = plugin->next) != NULL) { | ||||
| 			if ((err = plugin->client_voices(plugin, samples, &dst_voices)) < 0) { | ||||
| 			if ((err = plugin->client_voices(plugin, frames, &dst_voices)) < 0) { | ||||
| 				snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_CAPTURE, src_voices->aptr); | ||||
| 				return err; | ||||
| 			} | ||||
| 			samples = err; | ||||
| 			frames = err; | ||||
| 		} else { | ||||
| 			dst_voices = dst_voices_final; | ||||
| 		} | ||||
| 		pdprintf("read plugin: %s, %i\n", plugin->name, samples); | ||||
| 		if ((samples = plugin->transfer(plugin, src_voices, dst_voices, samples)) < 0) { | ||||
| 		pdprintf("read plugin: %s, %i\n", plugin->name, frames); | ||||
| 		if ((frames = plugin->transfer(plugin, src_voices, dst_voices, frames)) < 0) { | ||||
| 			snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_CAPTURE, src_voices->aptr); | ||||
| 			snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_CAPTURE, dst_voices->aptr); | ||||
| 			return samples; | ||||
| 			return frames; | ||||
| 		} | ||||
| #if 0 | ||||
| 		{ | ||||
|  | @ -1154,7 +1154,7 @@ ssize_t snd_pcm_plug_read_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plug | |||
| 		src_voices = dst_voices; | ||||
| 	} | ||||
| 	snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_CAPTURE, src_voices->aptr); | ||||
| 	return snd_pcm_plugin_dst_samples_to_size(snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE), samples); | ||||
| 	return snd_pcm_plugin_dst_frames_to_size(snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE), frames); | ||||
| } | ||||
| 
 | ||||
| int snd_pcm_area_silence(const snd_pcm_voice_area_t *dst_area, size_t dst_offset, | ||||
|  | @ -1240,7 +1240,7 @@ int snd_pcm_area_silence(const snd_pcm_voice_area_t *dst_area, size_t dst_offset | |||
| } | ||||
| 
 | ||||
| int snd_pcm_areas_silence(const snd_pcm_voice_area_t *dst_areas, size_t dst_offset, | ||||
| 			  size_t vcount, size_t samples, int format) | ||||
| 			  size_t vcount, size_t frames, int format) | ||||
| { | ||||
| 	int width = snd_pcm_format_physical_width(format); | ||||
| 	while (vcount > 0) { | ||||
|  | @ -1266,10 +1266,10 @@ int snd_pcm_areas_silence(const snd_pcm_voice_area_t *dst_areas, size_t dst_offs | |||
| 			d.addr = begin->addr; | ||||
| 			d.first = begin->first; | ||||
| 			d.step = width; | ||||
| 			err = snd_pcm_area_silence(&d, dst_offset * v, samples * v, format); | ||||
| 			err = snd_pcm_area_silence(&d, dst_offset * v, frames * v, format); | ||||
| 			vcount -= v; | ||||
| 		} else { | ||||
| 			err = snd_pcm_area_silence(begin, dst_offset, samples, format); | ||||
| 			err = snd_pcm_area_silence(begin, dst_offset, frames, format); | ||||
| 			dst_areas = begin + 1; | ||||
| 			vcount--; | ||||
| 		} | ||||
|  | @ -1377,7 +1377,7 @@ int snd_pcm_area_copy(const snd_pcm_voice_area_t *src_area, size_t src_offset, | |||
| 
 | ||||
| int snd_pcm_areas_copy(const snd_pcm_voice_area_t *src_areas, size_t src_offset, | ||||
| 		       const snd_pcm_voice_area_t *dst_areas, size_t dst_offset, | ||||
| 		       size_t vcount, size_t samples, int format) | ||||
| 		       size_t vcount, size_t frames, int format) | ||||
| { | ||||
| 	int width = snd_pcm_format_physical_width(format); | ||||
| 	while (vcount > 0) { | ||||
|  | @ -1410,10 +1410,10 @@ int snd_pcm_areas_copy(const snd_pcm_voice_area_t *src_areas, size_t src_offset, | |||
| 			d.addr = dst_start->addr; | ||||
| 			d.first = dst_start->first; | ||||
| 			d.step = width; | ||||
| 			snd_pcm_area_copy(&s, src_offset * v, &d, dst_offset * v, samples * v, format); | ||||
| 			snd_pcm_area_copy(&s, src_offset * v, &d, dst_offset * v, frames * v, format); | ||||
| 			vcount -= v; | ||||
| 		} else { | ||||
| 			snd_pcm_area_copy(src_start, src_offset, dst_start, dst_offset, samples, format); | ||||
| 			snd_pcm_area_copy(src_start, src_offset, dst_start, dst_offset, frames, format); | ||||
| 			src_areas = src_start + 1; | ||||
| 			dst_areas = dst_start + 1; | ||||
| 			vcount--; | ||||
|  |  | |||
|  | @ -84,8 +84,8 @@ struct snd_pcm_chan { | |||
| 	snd_pcm_channel_setup_t setup; | ||||
| 	snd_pcm_voice_area_t *voices; | ||||
| 	size_t sample_width; | ||||
| 	size_t bits_per_sample; | ||||
| 	size_t samples_per_frag; | ||||
| 	size_t bits_per_frame; | ||||
| 	size_t frames_per_frag; | ||||
| 	snd_pcm_mmap_control_t *mmap_control; | ||||
| 	size_t mmap_control_size; | ||||
| 	int mmap_control_emulation; | ||||
|  | @ -134,7 +134,7 @@ int snd_pcm_plug_playback_voices_mask(snd_pcm_plugin_handle_t *handle, | |||
| int snd_pcm_plug_capture_voices_mask(snd_pcm_plugin_handle_t *handle, | ||||
| 				     bitset_t *client_vmask); | ||||
| int snd_pcm_plugin_client_voices(snd_pcm_plugin_t *plugin, | ||||
|                                  size_t samples, | ||||
|                                  size_t frames, | ||||
|                                  snd_pcm_plugin_voice_t **voices); | ||||
| 
 | ||||
| void *snd_pcm_plug_buf_alloc(snd_pcm_t *pcm, int channel, size_t size); | ||||
|  |  | |||
|  | @ -68,11 +68,11 @@ static inline ssize_t snd_pcm_mmap_playback_bytes_used(struct snd_pcm_chan *chan | |||
| 	return bytes_used; | ||||
| } | ||||
| 
 | ||||
| static ssize_t snd_pcm_mmap_playback_samples_used(snd_pcm_t *pcm) | ||||
| static ssize_t snd_pcm_mmap_playback_frames_used(snd_pcm_t *pcm) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK]; | ||||
| 	ssize_t bytes = snd_pcm_mmap_playback_bytes_used(chan); | ||||
| 	return bytes * 8 / chan->bits_per_sample; | ||||
| 	return bytes * 8 / chan->bits_per_frame; | ||||
| } | ||||
| 
 | ||||
| static inline size_t snd_pcm_mmap_capture_bytes_used(struct snd_pcm_chan *chan) | ||||
|  | @ -84,14 +84,14 @@ static inline size_t snd_pcm_mmap_capture_bytes_used(struct snd_pcm_chan *chan) | |||
| 	return bytes_used; | ||||
| } | ||||
| 
 | ||||
| static size_t snd_pcm_mmap_capture_samples_used(snd_pcm_t *pcm) | ||||
| static size_t snd_pcm_mmap_capture_frames_used(snd_pcm_t *pcm) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE]; | ||||
| 	size_t bytes = snd_pcm_mmap_capture_bytes_used(chan); | ||||
| 	return bytes * 8 / chan->bits_per_sample; | ||||
| 	return bytes * 8 / chan->bits_per_frame; | ||||
| } | ||||
| 
 | ||||
| int snd_pcm_mmap_samples_used(snd_pcm_t *pcm, int channel, ssize_t *samples) | ||||
| int snd_pcm_mmap_frames_used(snd_pcm_t *pcm, int channel, ssize_t *frames) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
|         if (!pcm) | ||||
|  | @ -102,9 +102,9 @@ int snd_pcm_mmap_samples_used(snd_pcm_t *pcm, int channel, ssize_t *samples) | |||
| 	if (!chan->open || !chan->mmap_control) | ||||
| 		return -EBADFD; | ||||
| 	if (channel == SND_PCM_CHANNEL_PLAYBACK) | ||||
| 		*samples = snd_pcm_mmap_playback_samples_used(pcm); | ||||
| 		*frames = snd_pcm_mmap_playback_frames_used(pcm); | ||||
| 	else | ||||
| 		*samples = snd_pcm_mmap_capture_samples_used(pcm); | ||||
| 		*frames = snd_pcm_mmap_capture_frames_used(pcm); | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
|  | @ -113,11 +113,11 @@ static inline size_t snd_pcm_mmap_playback_bytes_free(struct snd_pcm_chan *chan) | |||
| 	return chan->setup.buffer_size - snd_pcm_mmap_playback_bytes_used(chan); | ||||
| } | ||||
| 
 | ||||
| static size_t snd_pcm_mmap_playback_samples_free(snd_pcm_t *pcm) | ||||
| static size_t snd_pcm_mmap_playback_frames_free(snd_pcm_t *pcm) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK]; | ||||
| 	size_t bytes = snd_pcm_mmap_playback_bytes_free(chan); | ||||
| 	return bytes * 8 / chan->bits_per_sample; | ||||
| 	return bytes * 8 / chan->bits_per_frame; | ||||
| } | ||||
| 
 | ||||
| static inline ssize_t snd_pcm_mmap_capture_bytes_free(struct snd_pcm_chan *chan) | ||||
|  | @ -125,14 +125,14 @@ static inline ssize_t snd_pcm_mmap_capture_bytes_free(struct snd_pcm_chan *chan) | |||
| 	return chan->setup.buffer_size - snd_pcm_mmap_capture_bytes_used(chan); | ||||
| } | ||||
| 
 | ||||
| static ssize_t snd_pcm_mmap_capture_samples_free(snd_pcm_t *pcm) | ||||
| static ssize_t snd_pcm_mmap_capture_frames_free(snd_pcm_t *pcm) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE]; | ||||
| 	ssize_t bytes = snd_pcm_mmap_capture_bytes_free(chan); | ||||
| 	return bytes * 8 / chan->bits_per_sample; | ||||
| 	return bytes * 8 / chan->bits_per_frame; | ||||
| } | ||||
| 
 | ||||
| int snd_pcm_mmap_samples_free(snd_pcm_t *pcm, int channel, ssize_t *samples) | ||||
| int snd_pcm_mmap_frames_free(snd_pcm_t *pcm, int channel, ssize_t *frames) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
|         if (!pcm) | ||||
|  | @ -143,9 +143,9 @@ int snd_pcm_mmap_samples_free(snd_pcm_t *pcm, int channel, ssize_t *samples) | |||
| 	if (!chan->open || !chan->mmap_control) | ||||
| 		return -EBADFD; | ||||
| 	if (channel == SND_PCM_CHANNEL_PLAYBACK) | ||||
| 		*samples = snd_pcm_mmap_playback_samples_free(pcm); | ||||
| 		*frames = snd_pcm_mmap_playback_frames_free(pcm); | ||||
| 	else | ||||
| 		*samples = snd_pcm_mmap_capture_samples_free(pcm); | ||||
| 		*frames = snd_pcm_mmap_capture_frames_free(pcm); | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
|  | @ -226,23 +226,23 @@ static size_t snd_pcm_mmap_capture_bytes_xfer(snd_pcm_t *pcm, size_t bytes) | |||
| 	return bytes; | ||||
| } | ||||
| 
 | ||||
| static ssize_t snd_pcm_mmap_playback_samples_xfer(snd_pcm_t *pcm, size_t samples) | ||||
| static ssize_t snd_pcm_mmap_playback_frames_xfer(snd_pcm_t *pcm, size_t frames) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK]; | ||||
| 	size_t bytes = samples * chan->bits_per_sample / 8; | ||||
| 	size_t bytes = frames * chan->bits_per_frame / 8; | ||||
| 	bytes = snd_pcm_mmap_playback_bytes_xfer(pcm, bytes); | ||||
| 	return bytes * 8 / chan->bits_per_sample; | ||||
| 	return bytes * 8 / chan->bits_per_frame; | ||||
| } | ||||
| 
 | ||||
| static ssize_t snd_pcm_mmap_capture_samples_xfer(snd_pcm_t *pcm, size_t samples) | ||||
| static ssize_t snd_pcm_mmap_capture_frames_xfer(snd_pcm_t *pcm, size_t frames) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE]; | ||||
| 	size_t bytes = samples * chan->bits_per_sample / 8; | ||||
| 	size_t bytes = frames * chan->bits_per_frame / 8; | ||||
| 	bytes = snd_pcm_mmap_capture_bytes_xfer(pcm, bytes); | ||||
| 	return bytes * 8 / chan->bits_per_sample; | ||||
| 	return bytes * 8 / chan->bits_per_frame; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_mmap_samples_xfer(snd_pcm_t *pcm, int channel, size_t samples) | ||||
| ssize_t snd_pcm_mmap_frames_xfer(snd_pcm_t *pcm, int channel, size_t frames) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
|         if (!pcm) | ||||
|  | @ -253,12 +253,12 @@ ssize_t snd_pcm_mmap_samples_xfer(snd_pcm_t *pcm, int channel, size_t samples) | |||
| 	if (!chan->open || !chan->mmap_control) | ||||
| 		return -EBADFD; | ||||
| 	if (channel == SND_PCM_CHANNEL_PLAYBACK) | ||||
| 		return snd_pcm_mmap_playback_samples_xfer(pcm, samples); | ||||
| 		return snd_pcm_mmap_playback_frames_xfer(pcm, frames); | ||||
| 	else | ||||
| 		return snd_pcm_mmap_capture_samples_xfer(pcm, samples); | ||||
| 		return snd_pcm_mmap_capture_frames_xfer(pcm, frames); | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_mmap_samples_offset(snd_pcm_t *pcm, int channel) | ||||
| ssize_t snd_pcm_mmap_frames_offset(snd_pcm_t *pcm, int channel) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
| 	snd_pcm_mmap_control_t *ctrl; | ||||
|  | @ -272,10 +272,10 @@ ssize_t snd_pcm_mmap_samples_offset(snd_pcm_t *pcm, int channel) | |||
| 	ctrl = chan->mmap_control; | ||||
| 	if (!ctrl) | ||||
| 		return -EBADFD; | ||||
| 	return (ctrl->byte_data % chan->setup.buffer_size) * 8 / chan->bits_per_sample; | ||||
| 	return (ctrl->byte_data % chan->setup.buffer_size) * 8 / chan->bits_per_frame; | ||||
| } | ||||
| 
 | ||||
| int snd_pcm_mmap_commit_samples(snd_pcm_t *pcm, int channel, int samples) | ||||
| int snd_pcm_mmap_commit_frames(snd_pcm_t *pcm, int channel, int frames) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
| 	snd_pcm_mmap_control_t *ctrl; | ||||
|  | @ -290,7 +290,7 @@ int snd_pcm_mmap_commit_samples(snd_pcm_t *pcm, int channel, int samples) | |||
| 	ctrl = chan->mmap_control; | ||||
| 	if (!ctrl) | ||||
| 		return -EBADFD; | ||||
| 	bytes = samples * chan->bits_per_sample; | ||||
| 	bytes = frames * chan->bits_per_frame; | ||||
| 	if (bytes % 8) | ||||
| 		return -EINVAL; | ||||
| 	bytes /= 8; | ||||
|  | @ -303,7 +303,7 @@ int snd_pcm_mmap_commit_samples(snd_pcm_t *pcm, int channel, int samples) | |||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t samples) | ||||
| ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t frames) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
| 	snd_pcm_mmap_control_t *ctrl; | ||||
|  | @ -316,16 +316,16 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, s | |||
| 	if (ctrl->status < SND_PCM_STATUS_PREPARED) | ||||
| 		return -EBADFD; | ||||
| 	if (chan->setup.mode == SND_PCM_MODE_BLOCK) { | ||||
| 		if (samples % chan->samples_per_frag != 0) | ||||
| 		if (frames % chan->frames_per_frag != 0) | ||||
| 			return -EINVAL; | ||||
| 	} else { | ||||
| 		if (ctrl->status == SND_PCM_STATUS_RUNNING && | ||||
| 		    chan->mode & SND_PCM_NONBLOCK) | ||||
| 			snd_pcm_channel_update(pcm, SND_PCM_CHANNEL_PLAYBACK); | ||||
| 	} | ||||
| 	while (samples > 0) { | ||||
| 	while (frames > 0) { | ||||
| 		ssize_t mmap_offset; | ||||
| 		size_t samples1; | ||||
| 		size_t frames1; | ||||
| 		int ready = snd_pcm_mmap_playback_ready(pcm); | ||||
| 		if (ready < 0) | ||||
| 			return ready; | ||||
|  | @ -344,16 +344,16 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, s | |||
| 				return result > 0 ? result : -EPIPE; | ||||
| 			assert(snd_pcm_mmap_playback_ready(pcm)); | ||||
| 		} | ||||
| 		samples1 = snd_pcm_mmap_playback_samples_xfer(pcm, samples); | ||||
| 		assert(samples1 > 0); | ||||
| 		mmap_offset = snd_pcm_mmap_samples_offset(pcm, SND_PCM_CHANNEL_PLAYBACK); | ||||
| 		snd_pcm_areas_copy(voices, offset, chan->voices, mmap_offset, chan->setup.format.voices, samples1, chan->setup.format.format); | ||||
| 		frames1 = snd_pcm_mmap_playback_frames_xfer(pcm, frames); | ||||
| 		assert(frames1 > 0); | ||||
| 		mmap_offset = snd_pcm_mmap_frames_offset(pcm, SND_PCM_CHANNEL_PLAYBACK); | ||||
| 		snd_pcm_areas_copy(voices, offset, chan->voices, mmap_offset, chan->setup.format.voices, frames1, chan->setup.format.format); | ||||
| 		if (ctrl->status == SND_PCM_STATUS_XRUN) | ||||
| 			return result > 0 ? result : -EPIPE; | ||||
| 		snd_pcm_mmap_commit_samples(pcm, SND_PCM_CHANNEL_PLAYBACK, samples1); | ||||
| 		samples -= samples1; | ||||
| 		offset += samples1; | ||||
| 		result += samples1; | ||||
| 		snd_pcm_mmap_commit_frames(pcm, SND_PCM_CHANNEL_PLAYBACK, frames1); | ||||
| 		frames -= frames1; | ||||
| 		offset += frames1; | ||||
| 		result += frames1; | ||||
| 		if (ctrl->status == SND_PCM_STATUS_PREPARED && | ||||
| 		    (chan->setup.start_mode == SND_PCM_START_DATA || | ||||
| 		     (chan->setup.start_mode == SND_PCM_START_FULL && | ||||
|  | @ -366,7 +366,7 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, s | |||
| 	return result; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_mmap_write_samples(snd_pcm_t *pcm, const void *buffer, size_t samples) | ||||
| ssize_t snd_pcm_mmap_write_frames(snd_pcm_t *pcm, const void *buffer, size_t frames) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
| 	unsigned int nvoices; | ||||
|  | @ -377,7 +377,7 @@ ssize_t snd_pcm_mmap_write_samples(snd_pcm_t *pcm, const void *buffer, size_t sa | |||
| 		return -EBADFD; | ||||
| 	if (!chan->mmap_data || !chan->mmap_control) | ||||
| 		return -EBADFD; | ||||
| 	if (samples > 0 && !buffer) | ||||
| 	if (frames > 0 && !buffer) | ||||
| 		return -EFAULT; | ||||
| 	nvoices = chan->setup.format.voices; | ||||
| 	if (!chan->setup.format.interleave && nvoices > 1) | ||||
|  | @ -388,9 +388,9 @@ ssize_t snd_pcm_mmap_write_samples(snd_pcm_t *pcm, const void *buffer, size_t sa | |||
| 		for (voice = 0; voice < nvoices; ++voice) { | ||||
| 			voices[voice].addr = (char*)buffer; | ||||
| 			voices[voice].first = chan->sample_width * voice; | ||||
| 			voices[voice].step = chan->bits_per_sample; | ||||
| 			voices[voice].step = chan->bits_per_frame; | ||||
| 		} | ||||
| 		return snd_pcm_mmap_write_areas(pcm, voices, samples); | ||||
| 		return snd_pcm_mmap_write_areas(pcm, voices, frames); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -398,7 +398,7 @@ ssize_t snd_pcm_mmap_write(snd_pcm_t *pcm, const void *buffer, size_t bytes) | |||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
| 	unsigned int nvoices; | ||||
| 	ssize_t samples; | ||||
| 	ssize_t frames; | ||||
| 	if (!pcm) | ||||
| 		return -EFAULT; | ||||
| 	chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK]; | ||||
|  | @ -411,11 +411,11 @@ ssize_t snd_pcm_mmap_write(snd_pcm_t *pcm, const void *buffer, size_t bytes) | |||
| 	nvoices = chan->setup.format.voices; | ||||
| 	if (!chan->setup.format.interleave && nvoices > 1) | ||||
| 		return -EINVAL; | ||||
| 	samples = bytes * 8 / chan->bits_per_sample; | ||||
| 	samples = snd_pcm_mmap_write_samples(pcm, buffer, samples); | ||||
| 	if (samples <= 0) | ||||
| 		return samples; | ||||
| 	return samples * chan->bits_per_sample / 8; | ||||
| 	frames = bytes * 8 / chan->bits_per_frame; | ||||
| 	frames = snd_pcm_mmap_write_frames(pcm, buffer, frames); | ||||
| 	if (frames <= 0) | ||||
| 		return frames; | ||||
| 	return frames * chan->bits_per_frame / 8; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_mmap_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned long vcount) | ||||
|  | @ -437,8 +437,8 @@ ssize_t snd_pcm_mmap_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned | |||
| 		unsigned int b; | ||||
| 		for (b = 0; b < vcount; b++) { | ||||
| 			ssize_t ret; | ||||
| 			size_t samples = vector[b].iov_len * 8 / chan->bits_per_sample; | ||||
| 			ret = snd_pcm_mmap_write_samples(pcm, vector[b].iov_base, samples); | ||||
| 			size_t frames = vector[b].iov_len * 8 / chan->bits_per_frame; | ||||
| 			ret = snd_pcm_mmap_write_frames(pcm, vector[b].iov_base, frames); | ||||
| 			if (ret < 0) { | ||||
| 				if (result <= 0) | ||||
| 					return ret; | ||||
|  | @ -457,7 +457,7 @@ ssize_t snd_pcm_mmap_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned | |||
| 			unsigned int v; | ||||
| 			ssize_t ret; | ||||
| 			size_t bytes = 0; | ||||
| 			size_t samples; | ||||
| 			size_t frames; | ||||
| 			bytes = vector[0].iov_len; | ||||
| 			for (v = 0; v < nvoices; ++v) { | ||||
| 				if (vector[v].iov_len != bytes) | ||||
|  | @ -466,23 +466,23 @@ ssize_t snd_pcm_mmap_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned | |||
| 				voices[v].first = 0; | ||||
| 				voices[v].step = chan->sample_width; | ||||
| 			} | ||||
| 			samples = bytes * 8 / chan->sample_width; | ||||
| 			ret = snd_pcm_mmap_write_areas(pcm, voices, samples); | ||||
| 			frames = bytes * 8 / chan->sample_width; | ||||
| 			ret = snd_pcm_mmap_write_areas(pcm, voices, frames); | ||||
| 			if (ret < 0) { | ||||
| 				if (result <= 0) | ||||
| 					return ret; | ||||
| 				break; | ||||
| 			} | ||||
| 			result += ret; | ||||
| 			if ((size_t)ret != samples) | ||||
| 			if ((size_t)ret != frames) | ||||
| 				break; | ||||
| 			vector += nvoices; | ||||
| 		} | ||||
| 	} | ||||
| 	return result * chan->bits_per_sample / 8; | ||||
| 	return result * chan->bits_per_frame / 8; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t samples) | ||||
| ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t frames) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
| 	snd_pcm_mmap_control_t *ctrl; | ||||
|  | @ -495,7 +495,7 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, si | |||
| 	if (ctrl->status < SND_PCM_STATUS_PREPARED) | ||||
| 		return -EBADFD; | ||||
| 	if (chan->setup.mode == SND_PCM_MODE_BLOCK) { | ||||
| 		if (samples % chan->samples_per_frag != 0) | ||||
| 		if (frames % chan->frames_per_frag != 0) | ||||
| 			return -EINVAL; | ||||
| 	} else { | ||||
| 		if (ctrl->status == SND_PCM_STATUS_RUNNING && | ||||
|  | @ -508,9 +508,9 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, si | |||
| 		if (err < 0) | ||||
| 			return err; | ||||
| 	} | ||||
| 	while (samples > 0) { | ||||
| 	while (frames > 0) { | ||||
| 		ssize_t mmap_offset; | ||||
| 		size_t samples1; | ||||
| 		size_t frames1; | ||||
| 		int ready = snd_pcm_mmap_capture_ready(pcm); | ||||
| 		if (ready < 0) | ||||
| 			return ready; | ||||
|  | @ -529,22 +529,22 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, si | |||
| 				return result > 0 ? result : -EPIPE; | ||||
| 			assert(snd_pcm_mmap_capture_ready(pcm)); | ||||
| 		} | ||||
| 		samples1 = snd_pcm_mmap_capture_samples_xfer(pcm, samples); | ||||
| 		assert(samples1 > 0); | ||||
| 		mmap_offset = snd_pcm_mmap_samples_offset(pcm, SND_PCM_CHANNEL_CAPTURE); | ||||
| 		snd_pcm_areas_copy(chan->voices, mmap_offset, voices, offset, chan->setup.format.voices, samples1, chan->setup.format.format); | ||||
| 		frames1 = snd_pcm_mmap_capture_frames_xfer(pcm, frames); | ||||
| 		assert(frames1 > 0); | ||||
| 		mmap_offset = snd_pcm_mmap_frames_offset(pcm, SND_PCM_CHANNEL_CAPTURE); | ||||
| 		snd_pcm_areas_copy(chan->voices, mmap_offset, voices, offset, chan->setup.format.voices, frames1, chan->setup.format.format); | ||||
| 		if (ctrl->status == SND_PCM_STATUS_XRUN && | ||||
| 		    chan->setup.xrun_mode == SND_PCM_XRUN_DRAIN) | ||||
| 			return result > 0 ? result : -EPIPE; | ||||
| 		snd_pcm_mmap_commit_samples(pcm, SND_PCM_CHANNEL_CAPTURE, samples1); | ||||
| 		samples -= samples1; | ||||
| 		offset += samples1; | ||||
| 		result += samples1; | ||||
| 		snd_pcm_mmap_commit_frames(pcm, SND_PCM_CHANNEL_CAPTURE, frames1); | ||||
| 		frames -= frames1; | ||||
| 		offset += frames1; | ||||
| 		result += frames1; | ||||
| 	} | ||||
| 	return result; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_mmap_read_samples(snd_pcm_t *pcm, const void *buffer, size_t samples) | ||||
| ssize_t snd_pcm_mmap_read_frames(snd_pcm_t *pcm, const void *buffer, size_t frames) | ||||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
| 	unsigned int nvoices; | ||||
|  | @ -555,7 +555,7 @@ ssize_t snd_pcm_mmap_read_samples(snd_pcm_t *pcm, const void *buffer, size_t sam | |||
| 		return -EBADFD; | ||||
| 	if (!chan->mmap_data || !chan->mmap_control) | ||||
| 		return -EBADFD; | ||||
| 	if (samples > 0 && !buffer) | ||||
| 	if (frames > 0 && !buffer) | ||||
| 		return -EFAULT; | ||||
| 	nvoices = chan->setup.format.voices; | ||||
| 	if (!chan->setup.format.interleave && nvoices > 1) | ||||
|  | @ -566,9 +566,9 @@ ssize_t snd_pcm_mmap_read_samples(snd_pcm_t *pcm, const void *buffer, size_t sam | |||
| 		for (voice = 0; voice < nvoices; ++voice) { | ||||
| 			voices[voice].addr = (char*)buffer; | ||||
| 			voices[voice].first = chan->sample_width * voice; | ||||
| 			voices[voice].step = chan->bits_per_sample; | ||||
| 			voices[voice].step = chan->bits_per_frame; | ||||
| 		} | ||||
| 		return snd_pcm_mmap_read_areas(pcm, voices, samples); | ||||
| 		return snd_pcm_mmap_read_areas(pcm, voices, frames); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -576,7 +576,7 @@ ssize_t snd_pcm_mmap_read(snd_pcm_t *pcm, void *buffer, size_t bytes) | |||
| { | ||||
| 	struct snd_pcm_chan *chan; | ||||
| 	unsigned int nvoices; | ||||
| 	ssize_t samples; | ||||
| 	ssize_t frames; | ||||
| 	if (!pcm) | ||||
| 		return -EFAULT; | ||||
| 	chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE]; | ||||
|  | @ -589,11 +589,11 @@ ssize_t snd_pcm_mmap_read(snd_pcm_t *pcm, void *buffer, size_t bytes) | |||
| 	nvoices = chan->setup.format.voices; | ||||
| 	if (!chan->setup.format.interleave && nvoices > 1) | ||||
| 		return -EINVAL; | ||||
| 	samples = bytes * 8 / chan->bits_per_sample; | ||||
| 	samples = snd_pcm_mmap_read_samples(pcm, buffer, samples); | ||||
| 	if (samples <= 0) | ||||
| 		return samples; | ||||
| 	return samples * chan->bits_per_sample / 8; | ||||
| 	frames = bytes * 8 / chan->bits_per_frame; | ||||
| 	frames = snd_pcm_mmap_read_frames(pcm, buffer, frames); | ||||
| 	if (frames <= 0) | ||||
| 		return frames; | ||||
| 	return frames * chan->bits_per_frame / 8; | ||||
| } | ||||
| 
 | ||||
| ssize_t snd_pcm_mmap_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned long vcount) | ||||
|  | @ -615,8 +615,8 @@ ssize_t snd_pcm_mmap_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned | |||
| 		unsigned int b; | ||||
| 		for (b = 0; b < vcount; b++) { | ||||
| 			ssize_t ret; | ||||
| 			size_t samples = vector[b].iov_len * 8 / chan->bits_per_sample; | ||||
| 			ret = snd_pcm_mmap_read_samples(pcm, vector[b].iov_base, samples); | ||||
| 			size_t frames = vector[b].iov_len * 8 / chan->bits_per_frame; | ||||
| 			ret = snd_pcm_mmap_read_frames(pcm, vector[b].iov_base, frames); | ||||
| 			if (ret < 0) { | ||||
| 				if (result <= 0) | ||||
| 					return ret; | ||||
|  | @ -635,7 +635,7 @@ ssize_t snd_pcm_mmap_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned | |||
| 			unsigned int v; | ||||
| 			ssize_t ret; | ||||
| 			size_t bytes = 0; | ||||
| 			size_t samples; | ||||
| 			size_t frames; | ||||
| 			bytes = vector[0].iov_len; | ||||
| 			for (v = 0; v < nvoices; ++v) { | ||||
| 				if (vector[v].iov_len != bytes) | ||||
|  | @ -644,20 +644,20 @@ ssize_t snd_pcm_mmap_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned | |||
| 				voices[v].first = 0; | ||||
| 				voices[v].step = chan->sample_width; | ||||
| 			} | ||||
| 			samples = bytes * 8 / chan->sample_width; | ||||
| 			ret = snd_pcm_mmap_read_areas(pcm, voices, samples); | ||||
| 			frames = bytes * 8 / chan->sample_width; | ||||
| 			ret = snd_pcm_mmap_read_areas(pcm, voices, frames); | ||||
| 			if (ret < 0) { | ||||
| 				if (result <= 0) | ||||
| 					return ret; | ||||
| 				break; | ||||
| 			} | ||||
| 			result += ret; | ||||
| 			if ((size_t)ret != samples) | ||||
| 			if ((size_t)ret != frames) | ||||
| 				break; | ||||
| 			vector += nvoices; | ||||
| 		} | ||||
| 	} | ||||
| 	return result * chan->bits_per_sample / 8; | ||||
| 	return result * chan->bits_per_frame / 8; | ||||
| } | ||||
| 
 | ||||
| static ssize_t mmap_playback_bytes_xfer(struct snd_pcm_chan *chan) | ||||
|  |  | |||
|  | @ -584,7 +584,6 @@ static int snd_pcm_plug_voice_setup(snd_pcm_t *pcm, int channel, snd_pcm_voice_s | |||
| 	struct snd_pcm_chan *chan; | ||||
| 	unsigned int voice; | ||||
| 	int width; | ||||
| 	size_t size; | ||||
| 
 | ||||
| 	if (snd_pcm_plug_direct(pcm, channel)) | ||||
| 		return snd_pcm_voice_setup(plug->slave, channel, setup); | ||||
|  | @ -600,19 +599,15 @@ static int snd_pcm_plug_voice_setup(snd_pcm_t *pcm, int channel, snd_pcm_voice_s | |||
| 	if (voice >= chan->setup.format.voices) | ||||
| 		return -EINVAL; | ||||
| 
 | ||||
| 	width = snd_pcm_format_physical_width(chan->setup.format.format); | ||||
|         if (width < 0) | ||||
|                 return width; | ||||
| 	size = chan->mmap_data_size; | ||||
| 	if (chan->setup.format.interleave) { | ||||
|                 setup->area.addr = chan->mmap_data; | ||||
|                 setup->area.first = chan->sample_width; | ||||
|                 setup->area.step = chan->bits_per_sample; | ||||
|                 setup->area.first = setup->voice * chan->sample_width; | ||||
|                 setup->area.step = chan->bits_per_frame; | ||||
|         } else { | ||||
|                 size /= chan->setup.format.voices; | ||||
| 		size_t size = chan->mmap_data_size / chan->setup.format.voices; | ||||
|                 setup->area.addr = chan->mmap_data + setup->voice * size; | ||||
|                 setup->area.first = 0; | ||||
|                 setup->area.step = width; | ||||
|                 setup->area.step = chan->sample_width; | ||||
| 	} | ||||
| 	return 0; | ||||
| } | ||||
|  |  | |||
|  | @ -79,7 +79,7 @@ typedef struct { | |||
| typedef void (*adpcm_f)(snd_pcm_plugin_t *plugin, | ||||
| 			const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			size_t samples); | ||||
| 			size_t frames); | ||||
| 
 | ||||
| typedef struct adpcm_private_data { | ||||
| 	adpcm_f func; | ||||
|  | @ -213,7 +213,7 @@ static int adpcm_decoder(unsigned char code, adpcm_voice_t * state) | |||
| static void adpcm_decode(snd_pcm_plugin_t *plugin, | ||||
| 			 const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			 snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			 size_t samples) | ||||
| 			 size_t frames) | ||||
| { | ||||
| #define PUT_S16_LABELS | ||||
| #include "plugin_ops.h" | ||||
|  | @ -227,11 +227,11 @@ static void adpcm_decode(snd_pcm_plugin_t *plugin, | |||
| 		int srcbit; | ||||
| 		char *dst; | ||||
| 		int src_step, srcbit_step, dst_step; | ||||
| 		size_t samples1; | ||||
| 		size_t frames1; | ||||
| 		adpcm_voice_t *state; | ||||
| 		if (!src_voices[voice].enabled) { | ||||
| 			if (dst_voices[voice].wanted) | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, samples, plugin->dst_format.format); | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format); | ||||
| 			dst_voices[voice].enabled = 0; | ||||
| 			continue; | ||||
| 		} | ||||
|  | @ -243,8 +243,8 @@ static void adpcm_decode(snd_pcm_plugin_t *plugin, | |||
| 		srcbit_step = src_voices[voice].area.step % 8; | ||||
| 		dst_step = dst_voices[voice].area.step / 8; | ||||
| 		state = &data->voices[voice]; | ||||
| 		samples1 = samples; | ||||
| 		while (samples1-- > 0) { | ||||
| 		frames1 = frames; | ||||
| 		while (frames1-- > 0) { | ||||
| 			signed short sample; | ||||
| 			int v; | ||||
| 			if (srcbit) | ||||
|  | @ -271,7 +271,7 @@ static void adpcm_decode(snd_pcm_plugin_t *plugin, | |||
| static void adpcm_encode(snd_pcm_plugin_t *plugin, | ||||
| 			const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			size_t samples) | ||||
| 			size_t frames) | ||||
| { | ||||
| #define GET_S16_LABELS | ||||
| #include "plugin_ops.h" | ||||
|  | @ -286,11 +286,11 @@ static void adpcm_encode(snd_pcm_plugin_t *plugin, | |||
| 		char *dst; | ||||
| 		int dstbit; | ||||
| 		int src_step, dst_step, dstbit_step; | ||||
| 		size_t samples1; | ||||
| 		size_t frames1; | ||||
| 		adpcm_voice_t *state; | ||||
| 		if (!src_voices[voice].enabled) { | ||||
| 			if (dst_voices[voice].wanted) | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, samples, plugin->dst_format.format); | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format); | ||||
| 			dst_voices[voice].enabled = 0; | ||||
| 			continue; | ||||
| 		} | ||||
|  | @ -302,8 +302,8 @@ static void adpcm_encode(snd_pcm_plugin_t *plugin, | |||
| 		dst_step = dst_voices[voice].area.step / 8; | ||||
| 		dstbit_step = dst_voices[voice].area.step % 8; | ||||
| 		state = &data->voices[voice]; | ||||
| 		samples1 = samples; | ||||
| 		while (samples1-- > 0) { | ||||
| 		frames1 = frames; | ||||
| 		while (frames1-- > 0) { | ||||
| 			int v; | ||||
| 			goto *get; | ||||
| #define GET_S16_END after | ||||
|  | @ -329,14 +329,14 @@ static void adpcm_encode(snd_pcm_plugin_t *plugin, | |||
| static ssize_t adpcm_transfer(snd_pcm_plugin_t *plugin, | ||||
| 			      const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			      snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			      size_t samples) | ||||
| 			      size_t frames) | ||||
| { | ||||
| 	adpcm_t *data; | ||||
| 	unsigned int voice; | ||||
| 
 | ||||
| 	if (plugin == NULL || src_voices == NULL || dst_voices == NULL) | ||||
| 		return -EFAULT; | ||||
| 	if (samples == 0) | ||||
| 	if (frames == 0) | ||||
| 		return 0; | ||||
| 	for (voice = 0; voice < plugin->src_format.voices; voice++) { | ||||
| 		if (plugin->src_format.format == SND_PCM_SFMT_IMA_ADPCM) { | ||||
|  | @ -354,8 +354,8 @@ static ssize_t adpcm_transfer(snd_pcm_plugin_t *plugin, | |||
| 		} | ||||
| 	} | ||||
| 	data = (adpcm_t *)plugin->extra_data; | ||||
| 	data->func(plugin, src_voices, dst_voices, samples); | ||||
| 	return samples; | ||||
| 	data->func(plugin, src_voices, dst_voices, frames); | ||||
| 	return frames; | ||||
| } | ||||
| 
 | ||||
| static int adpcm_action(snd_pcm_plugin_t * plugin, | ||||
|  |  | |||
|  | @ -135,7 +135,7 @@ static int alaw2linear(unsigned char a_val) | |||
| typedef void (*alaw_f)(snd_pcm_plugin_t *plugin, | ||||
| 		       const snd_pcm_plugin_voice_t *src_voices, | ||||
| 		       snd_pcm_plugin_voice_t *dst_voices, | ||||
| 		       size_t samples); | ||||
| 		       size_t frames); | ||||
| 
 | ||||
| typedef struct alaw_private_data { | ||||
| 	alaw_f func; | ||||
|  | @ -145,7 +145,7 @@ typedef struct alaw_private_data { | |||
| static void alaw_decode(snd_pcm_plugin_t *plugin, | ||||
| 			const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			size_t samples) | ||||
| 			size_t frames) | ||||
| { | ||||
| #define PUT_S16_LABELS | ||||
| #include "plugin_ops.h" | ||||
|  | @ -158,10 +158,10 @@ static void alaw_decode(snd_pcm_plugin_t *plugin, | |||
| 		char *src; | ||||
| 		char *dst; | ||||
| 		int src_step, dst_step; | ||||
| 		size_t samples1; | ||||
| 		size_t frames1; | ||||
| 		if (!src_voices[voice].enabled) { | ||||
| 			if (dst_voices[voice].wanted) | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, samples, plugin->dst_format.format); | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format); | ||||
| 			dst_voices[voice].enabled = 0; | ||||
| 			continue; | ||||
| 		} | ||||
|  | @ -170,8 +170,8 @@ static void alaw_decode(snd_pcm_plugin_t *plugin, | |||
| 		dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8; | ||||
| 		src_step = src_voices[voice].area.step / 8; | ||||
| 		dst_step = dst_voices[voice].area.step / 8; | ||||
| 		samples1 = samples; | ||||
| 		while (samples1-- > 0) { | ||||
| 		frames1 = frames; | ||||
| 		while (frames1-- > 0) { | ||||
| 			signed short sample = alaw2linear(*src); | ||||
| 			goto *put; | ||||
| #define PUT_S16_END after | ||||
|  | @ -187,7 +187,7 @@ static void alaw_decode(snd_pcm_plugin_t *plugin, | |||
| static void alaw_encode(snd_pcm_plugin_t *plugin, | ||||
| 			const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			size_t samples) | ||||
| 			size_t frames) | ||||
| { | ||||
| #define GET_S16_LABELS | ||||
| #include "plugin_ops.h" | ||||
|  | @ -201,10 +201,10 @@ static void alaw_encode(snd_pcm_plugin_t *plugin, | |||
| 		char *src; | ||||
| 		char *dst; | ||||
| 		int src_step, dst_step; | ||||
| 		size_t samples1; | ||||
| 		size_t frames1; | ||||
| 		if (!src_voices[voice].enabled) { | ||||
| 			if (dst_voices[voice].wanted) | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, samples, plugin->dst_format.format); | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format); | ||||
| 			dst_voices[voice].enabled = 0; | ||||
| 			continue; | ||||
| 		} | ||||
|  | @ -213,8 +213,8 @@ static void alaw_encode(snd_pcm_plugin_t *plugin, | |||
| 		dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8; | ||||
| 		src_step = src_voices[voice].area.step / 8; | ||||
| 		dst_step = dst_voices[voice].area.step / 8; | ||||
| 		samples1 = samples; | ||||
| 		while (samples1-- > 0) { | ||||
| 		frames1 = frames; | ||||
| 		while (frames1-- > 0) { | ||||
| 			goto *get; | ||||
| #define GET_S16_END after | ||||
| #include "plugin_ops.h" | ||||
|  | @ -230,14 +230,14 @@ static void alaw_encode(snd_pcm_plugin_t *plugin, | |||
| static ssize_t alaw_transfer(snd_pcm_plugin_t *plugin, | ||||
| 			     const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			     snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			     size_t samples) | ||||
| 			     size_t frames) | ||||
| { | ||||
| 	alaw_t *data; | ||||
| 	unsigned int voice; | ||||
| 
 | ||||
| 	if (plugin == NULL || src_voices == NULL || dst_voices == NULL) | ||||
| 		return -EFAULT; | ||||
| 	if (samples == 0) | ||||
| 	if (frames == 0) | ||||
| 		return 0; | ||||
| 	for (voice = 0; voice < plugin->src_format.voices; voice++) { | ||||
| 		if (src_voices[voice].area.first % 8 != 0 ||  | ||||
|  | @ -248,8 +248,8 @@ static ssize_t alaw_transfer(snd_pcm_plugin_t *plugin, | |||
| 			return -EINVAL; | ||||
| 	} | ||||
| 	data = (alaw_t *)plugin->extra_data; | ||||
| 	data->func(plugin, src_voices, dst_voices, samples); | ||||
|         return samples; | ||||
| 	data->func(plugin, src_voices, dst_voices, frames); | ||||
|         return frames; | ||||
| } | ||||
| 
 | ||||
| int snd_pcm_plugin_build_alaw(snd_pcm_plugin_handle_t *handle, | ||||
|  |  | |||
|  | @ -38,14 +38,14 @@ | |||
| static ssize_t copy_transfer(snd_pcm_plugin_t *plugin, | ||||
| 			     const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			     snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			     size_t samples) | ||||
| 			     size_t frames) | ||||
| { | ||||
| 	unsigned int voice; | ||||
| 	unsigned int nvoices; | ||||
| 
 | ||||
| 	if (plugin == NULL || src_voices == NULL || dst_voices == NULL) | ||||
| 		return -EFAULT; | ||||
| 	if (samples == 0) | ||||
| 	if (frames == 0) | ||||
| 		return 0; | ||||
| 	nvoices = plugin->src_format.voices; | ||||
| 	for (voice = 0; voice < nvoices; voice++) { | ||||
|  | @ -57,16 +57,16 @@ static ssize_t copy_transfer(snd_pcm_plugin_t *plugin, | |||
| 			return -EINVAL; | ||||
| 		if (!src_voices->enabled) { | ||||
| 			if (dst_voices->wanted) | ||||
| 				snd_pcm_area_silence(&dst_voices->area, 0, samples, plugin->dst_format.format); | ||||
| 				snd_pcm_area_silence(&dst_voices->area, 0, frames, plugin->dst_format.format); | ||||
| 			dst_voices->enabled = 0; | ||||
| 			continue; | ||||
| 		} | ||||
| 		dst_voices->enabled = 1; | ||||
| 		snd_pcm_area_copy(&src_voices->area, 0, &dst_voices->area, 0, samples, plugin->src_format.format); | ||||
| 		snd_pcm_area_copy(&src_voices->area, 0, &dst_voices->area, 0, frames, plugin->src_format.format); | ||||
| 		src_voices++; | ||||
| 		dst_voices++; | ||||
| 	} | ||||
| 	return samples; | ||||
| 	return frames; | ||||
| } | ||||
| 
 | ||||
| int snd_pcm_plugin_build_copy(snd_pcm_plugin_handle_t *handle, | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ typedef struct io_private_data { | |||
| static ssize_t io_transfer(snd_pcm_plugin_t *plugin, | ||||
| 			      const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			      snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			      size_t samples) | ||||
| 			      size_t frames) | ||||
| { | ||||
| 	io_t *data; | ||||
| 	ssize_t result; | ||||
|  | @ -64,7 +64,7 @@ static ssize_t io_transfer(snd_pcm_plugin_t *plugin, | |||
| 	if (plugin->channel == SND_PCM_CHANNEL_PLAYBACK) { | ||||
| 		if (src_voices == NULL) | ||||
| 			return -EINVAL; | ||||
| 		if ((result = snd_pcm_plugin_src_samples_to_size(plugin, samples)) < 0) | ||||
| 		if ((result = snd_pcm_plugin_src_frames_to_size(plugin, frames)) < 0) | ||||
| 			return result; | ||||
| 		count = plugin->src_format.voices; | ||||
| 		if (plugin->src_format.interleave) { | ||||
|  | @ -82,11 +82,11 @@ static ssize_t io_transfer(snd_pcm_plugin_t *plugin, | |||
| 		} | ||||
| 		if (result < 0) | ||||
| 			return result; | ||||
| 		return snd_pcm_plugin_src_size_to_samples(plugin, result); | ||||
| 		return snd_pcm_plugin_src_size_to_frames(plugin, result); | ||||
| 	} else if (plugin->channel == SND_PCM_CHANNEL_CAPTURE) { | ||||
| 		if (dst_voices == NULL) | ||||
| 			return -EINVAL; | ||||
| 		if ((result = snd_pcm_plugin_dst_samples_to_size(plugin, samples)) < 0) | ||||
| 		if ((result = snd_pcm_plugin_dst_frames_to_size(plugin, frames)) < 0) | ||||
| 			return result; | ||||
| 		count = plugin->dst_format.voices; | ||||
| 		if (plugin->dst_format.interleave) { | ||||
|  | @ -108,26 +108,26 @@ static ssize_t io_transfer(snd_pcm_plugin_t *plugin, | |||
| 		} | ||||
| 		if (result < 0) | ||||
| 			return result; | ||||
| 		return snd_pcm_plugin_dst_size_to_samples(plugin, result); | ||||
| 		return snd_pcm_plugin_dst_size_to_frames(plugin, result); | ||||
| 	} else { | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
| } | ||||
|   | ||||
| static ssize_t io_src_voices(snd_pcm_plugin_t *plugin, | ||||
| 			     size_t samples, | ||||
| 			     size_t frames, | ||||
| 			     snd_pcm_plugin_voice_t **voices) | ||||
| { | ||||
| 	int err; | ||||
| 	unsigned int voice; | ||||
| 	snd_pcm_plugin_voice_t *v; | ||||
| 	err = snd_pcm_plugin_client_voices(plugin, samples, &v); | ||||
| 	err = snd_pcm_plugin_client_voices(plugin, frames, &v); | ||||
| 	if (err < 0) | ||||
| 		return err; | ||||
| 	*voices = v; | ||||
| 	for (voice = 0; voice < plugin->src_format.voices; ++voice, ++v) | ||||
| 		v->wanted = 1; | ||||
| 	return samples; | ||||
| 	return frames; | ||||
| } | ||||
| 
 | ||||
| int snd_pcm_plugin_build_io(snd_pcm_plugin_handle_t *pcm, | ||||
|  |  | |||
|  | @ -47,7 +47,7 @@ typedef struct linear_private_data { | |||
| static void convert(snd_pcm_plugin_t *plugin, | ||||
| 		    const snd_pcm_plugin_voice_t *src_voices, | ||||
| 		    snd_pcm_plugin_voice_t *dst_voices, | ||||
| 		    size_t samples) | ||||
| 		    size_t frames) | ||||
| { | ||||
| #define CONV_LABELS | ||||
| #include "plugin_ops.h" | ||||
|  | @ -60,10 +60,10 @@ static void convert(snd_pcm_plugin_t *plugin, | |||
| 		char *src; | ||||
| 		char *dst; | ||||
| 		int src_step, dst_step; | ||||
| 		size_t samples1; | ||||
| 		size_t frames1; | ||||
| 		if (!src_voices[voice].enabled) { | ||||
| 			if (dst_voices[voice].wanted) | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, samples, plugin->dst_format.format); | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format); | ||||
| 			dst_voices[voice].enabled = 0; | ||||
| 			continue; | ||||
| 		} | ||||
|  | @ -72,8 +72,8 @@ static void convert(snd_pcm_plugin_t *plugin, | |||
| 		dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8; | ||||
| 		src_step = src_voices[voice].area.step / 8; | ||||
| 		dst_step = dst_voices[voice].area.step / 8; | ||||
| 		samples1 = samples; | ||||
| 		while (samples1-- > 0) { | ||||
| 		frames1 = frames; | ||||
| 		while (frames1-- > 0) { | ||||
| 			goto *conv; | ||||
| #define CONV_END after | ||||
| #include "plugin_ops.h" | ||||
|  | @ -88,7 +88,7 @@ static void convert(snd_pcm_plugin_t *plugin, | |||
| static ssize_t linear_transfer(snd_pcm_plugin_t *plugin, | ||||
| 			       const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			       snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			       size_t samples) | ||||
| 			       size_t frames) | ||||
| { | ||||
| 	linear_t *data; | ||||
| 	unsigned int voice; | ||||
|  | @ -96,7 +96,7 @@ static ssize_t linear_transfer(snd_pcm_plugin_t *plugin, | |||
| 	if (plugin == NULL || src_voices == NULL || dst_voices == NULL) | ||||
| 		return -EFAULT; | ||||
| 	data = (linear_t *)plugin->extra_data; | ||||
| 	if (samples == 0) | ||||
| 	if (frames == 0) | ||||
| 		return 0; | ||||
| 	for (voice = 0; voice < plugin->src_format.voices; voice++) { | ||||
| 		if (src_voices[voice].area.first % 8 != 0 ||  | ||||
|  | @ -106,8 +106,8 @@ static ssize_t linear_transfer(snd_pcm_plugin_t *plugin, | |||
| 		    dst_voices[voice].area.step % 8 != 0) | ||||
| 			return -EINVAL; | ||||
| 	} | ||||
| 	convert(plugin, src_voices, dst_voices, samples); | ||||
| 	return samples; | ||||
| 	convert(plugin, src_voices, dst_voices, frames); | ||||
| 	return frames; | ||||
| } | ||||
| 
 | ||||
| int conv_index(int src_format, int dst_format) | ||||
|  |  | |||
|  | @ -44,7 +44,7 @@ typedef struct mmap_private_data { | |||
| 
 | ||||
| 
 | ||||
| static ssize_t mmap_src_voices(snd_pcm_plugin_t *plugin, | ||||
| 			       size_t samples, | ||||
| 			       size_t frames, | ||||
| 			       snd_pcm_plugin_voice_t **voices) | ||||
| { | ||||
| 	mmap_t *data; | ||||
|  | @ -86,9 +86,9 @@ static ssize_t mmap_src_voices(snd_pcm_plugin_t *plugin, | |||
| 		assert(snd_pcm_mmap_ready(data->slave, plugin->channel)); | ||||
| 	} | ||||
| 	pos = ctrl->byte_data % setup->buffer_size; | ||||
| 	if ((pos * 8) % chan->bits_per_sample != 0) | ||||
| 	if ((pos * 8) % chan->bits_per_frame != 0) | ||||
| 		return -EINVAL; | ||||
| 	pos = (pos * 8) / chan->bits_per_sample; | ||||
| 	pos = (pos * 8) / chan->bits_per_frame; | ||||
| 
 | ||||
| 	sv = plugin->src_voices; | ||||
| 	dv = chan->voices; | ||||
|  | @ -107,11 +107,11 @@ static ssize_t mmap_src_voices(snd_pcm_plugin_t *plugin, | |||
| 		++sv; | ||||
| 		++dv; | ||||
| 	} | ||||
| 	return snd_pcm_mmap_samples_xfer(data->slave, plugin->channel, samples); | ||||
| 	return snd_pcm_mmap_frames_xfer(data->slave, plugin->channel, frames); | ||||
| } | ||||
| 
 | ||||
| static ssize_t mmap_dst_voices(snd_pcm_plugin_t *plugin, | ||||
| 			       size_t samples, | ||||
| 			       size_t frames, | ||||
| 			       snd_pcm_plugin_voice_t **voices) | ||||
| { | ||||
| 	mmap_t *data; | ||||
|  | @ -159,9 +159,9 @@ static ssize_t mmap_dst_voices(snd_pcm_plugin_t *plugin, | |||
| 		assert(snd_pcm_mmap_ready(data->slave, plugin->channel)); | ||||
| 	} | ||||
| 	pos = ctrl->byte_data % setup->buffer_size; | ||||
| 	if ((pos * 8) % chan->bits_per_sample != 0) | ||||
| 	if ((pos * 8) % chan->bits_per_frame != 0) | ||||
| 		return -EINVAL; | ||||
| 	pos = (pos * 8) / chan->bits_per_sample; | ||||
| 	pos = (pos * 8) / chan->bits_per_frame; | ||||
| 
 | ||||
| 	sv = chan->voices; | ||||
| 	dv = plugin->dst_voices; | ||||
|  | @ -176,13 +176,13 @@ static ssize_t mmap_dst_voices(snd_pcm_plugin_t *plugin, | |||
| 		++sv; | ||||
| 		++dv; | ||||
| 	} | ||||
| 	return snd_pcm_mmap_samples_xfer(data->slave, plugin->channel, samples); | ||||
| 	return snd_pcm_mmap_frames_xfer(data->slave, plugin->channel, frames); | ||||
| } | ||||
| 
 | ||||
| static ssize_t mmap_playback_transfer(snd_pcm_plugin_t *plugin, | ||||
| 				      const snd_pcm_plugin_voice_t *src_voices, | ||||
| 				      snd_pcm_plugin_voice_t *dst_voices UNUSED, | ||||
| 				      size_t samples) | ||||
| 				      size_t frames) | ||||
| { | ||||
| 	mmap_t *data; | ||||
| 	snd_pcm_channel_setup_t *setup; | ||||
|  | @ -210,7 +210,7 @@ static ssize_t mmap_playback_transfer(snd_pcm_plugin_t *plugin, | |||
| 	} | ||||
| #endif | ||||
| 
 | ||||
| 	snd_pcm_mmap_commit_samples(data->slave, SND_PCM_CHANNEL_PLAYBACK, samples); | ||||
| 	snd_pcm_mmap_commit_frames(data->slave, SND_PCM_CHANNEL_PLAYBACK, frames); | ||||
| 	if (ctrl->status == SND_PCM_STATUS_PREPARED && | ||||
| 	    (chan->setup.start_mode == SND_PCM_START_DATA || | ||||
| 	     (chan->setup.start_mode == SND_PCM_START_FULL && | ||||
|  | @ -219,13 +219,13 @@ static ssize_t mmap_playback_transfer(snd_pcm_plugin_t *plugin, | |||
| 		if (err < 0) | ||||
| 			return err; | ||||
| 	} | ||||
| 	return samples; | ||||
| 	return frames; | ||||
| } | ||||
|   | ||||
| static ssize_t mmap_capture_transfer(snd_pcm_plugin_t *plugin, | ||||
| 				     const snd_pcm_plugin_voice_t *src_voices UNUSED, | ||||
| 				     snd_pcm_plugin_voice_t *dst_voices UNUSED, | ||||
| 				     size_t samples) | ||||
| 				     size_t frames) | ||||
| { | ||||
| 	mmap_t *data; | ||||
| 	snd_pcm_channel_setup_t *setup; | ||||
|  | @ -243,8 +243,8 @@ static ssize_t mmap_capture_transfer(snd_pcm_plugin_t *plugin, | |||
| 	setup = &data->slave->chan[SND_PCM_CHANNEL_CAPTURE].setup; | ||||
| 
 | ||||
| 	/* FIXME: not here the increment */ | ||||
| 	snd_pcm_mmap_commit_samples(data->slave, SND_PCM_CHANNEL_CAPTURE, samples); | ||||
| 	return samples; | ||||
| 	snd_pcm_mmap_commit_frames(data->slave, SND_PCM_CHANNEL_CAPTURE, frames); | ||||
| 	return frames; | ||||
| } | ||||
|   | ||||
| static int mmap_action(snd_pcm_plugin_t *plugin, | ||||
|  |  | |||
|  | @ -151,7 +151,7 @@ static int ulaw2linear(unsigned char u_val) | |||
| typedef void (*mulaw_f)(snd_pcm_plugin_t *plugin, | ||||
| 			const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			size_t samples); | ||||
| 			size_t frames); | ||||
| 
 | ||||
| typedef struct mulaw_private_data { | ||||
| 	mulaw_f func; | ||||
|  | @ -161,7 +161,7 @@ typedef struct mulaw_private_data { | |||
| static void mulaw_decode(snd_pcm_plugin_t *plugin, | ||||
| 			const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			size_t samples) | ||||
| 			size_t frames) | ||||
| { | ||||
| #define PUT_S16_LABELS | ||||
| #include "plugin_ops.h" | ||||
|  | @ -174,10 +174,10 @@ static void mulaw_decode(snd_pcm_plugin_t *plugin, | |||
| 		char *src; | ||||
| 		char *dst; | ||||
| 		int src_step, dst_step; | ||||
| 		size_t samples1; | ||||
| 		size_t frames1; | ||||
| 		if (!src_voices[voice].enabled) { | ||||
| 			if (dst_voices[voice].wanted) | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, samples, plugin->dst_format.format); | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format); | ||||
| 			dst_voices[voice].enabled = 0; | ||||
| 			continue; | ||||
| 		} | ||||
|  | @ -186,8 +186,8 @@ static void mulaw_decode(snd_pcm_plugin_t *plugin, | |||
| 		dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8; | ||||
| 		src_step = src_voices[voice].area.step / 8; | ||||
| 		dst_step = dst_voices[voice].area.step / 8; | ||||
| 		samples1 = samples; | ||||
| 		while (samples1-- > 0) { | ||||
| 		frames1 = frames; | ||||
| 		while (frames1-- > 0) { | ||||
| 			signed short sample = ulaw2linear(*src); | ||||
| 			goto *put; | ||||
| #define PUT_S16_END after | ||||
|  | @ -203,7 +203,7 @@ static void mulaw_decode(snd_pcm_plugin_t *plugin, | |||
| static void mulaw_encode(snd_pcm_plugin_t *plugin, | ||||
| 			const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			size_t samples) | ||||
| 			size_t frames) | ||||
| { | ||||
| #define GET_S16_LABELS | ||||
| #include "plugin_ops.h" | ||||
|  | @ -217,10 +217,10 @@ static void mulaw_encode(snd_pcm_plugin_t *plugin, | |||
| 		char *src; | ||||
| 		char *dst; | ||||
| 		int src_step, dst_step; | ||||
| 		size_t samples1; | ||||
| 		size_t frames1; | ||||
| 		if (!src_voices[voice].enabled) { | ||||
| 			if (dst_voices[voice].wanted) | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, samples, plugin->dst_format.format); | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format); | ||||
| 			dst_voices[voice].enabled = 0; | ||||
| 			continue; | ||||
| 		} | ||||
|  | @ -229,8 +229,8 @@ static void mulaw_encode(snd_pcm_plugin_t *plugin, | |||
| 		dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8; | ||||
| 		src_step = src_voices[voice].area.step / 8; | ||||
| 		dst_step = dst_voices[voice].area.step / 8; | ||||
| 		samples1 = samples; | ||||
| 		while (samples1-- > 0) { | ||||
| 		frames1 = frames; | ||||
| 		while (frames1-- > 0) { | ||||
| 			goto *get; | ||||
| #define GET_S16_END after | ||||
| #include "plugin_ops.h" | ||||
|  | @ -246,14 +246,14 @@ static void mulaw_encode(snd_pcm_plugin_t *plugin, | |||
| static ssize_t mulaw_transfer(snd_pcm_plugin_t *plugin, | ||||
| 			      const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			      snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			      size_t samples) | ||||
| 			      size_t frames) | ||||
| { | ||||
| 	mulaw_t *data; | ||||
| 	unsigned int voice; | ||||
| 
 | ||||
| 	if (plugin == NULL || src_voices == NULL || dst_voices == NULL) | ||||
| 		return -EFAULT; | ||||
| 	if (samples == 0) | ||||
| 	if (frames == 0) | ||||
| 		return 0; | ||||
| 	for (voice = 0; voice < plugin->src_format.voices; voice++) { | ||||
| 		if (src_voices[voice].area.first % 8 != 0 ||  | ||||
|  | @ -264,8 +264,8 @@ static ssize_t mulaw_transfer(snd_pcm_plugin_t *plugin, | |||
| 			return -EINVAL; | ||||
| 	} | ||||
| 	data = (mulaw_t *)plugin->extra_data; | ||||
| 	data->func(plugin, src_voices, dst_voices, samples); | ||||
| 	return samples; | ||||
| 	data->func(plugin, src_voices, dst_voices, frames); | ||||
| 	return frames; | ||||
| } | ||||
| 
 | ||||
| int snd_pcm_plugin_build_mulaw(snd_pcm_plugin_handle_t *handle, | ||||
|  |  | |||
|  | @ -50,14 +50,14 @@ typedef struct { | |||
| typedef void (*rate_f)(snd_pcm_plugin_t *plugin, | ||||
| 		       const snd_pcm_plugin_voice_t *src_voices, | ||||
| 		       snd_pcm_plugin_voice_t *dst_voices, | ||||
| 		       int src_samples, int dst_samples); | ||||
| 		       int src_frames, int dst_frames); | ||||
| 
 | ||||
| typedef struct rate_private_data { | ||||
| 	unsigned int pitch; | ||||
| 	unsigned int pos; | ||||
| 	rate_f func; | ||||
| 	int get, put; | ||||
| 	ssize_t old_src_samples, old_dst_samples; | ||||
| 	ssize_t old_src_frames, old_dst_frames; | ||||
| 	rate_voice_t voices[0]; | ||||
| } rate_t; | ||||
| 
 | ||||
|  | @ -75,7 +75,7 @@ static void rate_init(snd_pcm_plugin_t *plugin) | |||
| static void resample_expand(snd_pcm_plugin_t *plugin, | ||||
| 			    const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			    snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			    int src_samples, int dst_samples) | ||||
| 			    int src_frames, int dst_frames) | ||||
| { | ||||
| 	unsigned int pos = 0; | ||||
| 	signed int val; | ||||
|  | @ -83,7 +83,7 @@ static void resample_expand(snd_pcm_plugin_t *plugin, | |||
| 	char *src, *dst; | ||||
| 	unsigned int voice; | ||||
| 	int src_step, dst_step; | ||||
| 	int src_samples1, dst_samples1; | ||||
| 	int src_frames1, dst_frames1; | ||||
| 	rate_t *data = (rate_t *)plugin->extra_data; | ||||
| 	rate_voice_t *rvoices = data->voices; | ||||
| 
 | ||||
|  | @ -106,7 +106,7 @@ static void resample_expand(snd_pcm_plugin_t *plugin, | |||
| 		S2 = rvoices->last_S2; | ||||
| 		if (!src_voices[voice].enabled) { | ||||
| 			if (dst_voices[voice].wanted) | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, dst_samples, plugin->dst_format.format); | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, dst_frames, plugin->dst_format.format); | ||||
| 			dst_voices[voice].enabled = 0; | ||||
| 			continue; | ||||
| 		} | ||||
|  | @ -115,8 +115,8 @@ static void resample_expand(snd_pcm_plugin_t *plugin, | |||
| 		dst = (char *)dst_voices[voice].area.addr + dst_voices[voice].area.first / 8; | ||||
| 		src_step = src_voices[voice].area.step / 8; | ||||
| 		dst_step = dst_voices[voice].area.step / 8; | ||||
| 		src_samples1 = src_samples; | ||||
| 		dst_samples1 = dst_samples; | ||||
| 		src_frames1 = src_frames; | ||||
| 		dst_frames1 = dst_frames; | ||||
| 		if (pos & ~MASK) { | ||||
| 			get_s16_end = &&after_get1; | ||||
| 			goto *get; | ||||
|  | @ -125,13 +125,13 @@ static void resample_expand(snd_pcm_plugin_t *plugin, | |||
| 			S1 = S2; | ||||
| 			S2 = sample; | ||||
| 			src += src_step; | ||||
| 			src_samples--; | ||||
| 			src_frames--; | ||||
| 		} | ||||
| 		while (dst_samples1-- > 0) { | ||||
| 		while (dst_frames1-- > 0) { | ||||
| 			if (pos & ~MASK) { | ||||
| 				pos &= MASK; | ||||
| 				S1 = S2; | ||||
| 				if (src_samples1-- > 0) { | ||||
| 				if (src_frames1-- > 0) { | ||||
| 					get_s16_end = &&after_get2; | ||||
| 					goto *get; | ||||
| 				after_get2: | ||||
|  | @ -163,7 +163,7 @@ static void resample_expand(snd_pcm_plugin_t *plugin, | |||
| static void resample_shrink(snd_pcm_plugin_t *plugin, | ||||
| 			    const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			    snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			    int src_samples, int dst_samples) | ||||
| 			    int src_frames, int dst_frames) | ||||
| { | ||||
| 	unsigned int pos = 0; | ||||
| 	signed int val; | ||||
|  | @ -171,7 +171,7 @@ static void resample_shrink(snd_pcm_plugin_t *plugin, | |||
| 	char *src, *dst; | ||||
| 	unsigned int voice; | ||||
| 	int src_step, dst_step; | ||||
| 	int src_samples1, dst_samples1; | ||||
| 	int src_frames1, dst_frames1; | ||||
| 	rate_t *data = (rate_t *)plugin->extra_data; | ||||
| 	rate_voice_t *rvoices = data->voices; | ||||
| 	 | ||||
|  | @ -190,7 +190,7 @@ static void resample_shrink(snd_pcm_plugin_t *plugin, | |||
| 		S2 = rvoices->last_S2; | ||||
| 		if (!src_voices[voice].enabled) { | ||||
| 			if (dst_voices[voice].wanted) | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, dst_samples, plugin->dst_format.format); | ||||
| 				snd_pcm_area_silence(&dst_voices[voice].area, 0, dst_frames, plugin->dst_format.format); | ||||
| 			dst_voices[voice].enabled = 0; | ||||
| 			continue; | ||||
| 		} | ||||
|  | @ -199,11 +199,11 @@ static void resample_shrink(snd_pcm_plugin_t *plugin, | |||
| 		dst = (char *)dst_voices[voice].area.addr + dst_voices[voice].area.first / 8; | ||||
| 		src_step = src_voices[voice].area.step / 8; | ||||
| 		dst_step = dst_voices[voice].area.step / 8; | ||||
| 		src_samples1 = src_samples; | ||||
| 		dst_samples1 = dst_samples; | ||||
| 		while (dst_samples1 > 0) { | ||||
| 		src_frames1 = src_frames; | ||||
| 		dst_frames1 = dst_frames; | ||||
| 		while (dst_frames1 > 0) { | ||||
| 			S1 = S2; | ||||
| 			if (src_samples1-- > 0) { | ||||
| 			if (src_frames1-- > 0) { | ||||
| 				goto *get; | ||||
| #define GET_S16_END after_get | ||||
| #include "plugin_ops.h" | ||||
|  | @ -226,7 +226,7 @@ static void resample_shrink(snd_pcm_plugin_t *plugin, | |||
| #undef PUT_S16_END | ||||
| 			after_put: | ||||
| 				dst += dst_step; | ||||
| 				dst_samples1--; | ||||
| 				dst_frames1--; | ||||
| 			} | ||||
| 			pos += data->pitch; | ||||
| 		} | ||||
|  | @ -237,80 +237,80 @@ static void resample_shrink(snd_pcm_plugin_t *plugin, | |||
| 	data->pos = pos; | ||||
| } | ||||
| 
 | ||||
| static ssize_t rate_src_samples(snd_pcm_plugin_t *plugin, size_t samples) | ||||
| static ssize_t rate_src_frames(snd_pcm_plugin_t *plugin, size_t frames) | ||||
| { | ||||
| 	rate_t *data; | ||||
| 	ssize_t res; | ||||
| 
 | ||||
| 	if (plugin == NULL || samples <= 0) | ||||
| 	if (plugin == NULL || frames <= 0) | ||||
| 		return -EINVAL; | ||||
| 	data = (rate_t *)plugin->extra_data; | ||||
| 	if (plugin->src_format.rate < plugin->dst_format.rate) { | ||||
| 		res = (((samples * data->pitch) + (BITS/2)) >> SHIFT); | ||||
| 		res = (((frames * data->pitch) + (BITS/2)) >> SHIFT); | ||||
| 	} else { | ||||
| 		res = (((samples << SHIFT) + (data->pitch / 2)) / data->pitch);		 | ||||
| 		res = (((frames << SHIFT) + (data->pitch / 2)) / data->pitch);		 | ||||
| 	} | ||||
| 	if (data->old_src_samples > 0) { | ||||
| 		ssize_t samples1 = samples, res1 = data->old_dst_samples; | ||||
| 		while (data->old_src_samples < samples1) { | ||||
| 			samples1 >>= 1; | ||||
| 	if (data->old_src_frames > 0) { | ||||
| 		ssize_t frames1 = frames, res1 = data->old_dst_frames; | ||||
| 		while (data->old_src_frames < frames1) { | ||||
| 			frames1 >>= 1; | ||||
| 			res1 <<= 1; | ||||
| 		} | ||||
| 		while (data->old_src_samples > samples1) { | ||||
| 			samples1 <<= 1; | ||||
| 		while (data->old_src_frames > frames1) { | ||||
| 			frames1 <<= 1; | ||||
| 			res1 >>= 1; | ||||
| 		} | ||||
| 		if (data->old_src_samples == samples1) | ||||
| 		if (data->old_src_frames == frames1) | ||||
| 			return res1; | ||||
| 	} | ||||
| 	data->old_src_samples = samples; | ||||
| 	data->old_dst_samples = res; | ||||
| 	data->old_src_frames = frames; | ||||
| 	data->old_dst_frames = res; | ||||
| 	return res; | ||||
| } | ||||
| 
 | ||||
| static ssize_t rate_dst_samples(snd_pcm_plugin_t *plugin, size_t samples) | ||||
| static ssize_t rate_dst_frames(snd_pcm_plugin_t *plugin, size_t frames) | ||||
| { | ||||
| 	rate_t *data; | ||||
| 	ssize_t res; | ||||
| 
 | ||||
| 	if (plugin == NULL || samples <= 0) | ||||
| 	if (plugin == NULL || frames <= 0) | ||||
| 		return -EINVAL; | ||||
| 	data = (rate_t *)plugin->extra_data; | ||||
| 	if (plugin->src_format.rate < plugin->dst_format.rate) { | ||||
| 		res = (((samples << SHIFT) + (data->pitch / 2)) / data->pitch); | ||||
| 		res = (((frames << SHIFT) + (data->pitch / 2)) / data->pitch); | ||||
| 	} else { | ||||
| 		res = (((samples * data->pitch) + (BITS/2)) >> SHIFT); | ||||
| 		res = (((frames * data->pitch) + (BITS/2)) >> SHIFT); | ||||
| 	} | ||||
| 	if (data->old_dst_samples > 0) { | ||||
| 		ssize_t samples1 = samples, res1 = data->old_src_samples; | ||||
| 		while (data->old_dst_samples < samples1) { | ||||
| 			samples1 >>= 1; | ||||
| 	if (data->old_dst_frames > 0) { | ||||
| 		ssize_t frames1 = frames, res1 = data->old_src_frames; | ||||
| 		while (data->old_dst_frames < frames1) { | ||||
| 			frames1 >>= 1; | ||||
| 			res1 <<= 1; | ||||
| 		} | ||||
| 		while (data->old_dst_samples > samples1) { | ||||
| 			samples1 <<= 1; | ||||
| 		while (data->old_dst_frames > frames1) { | ||||
| 			frames1 <<= 1; | ||||
| 			res1 >>= 1; | ||||
| 		} | ||||
| 		if (data->old_dst_samples == samples1) | ||||
| 		if (data->old_dst_frames == frames1) | ||||
| 			return res1; | ||||
| 	} | ||||
| 	data->old_dst_samples = samples; | ||||
| 	data->old_src_samples = res; | ||||
| 	data->old_dst_frames = frames; | ||||
| 	data->old_src_frames = res; | ||||
| 	return res; | ||||
| } | ||||
| 
 | ||||
| static ssize_t rate_transfer(snd_pcm_plugin_t *plugin, | ||||
| 			     const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			     snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			     size_t samples) | ||||
| 			     size_t frames) | ||||
| { | ||||
| 	size_t dst_samples; | ||||
| 	size_t dst_frames; | ||||
| 	unsigned int voice; | ||||
| 	rate_t *data; | ||||
| 
 | ||||
| 	if (plugin == NULL || src_voices == NULL || dst_voices == NULL) | ||||
| 		return -EFAULT; | ||||
| 	if (samples == 0) | ||||
| 	if (frames == 0) | ||||
| 		return 0; | ||||
| 	for (voice = 0; voice < plugin->src_format.voices; voice++) { | ||||
| 		if (src_voices[voice].area.first % 8 != 0 ||  | ||||
|  | @ -321,10 +321,10 @@ static ssize_t rate_transfer(snd_pcm_plugin_t *plugin, | |||
| 			return -EINVAL; | ||||
| 	} | ||||
| 
 | ||||
| 	dst_samples = rate_dst_samples(plugin, samples); | ||||
| 	dst_frames = rate_dst_frames(plugin, frames); | ||||
| 	data = (rate_t *)plugin->extra_data; | ||||
| 	data->func(plugin, src_voices, dst_voices, samples, dst_samples); | ||||
| 	return dst_samples; | ||||
| 	data->func(plugin, src_voices, dst_voices, frames, dst_frames); | ||||
| 	return dst_frames; | ||||
| } | ||||
| 
 | ||||
| static int rate_action(snd_pcm_plugin_t *plugin, | ||||
|  | @ -392,10 +392,10 @@ int snd_pcm_plugin_build_rate(snd_pcm_plugin_handle_t *handle, | |||
| 	} | ||||
| 	data->pos = 0; | ||||
| 	rate_init(plugin); | ||||
| 	data->old_src_samples = data->old_dst_samples = 0; | ||||
| 	data->old_src_frames = data->old_dst_frames = 0; | ||||
| 	plugin->transfer = rate_transfer; | ||||
| 	plugin->src_samples = rate_src_samples; | ||||
| 	plugin->dst_samples = rate_dst_samples; | ||||
| 	plugin->src_frames = rate_src_frames; | ||||
| 	plugin->dst_frames = rate_dst_frames; | ||||
| 	plugin->action = rate_action; | ||||
| 	*r_plugin = plugin; | ||||
| 	return 0; | ||||
|  |  | |||
|  | @ -35,13 +35,22 @@ | |||
| #include "../pcm_local.h" | ||||
| #endif | ||||
| 
 | ||||
| /* The best possible hack to support missing optimization in gcc 2.7.2.3 */ | ||||
| #if ROUTE_PLUGIN_RESOLUTION & (ROUTE_PLUGIN_RESOLUTION - 1) != 0 | ||||
| #define div(a) a /= ROUTE_PLUGIN_RESOLUTION | ||||
| #elif ROUTE_PLUGIN_RESOLUTION == 16 | ||||
| #define div(a) a >>= 4 | ||||
| #else | ||||
| #error "Add some code here" | ||||
| #endif | ||||
| 
 | ||||
| typedef struct ttable_dst ttable_dst_t; | ||||
| typedef struct route_private_data route_t; | ||||
| 
 | ||||
| typedef void (*route_voice_f)(snd_pcm_plugin_t *plugin, | ||||
| 			      const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			      snd_pcm_plugin_voice_t *dst_voice, | ||||
| 			      ttable_dst_t* ttable, size_t samples); | ||||
| 			      ttable_dst_t* ttable, size_t frames); | ||||
| 
 | ||||
| typedef struct { | ||||
| 	int voice; | ||||
|  | @ -78,17 +87,17 @@ typedef union { | |||
| static void route_to_voice_from_zero(snd_pcm_plugin_t *plugin, | ||||
| 				     const snd_pcm_plugin_voice_t *src_voices UNUSED, | ||||
| 				     snd_pcm_plugin_voice_t *dst_voice, | ||||
| 				     ttable_dst_t* ttable UNUSED, size_t samples) | ||||
| 				     ttable_dst_t* ttable UNUSED, size_t frames) | ||||
| { | ||||
| 	if (dst_voice->wanted) | ||||
| 		snd_pcm_area_silence(&dst_voice->area, 0, samples, plugin->dst_format.format); | ||||
| 		snd_pcm_area_silence(&dst_voice->area, 0, frames, plugin->dst_format.format); | ||||
| 	dst_voice->enabled = 0; | ||||
| } | ||||
| 
 | ||||
| static void route_to_voice_from_one(snd_pcm_plugin_t *plugin, | ||||
| 				    const snd_pcm_plugin_voice_t *src_voices, | ||||
| 				    snd_pcm_plugin_voice_t *dst_voice, | ||||
| 				    ttable_dst_t* ttable, size_t samples) | ||||
| 				    ttable_dst_t* ttable, size_t frames) | ||||
| { | ||||
| #define CONV_LABELS | ||||
| #include "plugin_ops.h" | ||||
|  | @ -105,7 +114,7 @@ static void route_to_voice_from_one(snd_pcm_plugin_t *plugin, | |||
| 			break; | ||||
| 	} | ||||
| 	if (srcidx == ttable->nsrcs) { | ||||
| 		route_to_voice_from_zero(plugin, src_voices, dst_voice, ttable, samples); | ||||
| 		route_to_voice_from_zero(plugin, src_voices, dst_voice, ttable, frames); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -115,7 +124,7 @@ static void route_to_voice_from_one(snd_pcm_plugin_t *plugin, | |||
| 	src_step = src_voice->area.step / 8; | ||||
| 	dst = dst_voice->area.addr + dst_voice->area.first / 8; | ||||
| 	dst_step = dst_voice->area.step / 8; | ||||
| 	while (samples-- > 0) { | ||||
| 	while (frames-- > 0) { | ||||
| 		goto *conv; | ||||
| #define CONV_END after | ||||
| #include "plugin_ops.h" | ||||
|  | @ -129,7 +138,7 @@ static void route_to_voice_from_one(snd_pcm_plugin_t *plugin, | |||
| static void route_to_voice(snd_pcm_plugin_t *plugin, | ||||
| 			   const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			   snd_pcm_plugin_voice_t *dst_voice, | ||||
| 			   ttable_dst_t* ttable, size_t samples) | ||||
| 			   ttable_dst_t* ttable, size_t frames) | ||||
| { | ||||
| #define GET_U_LABELS | ||||
| #define PUT_U32_LABELS | ||||
|  | @ -197,10 +206,10 @@ static void route_to_voice(snd_pcm_plugin_t *plugin, | |||
| 	} | ||||
| 	nsrcs = srcidx1; | ||||
| 	if (nsrcs == 0) { | ||||
| 		route_to_voice_from_zero(plugin, src_voices, dst_voice, ttable, samples); | ||||
| 		route_to_voice_from_zero(plugin, src_voices, dst_voice, ttable, frames); | ||||
| 		return; | ||||
| 	} else if (nsrcs == 1 && src_tt[0].as_int == ROUTE_PLUGIN_RESOLUTION) { | ||||
| 		route_to_voice_from_one(plugin, src_voices, dst_voice, ttable, samples); | ||||
| 		route_to_voice_from_one(plugin, src_voices, dst_voice, ttable, frames); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -213,7 +222,7 @@ static void route_to_voice(snd_pcm_plugin_t *plugin, | |||
| 	dst = dst_voice->area.addr + dst_voice->area.first / 8; | ||||
| 	dst_step = dst_voice->area.step / 8; | ||||
| 
 | ||||
| 	while (samples-- > 0) { | ||||
| 	while (frames-- > 0) { | ||||
| 		ttable_src_t *ttp = src_tt; | ||||
| 		sum_t sum; | ||||
| 
 | ||||
|  | @ -277,21 +286,21 @@ static void route_to_voice(snd_pcm_plugin_t *plugin, | |||
| 	norm_int64_8_att: | ||||
| 		sum.as_uint64 <<= 8; | ||||
| 	norm_int64_0_att: | ||||
| 		sum.as_uint64 /= ROUTE_PLUGIN_RESOLUTION; | ||||
| 		div(sum.as_uint64); | ||||
| 		goto norm_int; | ||||
| 
 | ||||
| 	norm_int32_16_att: | ||||
| 		sum.as_uint64 = sum.as_uint32; | ||||
| 	norm_int64_16_att: | ||||
| 		sum.as_uint64 <<= 16; | ||||
| 		sum.as_uint64 /= ROUTE_PLUGIN_RESOLUTION; | ||||
| 		div(sum.as_uint64); | ||||
| 		goto norm_int; | ||||
| 
 | ||||
| 	norm_int32_24_att: | ||||
| 		sum.as_uint64 = sum.as_uint32; | ||||
| 	norm_int64_24_att: | ||||
| 		sum.as_uint64 <<= 24; | ||||
| 		sum.as_uint64 /= ROUTE_PLUGIN_RESOLUTION; | ||||
| 		div(sum.as_uint64); | ||||
| 		goto norm_int; | ||||
| 
 | ||||
| 	norm_int32_8_noatt: | ||||
|  | @ -478,7 +487,7 @@ static int route_load_ttable(snd_pcm_plugin_t *plugin, | |||
| static ssize_t route_transfer(snd_pcm_plugin_t *plugin, | ||||
| 			      const snd_pcm_plugin_voice_t *src_voices, | ||||
| 			      snd_pcm_plugin_voice_t *dst_voices, | ||||
| 			      size_t samples) | ||||
| 			      size_t frames) | ||||
| { | ||||
| 	route_t *data; | ||||
| 	int src_nvoices, dst_nvoices; | ||||
|  | @ -488,7 +497,7 @@ static ssize_t route_transfer(snd_pcm_plugin_t *plugin, | |||
| 
 | ||||
| 	if (plugin == NULL || src_voices == NULL || dst_voices == NULL) | ||||
| 		return -EFAULT; | ||||
| 	if (samples == 0) | ||||
| 	if (frames == 0) | ||||
| 		return 0; | ||||
| 	data = (route_t *)plugin->extra_data; | ||||
| 
 | ||||
|  | @ -509,11 +518,11 @@ static ssize_t route_transfer(snd_pcm_plugin_t *plugin, | |||
| 	ttp = data->ttable; | ||||
| 	dvp = dst_voices; | ||||
| 	for (dst_voice = 0; dst_voice < dst_nvoices; ++dst_voice) { | ||||
| 		ttp->func(plugin, src_voices, dvp, ttp, samples); | ||||
| 		ttp->func(plugin, src_voices, dvp, ttp, frames); | ||||
| 		dvp++; | ||||
| 		ttp++; | ||||
| 	} | ||||
| 	return samples; | ||||
| 	return frames; | ||||
| } | ||||
| 
 | ||||
| int getput_index(int format) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Abramo Bagnara
						Abramo Bagnara