mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	Completed PCM documentation
This commit is contained in:
		
							parent
							
								
									10a2d4267f
								
							
						
					
					
						commit
						ddc9a186cf
					
				
					 13 changed files with 2899 additions and 1320 deletions
				
			
		| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
EXTRA_LTLIBRARIES = libpcm.la
 | 
			
		||||
 | 
			
		||||
libpcm_la_SOURCES = atomic.c mask.c interval.c \
 | 
			
		||||
		    pcm.c pcm_m4.c pcm_hw.c pcm_plugin.c pcm_copy.c pcm_linear.c \
 | 
			
		||||
		    pcm.c pcm_hw.c pcm_plugin.c pcm_copy.c pcm_linear.c \
 | 
			
		||||
		    pcm_route.c pcm_mulaw.c pcm_alaw.c pcm_adpcm.c \
 | 
			
		||||
		    pcm_rate.c pcm_plug.c pcm_misc.c pcm_mmap.c pcm_multi.c \
 | 
			
		||||
	            pcm_shm.c pcm_file.c pcm_null.c pcm_share.c \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2587
									
								
								src/pcm/pcm.c
									
										
									
									
									
								
							
							
						
						
									
										2587
									
								
								src/pcm/pcm.c
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -409,7 +409,7 @@ static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
	assert(!adpcm->states);
 | 
			
		||||
	adpcm->states = malloc(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_CHANNELS, 0) * sizeof(*adpcm->states));
 | 
			
		||||
	adpcm->states = malloc(adpcm->plug.slave->channels * sizeof(*adpcm->states));
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -475,12 +475,16 @@ int snd_pcm_hw_param_set(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
 | 
			
		|||
int snd_pcm_hw_param_set_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
 | 
			
		||||
			      snd_set_mode_t mode,
 | 
			
		||||
			      snd_pcm_hw_param_t var, const snd_mask_t *mask);
 | 
			
		||||
unsigned int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params,
 | 
			
		||||
				  snd_pcm_hw_param_t var, int *dir);
 | 
			
		||||
int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params,
 | 
			
		||||
			 snd_pcm_hw_param_t var, int *dir);
 | 
			
		||||
unsigned int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params,
 | 
			
		||||
				      snd_pcm_hw_param_t var, int *dir);
 | 
			
		||||
unsigned int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params,
 | 
			
		||||
				      snd_pcm_hw_param_t var, int *dir);
 | 
			
		||||
const char *snd_pcm_hw_param_name(snd_pcm_hw_param_t param);
 | 
			
		||||
void snd_pcm_hw_param_dump(const snd_pcm_hw_params_t *params,
 | 
			
		||||
			   snd_pcm_hw_param_t var, snd_output_t *out);
 | 
			
		||||
#if 0
 | 
			
		||||
int snd_pcm_hw_strategy_simple_near(snd_pcm_hw_strategy_t *strategy, int order,
 | 
			
		||||
				    snd_pcm_hw_param_t var,
 | 
			
		||||
				    unsigned int best,
 | 
			
		||||
| 
						 | 
				
			
			@ -489,6 +493,7 @@ int snd_pcm_hw_strategy_simple_choices(snd_pcm_hw_strategy_t *strategy, int orde
 | 
			
		|||
				       snd_pcm_hw_param_t var,
 | 
			
		||||
				       unsigned int count,
 | 
			
		||||
				       snd_pcm_hw_strategy_simple_choices_list_t *choices);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int snd_pcm_slave_conf(snd_config_t *conf, const char **namep,
 | 
			
		||||
		       unsigned int count, ...);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1103
									
								
								src/pcm/pcm_m4.c
									
										
									
									
									
								
							
							
						
						
									
										1103
									
								
								src/pcm/pcm_m4.c
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -1,3 +1,8 @@
 | 
			
		|||
/**
 | 
			
		||||
 * \file pcm/pcm_meter.c
 | 
			
		||||
 * \author Abramo Bagnara <abramo@alsa-project.org>
 | 
			
		||||
 * \date 2001
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 *  PCM - Meter plugin
 | 
			
		||||
 *  Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
 | 
			
		||||
| 
						 | 
				
			
			@ -18,6 +23,8 @@
 | 
			
		|||
 *
 | 
			
		||||
 */
 | 
			
		||||
  
 | 
			
		||||
#ifndef DOC_HIDDEN
 | 
			
		||||
 | 
			
		||||
#include <byteswap.h>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#include <pthread.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -163,21 +170,6 @@ int snd_pcm_scope_disable(snd_pcm_scope_t *scope)
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name)
 | 
			
		||||
{
 | 
			
		||||
	snd_pcm_meter_t *meter;
 | 
			
		||||
	struct list_head *pos;
 | 
			
		||||
	assert(pcm->type == SND_PCM_TYPE_METER);
 | 
			
		||||
	meter = pcm->private_data;
 | 
			
		||||
	list_for_each(pos, &meter->scopes) {
 | 
			
		||||
		snd_pcm_scope_t *scope;
 | 
			
		||||
		scope = list_entry(pos, snd_pcm_scope_t, list);
 | 
			
		||||
		if (scope->name && strcmp(scope->name, name) == 0)
 | 
			
		||||
			return scope;
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void *snd_pcm_meter_thread(void *data)
 | 
			
		||||
{
 | 
			
		||||
	snd_pcm_t *pcm = data;
 | 
			
		||||
| 
						 | 
				
			
			@ -785,6 +777,14 @@ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Add a scope to a #SND_PCM_TYPE_METER PCM
 | 
			
		||||
 * \param pcm PCM handle
 | 
			
		||||
 * \param scope Scope handle
 | 
			
		||||
 * \return zero on success otherwise a negative error code
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope)
 | 
			
		||||
{
 | 
			
		||||
	snd_pcm_meter_t *meter;
 | 
			
		||||
| 
						 | 
				
			
			@ -794,14 +794,46 @@ int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope)
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Search an installed scope inside a #SND_PCM_TYPE_METER PCM
 | 
			
		||||
 * \param pcm PCM handle
 | 
			
		||||
 * \param name scope name
 | 
			
		||||
 * \return pointer to found scope or NULL if none is found
 | 
			
		||||
 */
 | 
			
		||||
snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name)
 | 
			
		||||
{
 | 
			
		||||
	snd_pcm_meter_t *meter;
 | 
			
		||||
	struct list_head *pos;
 | 
			
		||||
	assert(pcm->type == SND_PCM_TYPE_METER);
 | 
			
		||||
	meter = pcm->private_data;
 | 
			
		||||
	list_for_each(pos, &meter->scopes) {
 | 
			
		||||
		snd_pcm_scope_t *scope;
 | 
			
		||||
		scope = list_entry(pos, snd_pcm_scope_t, list);
 | 
			
		||||
		if (scope->name && strcmp(scope->name, name) == 0)
 | 
			
		||||
			return scope;
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Get meter buffer size from a #SND_PCM_TYPE_METER PCM
 | 
			
		||||
 * \param pcm PCM handle
 | 
			
		||||
 * \return meter buffer size in frames
 | 
			
		||||
 */
 | 
			
		||||
snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t *pcm)
 | 
			
		||||
{
 | 
			
		||||
	snd_pcm_meter_t *meter;
 | 
			
		||||
	assert(pcm->type == SND_PCM_TYPE_METER);
 | 
			
		||||
	meter = pcm->private_data;
 | 
			
		||||
	assert(meter->slave->setup);
 | 
			
		||||
	return meter->buf_size;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Get meter channels from a #SND_PCM_TYPE_METER PCM
 | 
			
		||||
 * \param pcm PCM handle
 | 
			
		||||
 * \return meter channels count
 | 
			
		||||
 */
 | 
			
		||||
unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm)
 | 
			
		||||
{
 | 
			
		||||
	snd_pcm_meter_t *meter;
 | 
			
		||||
| 
						 | 
				
			
			@ -811,6 +843,11 @@ unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm)
 | 
			
		|||
	return meter->slave->channels;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Get meter rate from a #SND_PCM_TYPE_METER PCM
 | 
			
		||||
 * \param pcm PCM handle
 | 
			
		||||
 * \return approximate rate
 | 
			
		||||
 */
 | 
			
		||||
unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm)
 | 
			
		||||
{
 | 
			
		||||
	snd_pcm_meter_t *meter;
 | 
			
		||||
| 
						 | 
				
			
			@ -820,6 +857,11 @@ unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm)
 | 
			
		|||
	return meter->slave->rate;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Get meter "now" frame pointer from a #SND_PCM_TYPE_METER PCM
 | 
			
		||||
 * \param pcm PCM handle
 | 
			
		||||
 * \return "now" frame pointer in frames (0 ... boundary - 1) see #snd_pcm_meter_get_boundary
 | 
			
		||||
 */
 | 
			
		||||
snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm)
 | 
			
		||||
{
 | 
			
		||||
	snd_pcm_meter_t *meter;
 | 
			
		||||
| 
						 | 
				
			
			@ -829,6 +871,11 @@ snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm)
 | 
			
		|||
	return meter->now;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Get boundary for frame pointers from a #SND_PCM_TYPE_METER PCM
 | 
			
		||||
 * \param pcm PCM handle
 | 
			
		||||
 * \return boundary in frames
 | 
			
		||||
 */
 | 
			
		||||
snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm)
 | 
			
		||||
{
 | 
			
		||||
	snd_pcm_meter_t *meter;
 | 
			
		||||
| 
						 | 
				
			
			@ -838,31 +885,57 @@ snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm)
 | 
			
		|||
	return meter->slave->boundary;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Set name of a #SND_PCM_TYPE_METER PCM scope
 | 
			
		||||
 * \param scope PCM meter scope
 | 
			
		||||
 * \param name scope name
 | 
			
		||||
 */
 | 
			
		||||
void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val)
 | 
			
		||||
{
 | 
			
		||||
	scope->name = val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Get name of a #SND_PCM_TYPE_METER PCM scope
 | 
			
		||||
 * \param scope PCM meter scope
 | 
			
		||||
 * \return scope name
 | 
			
		||||
 */
 | 
			
		||||
const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope)
 | 
			
		||||
{
 | 
			
		||||
	return scope->name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Set callbacks for a #SND_PCM_TYPE_METER PCM scope
 | 
			
		||||
 * \param scope PCM meter scope
 | 
			
		||||
 * \param val callbacks
 | 
			
		||||
 */
 | 
			
		||||
void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, snd_pcm_scope_ops_t *val)
 | 
			
		||||
{
 | 
			
		||||
	scope->ops = val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Get callbacks private value for a #SND_PCM_TYPE_METER PCM scope
 | 
			
		||||
 * \param scope PCM meter scope
 | 
			
		||||
 * \return Private data value
 | 
			
		||||
 */
 | 
			
		||||
void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope)
 | 
			
		||||
{
 | 
			
		||||
	return scope->private_data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Get callbacks private value for a #SND_PCM_TYPE_METER PCM scope
 | 
			
		||||
 * \param scope PCM meter scope
 | 
			
		||||
 * \param val Private data value
 | 
			
		||||
 */
 | 
			
		||||
void snd_pcm_scope_set_callback_private(snd_pcm_scope_t *scope, void *val)
 | 
			
		||||
{
 | 
			
		||||
	scope->private_data = val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifndef DOC_HIDDEN
 | 
			
		||||
typedef struct _snd_pcm_scope_s16 {
 | 
			
		||||
	snd_pcm_t *pcm;
 | 
			
		||||
	snd_pcm_adpcm_state_t *adpcm_states;
 | 
			
		||||
| 
						 | 
				
			
			@ -1034,6 +1107,18 @@ snd_pcm_scope_ops_t s16_ops = {
 | 
			
		|||
	reset: s16_reset,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Add a s16 pseudo scope to a #SND_PCM_TYPE_METER PCM
 | 
			
		||||
 * \param name Scope name
 | 
			
		||||
 * \param scopep Pointer to newly created and added scope
 | 
			
		||||
 * \return zero on success otherwise a negative error code
 | 
			
		||||
 *
 | 
			
		||||
 * s16 pseudo scope convert #SND_PCM_TYPE_METER PCM frames in CPU endian 
 | 
			
		||||
 * 16 bit frames for use with other scopes. Don't forget to insert it before
 | 
			
		||||
 * and to not insert it more time (see #snd_pcm_meter_search_scope)
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name,
 | 
			
		||||
			   snd_pcm_scope_t **scopep)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -1060,6 +1145,12 @@ int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name,
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Get s16 pseudo scope frames buffer for a channel
 | 
			
		||||
 * \param scope s16 pseudo scope handle
 | 
			
		||||
 * \param channel Channel
 | 
			
		||||
 * \return Pointer to channel buffer
 | 
			
		||||
 */
 | 
			
		||||
int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope,
 | 
			
		||||
					      unsigned int channel)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -1074,6 +1165,11 @@ int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope,
 | 
			
		|||
	return s16->buf_areas[channel].addr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief allocate an invalid #snd_pcm_scope_t using standard malloc
 | 
			
		||||
 * \param ptr returned pointer
 | 
			
		||||
 * \return zero on success otherwise negative error code
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr)
 | 
			
		||||
{
 | 
			
		||||
	assert(ptr);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,6 +38,12 @@
 | 
			
		|||
#include "pcm_local.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return sign info for a PCM sample linear format
 | 
			
		||||
 * \param format Format
 | 
			
		||||
 * \return 0 unsigned, 1 signed, a negative error code if format is not linear
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_format_signed(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	switch (snd_enum_to_int(format)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -62,6 +68,11 @@ int snd_pcm_format_signed(snd_pcm_format_t format)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return sign info for a PCM sample linear format
 | 
			
		||||
 * \param format Format
 | 
			
		||||
 * \return 0 signed, 1 unsigned, a negative error code if format is not linear
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_format_unsigned(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	int val;
 | 
			
		||||
| 
						 | 
				
			
			@ -72,11 +83,21 @@ int snd_pcm_format_unsigned(snd_pcm_format_t format)
 | 
			
		|||
	return !val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return linear info for a PCM sample format
 | 
			
		||||
 * \param format Format
 | 
			
		||||
 * \return 0 non linear, 1 linear
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_format_linear(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	return snd_pcm_format_signed(format) >= 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return endian info for a PCM sample format
 | 
			
		||||
 * \param format Format
 | 
			
		||||
 * \return 0 big endian, 1 little endian, a negative error code if endian independent
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_format_little_endian(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	switch (snd_enum_to_int(format)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -105,6 +126,11 @@ int snd_pcm_format_little_endian(snd_pcm_format_t format)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return endian info for a PCM sample format
 | 
			
		||||
 * \param format Format
 | 
			
		||||
 * \return 0 little endian, 1 big endian, a negative error code if endian independent
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_format_big_endian(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	int val;
 | 
			
		||||
| 
						 | 
				
			
			@ -115,6 +141,11 @@ int snd_pcm_format_big_endian(snd_pcm_format_t format)
 | 
			
		|||
	return !val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return endian info for a PCM sample format
 | 
			
		||||
 * \param format Format
 | 
			
		||||
 * \return 0 swapped, 1 CPU endian, a negative error code if endian independent
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_format_cpu_endian(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
#ifdef SNDRV_LITTLE_ENDIAN
 | 
			
		||||
| 
						 | 
				
			
			@ -124,6 +155,11 @@ int snd_pcm_format_cpu_endian(snd_pcm_format_t format)
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return nominal bits per a PCM sample
 | 
			
		||||
 * \param format Sample format
 | 
			
		||||
 * \return bits per sample, a negative error code if not applicable
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_format_width(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	switch (snd_enum_to_int(format)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -163,6 +199,11 @@ int snd_pcm_format_width(snd_pcm_format_t format)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return bits needed to store a PCM sample
 | 
			
		||||
 * \param format Sample format
 | 
			
		||||
 * \return bits per sample, a negative error code if not applicable
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_format_physical_width(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	switch (snd_enum_to_int(format)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -200,6 +241,12 @@ int snd_pcm_format_physical_width(snd_pcm_format_t format)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return bytes needed to store a quantity of PCM sample
 | 
			
		||||
 * \param format Sample format
 | 
			
		||||
 * \param samples Samples count
 | 
			
		||||
 * \return bytes needed, a negative error code if not integer or unknown
 | 
			
		||||
 */
 | 
			
		||||
ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples)
 | 
			
		||||
{
 | 
			
		||||
	switch (snd_enum_to_int(format)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -241,6 +288,11 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return 64 bit expressing silence for a PCM sample format
 | 
			
		||||
 * \param format Sample format
 | 
			
		||||
 * \return silence 64 bit word
 | 
			
		||||
 */
 | 
			
		||||
u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	switch (snd_enum_to_int(format)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -352,21 +404,45 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return 32 bit expressing silence for a PCM sample format
 | 
			
		||||
 * \param format Sample format
 | 
			
		||||
 * \return silence 32 bit word
 | 
			
		||||
 */
 | 
			
		||||
u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	assert(snd_pcm_format_physical_width(format) <= 32);
 | 
			
		||||
	return (u_int32_t)snd_pcm_format_silence_64(format);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return 16 bit expressing silence for a PCM sample format
 | 
			
		||||
 * \param format Sample format
 | 
			
		||||
 * \return silence 16 bit word
 | 
			
		||||
 */
 | 
			
		||||
u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	assert(snd_pcm_format_physical_width(format) <= 16);
 | 
			
		||||
	return (u_int16_t)snd_pcm_format_silence_64(format);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Return 8 bit expressing silence for a PCM sample format
 | 
			
		||||
 * \param format Sample format
 | 
			
		||||
 * \return silence 8 bit word
 | 
			
		||||
 */
 | 
			
		||||
u_int8_t snd_pcm_format_silence(snd_pcm_format_t format)
 | 
			
		||||
{
 | 
			
		||||
	assert(snd_pcm_format_physical_width(format) <= 8);
 | 
			
		||||
	return (u_int8_t)snd_pcm_format_silence_64(format);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Silence a PCM samples buufer
 | 
			
		||||
 * \param format Sample format
 | 
			
		||||
 * \param data Buffer
 | 
			
		||||
 * \return samples Samples count
 | 
			
		||||
 */
 | 
			
		||||
int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int samples)
 | 
			
		||||
{
 | 
			
		||||
	if (samples == 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -405,6 +481,7 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
 | 
			
		|||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	default:
 | 
			
		||||
		assert(0);
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -429,6 +506,12 @@ static int linear_formats[4*2*2] = {
 | 
			
		|||
	SNDRV_PCM_FORMAT_U32_BE
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief Compose a PCM sample linear format
 | 
			
		||||
 * \param width Nominal bits per sample
 | 
			
		||||
 * \param unsignd Sign: 0 signed, 1 unsigned
 | 
			
		||||
 * \return big_endian Endianness: 0 little endian, 1 big endian
 | 
			
		||||
 */
 | 
			
		||||
snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian)
 | 
			
		||||
{
 | 
			
		||||
	switch (width) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,24 +44,6 @@ size_t page_align(size_t size)
 | 
			
		|||
	return size;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const snd_pcm_channel_area_t *snd_pcm_mmap_running_areas(snd_pcm_t *pcm)
 | 
			
		||||
{
 | 
			
		||||
	return pcm->running_areas;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const snd_pcm_channel_area_t *snd_pcm_mmap_stopped_areas(snd_pcm_t *pcm)
 | 
			
		||||
{
 | 
			
		||||
	return pcm->stopped_areas;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm)
 | 
			
		||||
{
 | 
			
		||||
	if (pcm->stopped_areas &&
 | 
			
		||||
	    snd_pcm_state(pcm) != SND_PCM_STATE_RUNNING) 
 | 
			
		||||
		return pcm->stopped_areas;
 | 
			
		||||
	return pcm->running_areas;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
snd_pcm_uframes_t snd_pcm_mmap_playback_xfer(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
 | 
			
		||||
{
 | 
			
		||||
	snd_pcm_uframes_t cont;
 | 
			
		||||
| 
						 | 
				
			
			@ -86,21 +68,6 @@ snd_pcm_uframes_t snd_pcm_mmap_capture_xfer(snd_pcm_t *pcm, snd_pcm_uframes_t fr
 | 
			
		|||
	return frames;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
snd_pcm_uframes_t snd_pcm_mmap_xfer(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
 | 
			
		||||
{
 | 
			
		||||
        assert(pcm);
 | 
			
		||||
	if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
 | 
			
		||||
		return snd_pcm_mmap_playback_xfer(pcm, frames);
 | 
			
		||||
	else
 | 
			
		||||
		return snd_pcm_mmap_capture_xfer(pcm, frames);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
snd_pcm_uframes_t snd_pcm_mmap_offset(snd_pcm_t *pcm)
 | 
			
		||||
{
 | 
			
		||||
        assert(pcm);
 | 
			
		||||
	return *pcm->appl_ptr % pcm->buffer_size;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
snd_pcm_uframes_t snd_pcm_mmap_hw_offset(snd_pcm_t *pcm)
 | 
			
		||||
{
 | 
			
		||||
        assert(pcm);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,29 +92,24 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params)
 | 
			
		|||
	params->info = ~0U;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Fill PARAMS with full configuration space boundaries */
 | 
			
		||||
int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 | 
			
		||||
{
 | 
			
		||||
	_snd_pcm_hw_params_any(params);
 | 
			
		||||
	return snd_pcm_hw_refine(pcm, params);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Return the value for field PAR if it's fixed in configuration space 
 | 
			
		||||
   defined by PARAMS. Return -EINVAL otherwise
 | 
			
		||||
*/
 | 
			
		||||
unsigned int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params,
 | 
			
		||||
				  snd_pcm_hw_param_t var, int *dir)
 | 
			
		||||
int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params,
 | 
			
		||||
			 snd_pcm_hw_param_t var, int *dir)
 | 
			
		||||
{
 | 
			
		||||
	if (hw_is_mask(var)) {
 | 
			
		||||
		const snd_mask_t *mask = hw_param_mask_c(params, var);
 | 
			
		||||
		assert(snd_mask_single(mask));
 | 
			
		||||
		if (snd_mask_empty(mask) || !snd_mask_single(mask))
 | 
			
		||||
			return -EINVAL;
 | 
			
		||||
		if (dir)
 | 
			
		||||
			*dir = 0;
 | 
			
		||||
		return snd_mask_value(mask);
 | 
			
		||||
	}
 | 
			
		||||
	if (hw_is_interval(var)) {
 | 
			
		||||
		const snd_interval_t *i = hw_param_interval_c(params, var);
 | 
			
		||||
		assert(snd_interval_single(i));
 | 
			
		||||
		if (snd_interval_empty(i) || !snd_interval_single(i))
 | 
			
		||||
			return -EINVAL;
 | 
			
		||||
		if (dir)
 | 
			
		||||
			*dir = i->openmin;
 | 
			
		||||
		return snd_interval_value(i);
 | 
			
		||||
| 
						 | 
				
			
			@ -947,35 +942,6 @@ int snd_pcm_hw_param_never_eq(const snd_pcm_hw_params_t *params,
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Return rate numerator/denumerator obtainable for configuration space defined
 | 
			
		||||
   by PARAMS */
 | 
			
		||||
int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
 | 
			
		||||
				      unsigned int *rate_num, unsigned int *rate_den)
 | 
			
		||||
{
 | 
			
		||||
	if (params->rate_den == 0)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
	*rate_num = params->rate_num;
 | 
			
		||||
	*rate_den = params->rate_den;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Return significative bits in sample for configuration space defined
 | 
			
		||||
   by PARAMS */
 | 
			
		||||
int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params)
 | 
			
		||||
{
 | 
			
		||||
	if (params->msbits == 0)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
	return params->msbits;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Return fifo size for configuration space defined by PARAMS */
 | 
			
		||||
int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
 | 
			
		||||
{
 | 
			
		||||
	if (params->fifo_size == 0)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
	return params->fifo_size;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Choose one configuration from configuration space defined by PARAMS
 | 
			
		||||
   The configuration choosen is that obtained fixing in this order:
 | 
			
		||||
   first access
 | 
			
		||||
| 
						 | 
				
			
			@ -1000,56 +966,6 @@ void snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 | 
			
		|||
	snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Strategies */
 | 
			
		||||
 | 
			
		||||
struct _snd_pcm_hw_strategy {
 | 
			
		||||
	unsigned int badness_min, badness_max;
 | 
			
		||||
	int (*choose_param)(const snd_pcm_hw_params_t *params,
 | 
			
		||||
			    snd_pcm_t *pcm,
 | 
			
		||||
			    const snd_pcm_hw_strategy_t *strategy);
 | 
			
		||||
	int (*next_value)(snd_pcm_hw_params_t *params,
 | 
			
		||||
			  unsigned int param,
 | 
			
		||||
			  int value, int *dir,
 | 
			
		||||
			  snd_pcm_t *pcm,
 | 
			
		||||
			  const snd_pcm_hw_strategy_t *strategy);
 | 
			
		||||
	int (*min_badness)(const snd_pcm_hw_params_t *params,
 | 
			
		||||
			   unsigned int max_badness,
 | 
			
		||||
			   snd_pcm_t *pcm,
 | 
			
		||||
			   const snd_pcm_hw_strategy_t *strategy);
 | 
			
		||||
	void *private_data;
 | 
			
		||||
	void (*free)(snd_pcm_hw_strategy_t *strategy);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* Independent badness */
 | 
			
		||||
typedef struct _snd_pcm_hw_strategy_simple snd_pcm_hw_strategy_simple_t;
 | 
			
		||||
 | 
			
		||||
struct _snd_pcm_hw_strategy_simple {
 | 
			
		||||
	int valid;
 | 
			
		||||
	unsigned int order;
 | 
			
		||||
	int (*next_value)(snd_pcm_hw_params_t *params,
 | 
			
		||||
			  unsigned int param,
 | 
			
		||||
			  int value, int *dir,
 | 
			
		||||
			  snd_pcm_t *pcm,
 | 
			
		||||
			  const snd_pcm_hw_strategy_simple_t *par);
 | 
			
		||||
	unsigned int (*min_badness)(const snd_pcm_hw_params_t *params,
 | 
			
		||||
				    unsigned int param,
 | 
			
		||||
				    snd_pcm_t *pcm,
 | 
			
		||||
				    const snd_pcm_hw_strategy_simple_t *par);
 | 
			
		||||
	void *private_data;
 | 
			
		||||
	void (*free)(snd_pcm_hw_strategy_simple_t *strategy);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct _snd_pcm_hw_strategy_simple_near {
 | 
			
		||||
	int best;
 | 
			
		||||
	unsigned int mul;
 | 
			
		||||
} snd_pcm_hw_strategy_simple_near_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _snd_pcm_hw_strategy_simple_choices {
 | 
			
		||||
	unsigned int count;
 | 
			
		||||
	/* choices need to be sorted on ascending badness */
 | 
			
		||||
	snd_pcm_hw_strategy_simple_choices_list_t *choices;
 | 
			
		||||
} snd_pcm_hw_strategy_simple_choices_t;
 | 
			
		||||
 | 
			
		||||
unsigned int snd_pcm_hw_param_count(const snd_pcm_hw_params_t *params,
 | 
			
		||||
				     snd_pcm_hw_param_t var)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -1171,22 +1087,62 @@ const char *snd_pcm_hw_param_names[] = {
 | 
			
		|||
	HW_PARAM(TICK_TIME),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const char *snd_pcm_hw_param_name(snd_pcm_hw_param_t param)
 | 
			
		||||
const char *snd_pcm_hw_param_name(snd_pcm_hw_param_t param)
 | 
			
		||||
{
 | 
			
		||||
	assert(param <= SND_PCM_HW_PARAM_LAST);
 | 
			
		||||
	return snd_pcm_hw_param_names[snd_enum_to_int(param)];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out)
 | 
			
		||||
{
 | 
			
		||||
	unsigned int k;
 | 
			
		||||
	for (k = 0; k <= SND_PCM_HW_PARAM_LAST; k++) {
 | 
			
		||||
		snd_output_printf(out, "%s: ", snd_pcm_hw_param_name(k));
 | 
			
		||||
		snd_pcm_hw_param_dump(params, k, out);
 | 
			
		||||
		snd_output_putc(out, '\n');
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
#if 0
 | 
			
		||||
/* Strategies */
 | 
			
		||||
 | 
			
		||||
struct _snd_pcm_hw_strategy {
 | 
			
		||||
	unsigned int badness_min, badness_max;
 | 
			
		||||
	int (*choose_param)(const snd_pcm_hw_params_t *params,
 | 
			
		||||
			    snd_pcm_t *pcm,
 | 
			
		||||
			    const snd_pcm_hw_strategy_t *strategy);
 | 
			
		||||
	int (*next_value)(snd_pcm_hw_params_t *params,
 | 
			
		||||
			  unsigned int param,
 | 
			
		||||
			  int value, int *dir,
 | 
			
		||||
			  snd_pcm_t *pcm,
 | 
			
		||||
			  const snd_pcm_hw_strategy_t *strategy);
 | 
			
		||||
	int (*min_badness)(const snd_pcm_hw_params_t *params,
 | 
			
		||||
			   unsigned int max_badness,
 | 
			
		||||
			   snd_pcm_t *pcm,
 | 
			
		||||
			   const snd_pcm_hw_strategy_t *strategy);
 | 
			
		||||
	void *private_data;
 | 
			
		||||
	void (*free)(snd_pcm_hw_strategy_t *strategy);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* Independent badness */
 | 
			
		||||
typedef struct _snd_pcm_hw_strategy_simple snd_pcm_hw_strategy_simple_t;
 | 
			
		||||
 | 
			
		||||
struct _snd_pcm_hw_strategy_simple {
 | 
			
		||||
	int valid;
 | 
			
		||||
	unsigned int order;
 | 
			
		||||
	int (*next_value)(snd_pcm_hw_params_t *params,
 | 
			
		||||
			  unsigned int param,
 | 
			
		||||
			  int value, int *dir,
 | 
			
		||||
			  snd_pcm_t *pcm,
 | 
			
		||||
			  const snd_pcm_hw_strategy_simple_t *par);
 | 
			
		||||
	unsigned int (*min_badness)(const snd_pcm_hw_params_t *params,
 | 
			
		||||
				    unsigned int param,
 | 
			
		||||
				    snd_pcm_t *pcm,
 | 
			
		||||
				    const snd_pcm_hw_strategy_simple_t *par);
 | 
			
		||||
	void *private_data;
 | 
			
		||||
	void (*free)(snd_pcm_hw_strategy_simple_t *strategy);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct _snd_pcm_hw_strategy_simple_near {
 | 
			
		||||
	int best;
 | 
			
		||||
	unsigned int mul;
 | 
			
		||||
} snd_pcm_hw_strategy_simple_near_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _snd_pcm_hw_strategy_simple_choices {
 | 
			
		||||
	unsigned int count;
 | 
			
		||||
	/* choices need to be sorted on ascending badness */
 | 
			
		||||
	snd_pcm_hw_strategy_simple_choices_list_t *choices;
 | 
			
		||||
} snd_pcm_hw_strategy_simple_choices_t;
 | 
			
		||||
 | 
			
		||||
int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
 | 
			
		||||
			       const snd_pcm_hw_strategy_t *strategy,
 | 
			
		||||
| 
						 | 
				
			
			@ -1536,6 +1492,8 @@ int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,
 | 
			
		|||
	return snd_pcm_hw_params_try_explain_failure1(pcm, fail, success, depth, out);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct _snd_pcm_hw_rule snd_pcm_hw_rule_t;
 | 
			
		||||
 | 
			
		||||
typedef int (*snd_pcm_hw_rule_func_t)(snd_pcm_hw_params_t *params,
 | 
			
		||||
| 
						 | 
				
			
			@ -2050,23 +2008,6 @@ int snd_pcm_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
 | 
			
		|||
	return err;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
 | 
			
		||||
{
 | 
			
		||||
	assert(pcm && params);
 | 
			
		||||
	assert(pcm->setup);
 | 
			
		||||
	params->start_mode = snd_enum_to_int(pcm->start_mode);
 | 
			
		||||
	params->xrun_mode = snd_enum_to_int(pcm->xrun_mode);
 | 
			
		||||
	params->tstamp_mode = snd_enum_to_int(pcm->tstamp_mode);
 | 
			
		||||
	params->period_step = pcm->period_step;
 | 
			
		||||
	params->sleep_min = pcm->sleep_min;
 | 
			
		||||
	params->avail_min = pcm->avail_min;
 | 
			
		||||
	params->xfer_align = pcm->xfer_align;
 | 
			
		||||
	params->silence_threshold = pcm->silence_threshold;
 | 
			
		||||
	params->silence_size = pcm->silence_size;
 | 
			
		||||
	params->boundary = pcm->boundary;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int snd_pcm_sw_params_default(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
 | 
			
		||||
{
 | 
			
		||||
	assert(pcm && params);
 | 
			
		||||
| 
						 | 
				
			
			@ -2086,22 +2027,6 @@ int snd_pcm_sw_params_default(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out)
 | 
			
		||||
{
 | 
			
		||||
	snd_output_printf(out, "start_mode: %s\n", snd_pcm_start_mode_name(snd_pcm_sw_params_get_start_mode(params)));
 | 
			
		||||
	snd_output_printf(out, "xrun_mode: %s\n", snd_pcm_xrun_mode_name(snd_pcm_sw_params_get_xrun_mode(params)));
 | 
			
		||||
	snd_output_printf(out, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(snd_pcm_sw_params_get_tstamp_mode(params)));
 | 
			
		||||
	snd_output_printf(out, "period_step: %u\n", params->period_step);
 | 
			
		||||
	snd_output_printf(out, "sleep_min: %u\n", params->sleep_min);
 | 
			
		||||
	snd_output_printf(out, "avail_min: %lu\n", params->avail_min);
 | 
			
		||||
	snd_output_printf(out, "xfer_align: %lu\n", params->xfer_align);
 | 
			
		||||
	snd_output_printf(out, "silence_threshold: %lu\n", params->silence_threshold);
 | 
			
		||||
	snd_output_printf(out, "silence_size: %lu\n", params->silence_size);
 | 
			
		||||
	snd_output_printf(out, "boundary: %lu\n", params->boundary);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int snd_pcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 | 
			
		||||
{
 | 
			
		||||
	assert(pcm && params);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -357,7 +357,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
 | 
			
		|||
	}
 | 
			
		||||
	rate->pitch = (((u_int64_t)dst_rate * DIV) + src_rate / 2) / src_rate;
 | 
			
		||||
	assert(!rate->states);
 | 
			
		||||
	rate->states = malloc(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_CHANNELS, 0) * sizeof(*rate->states));
 | 
			
		||||
	rate->states = malloc(rate->plug.slave->channels * sizeof(*rate->states));
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -313,7 +313,7 @@ int snd_rawmidi_info_malloc(snd_rawmidi_info_t **info)
 | 
			
		|||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief frees the snd_rawmidi_info_t structure
 | 
			
		||||
 * \param params pointer to the snd_rawmidi_info_t structure to free
 | 
			
		||||
 * \param info pointer to the snd_rawmidi_info_t structure to free
 | 
			
		||||
 *
 | 
			
		||||
 * Frees the given snd_rawmidi_params_t structure using the standard
 | 
			
		||||
 * free C library function.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue