Example #1
0
// Sets up channel input parameters.
//
// Parameters:
//   index   the input channel index
//   format  the sample format code
void
brutefir::setup_input(int index,
                      int format)
{
    struct buffer_format_t *bf;

    bfconf->inputs[index].intname = index;

    bf = &bfconf->inputs[index].bf;

    setup_sample_format(format, &bf->sf, true);
    bf->byte_offset = index * bf->sf.bytes;
    bf->sample_spacing = bfconf->n_channels;
}
Example #2
0
// Sets up channel output parameters.
//
// Parameters:
//   index         the output channel index
//   format        the sample format code
//   apply_dither  true to apply dither (integer type samples only)
void
brutefir::setup_output(int index,
                       int format,
                       bool apply_dither)
{
    struct buffer_format_t *bf;

    bfconf->outputs[index].intname = index;
    bfconf->outputs[index].apply_dither = apply_dither;

    bf = &bfconf->outputs[index].bf;

    setup_sample_format(format, &bf->sf, false);
    bf->byte_offset = index * bf->sf.bytes;
    bf->sample_spacing = bfconf->n_channels;
}
Example #3
0
static int tscs42xx_hw_params(struct snd_pcm_substream *substream,
		struct snd_pcm_hw_params *params,
		struct snd_soc_dai *codec_dai)
{
	struct snd_soc_codec *codec = codec_dai->codec;
	int ret;

	ret = setup_sample_format(codec, params_format(params));
	if (ret < 0) {
		dev_err(codec->dev, "Failed to setup sample format (%d)\n",
			ret);
		return ret;
	}

	ret = setup_sample_rate(codec, params_rate(params));
	if (ret < 0) {
		dev_err(codec->dev, "Failed to setup sample rate (%d)\n", ret);
		return ret;
	}

	return 0;
}