Lines Matching +full:non +full:- +full:interleaved

1 // SPDX-License-Identifier: GPL-2.0
4 * the virtual pcm test driver (snd-pcmtest).
44 return -1; in read_patterns()
51 return -1; in read_patterns()
70 return -1; in get_test_results()
96 snd_pcm_hw_params_set_access(*handle, hwparams, params->access); in setup_handle()
97 snd_pcm_hw_params_set_format(*handle, hwparams, params->format); in setup_handle()
98 snd_pcm_hw_params_set_channels(*handle, hwparams, params->channels); in setup_handle()
99 snd_pcm_hw_params_set_rate_near(*handle, hwparams, &params->rate, 0); in setup_handle()
100 snd_pcm_hw_params_set_period_size_near(*handle, hwparams, &params->period_size, 0); in setup_handle()
101 snd_pcm_hw_params_set_buffer_size_near(*handle, hwparams, &params->buffer_size); in setup_handle()
106 snd_pcm_sw_params_set_avail_min(*handle, swparams, params->period_size); in setup_handle()
107 snd_pcm_hw_params_set_buffer_size_near(*handle, hwparams, &params->buffer_size); in setup_handle()
108 snd_pcm_hw_params_set_period_size_near(*handle, hwparams, &params->period_size, 0); in setup_handle()
138 self->params.buffer_size = 16384; in FIXTURE_SETUP()
139 self->params.period_size = 4096; in FIXTURE_SETUP()
140 self->params.channels = CH_NUM; in FIXTURE_SETUP()
141 self->params.rate = 8000; in FIXTURE_SETUP()
142 self->params.access = SND_PCM_ACCESS_RW_INTERLEAVED; in FIXTURE_SETUP()
143 self->params.format = SND_PCM_FORMAT_S16_LE; in FIXTURE_SETUP()
144 self->card = -1; in FIXTURE_SETUP()
145 self->params.sample_size = snd_pcm_format_physical_width(self->params.format) / 8; in FIXTURE_SETUP()
147 self->params.sec_buf_len = get_sec_buf_len(self->params.rate, self->params.channels, in FIXTURE_SETUP()
148 self->params.format); in FIXTURE_SETUP()
149 self->params.time = 4; in FIXTURE_SETUP()
151 while (snd_card_next(&self->card) >= 0) { in FIXTURE_SETUP()
152 if (self->card == -1) in FIXTURE_SETUP()
154 snd_card_get_name(self->card, &card_name); in FIXTURE_SETUP()
155 if (!strcmp(card_name, "PCM-Test")) in FIXTURE_SETUP()
159 ASSERT_NE(self->card, -1); in FIXTURE_SETUP()
173 struct pcmtest_test_params *params = &self->params; in TEST_F()
175 samples = calloc(self->params.sec_buf_len * self->params.time, 1); in TEST_F()
178 snd_pcm_sw_params_alloca(&self->swparams); in TEST_F()
179 snd_pcm_hw_params_alloca(&self->hwparams); in TEST_F()
181 ASSERT_EQ(setup_handle(&handle, self->swparams, self->hwparams, params, in TEST_F()
182 self->card, SND_PCM_STREAM_PLAYBACK), 0); in TEST_F()
183 snd_pcm_format_set_silence(params->format, samples, in TEST_F()
184 params->rate * params->channels * params->time); in TEST_F()
186 for (i = 0; i < self->params.sec_buf_len * params->time; i++) { in TEST_F()
187 cur_ch = (i / params->sample_size) % CH_NUM; in TEST_F()
188 pos_in_ch = i / params->sample_size / CH_NUM * params->sample_size in TEST_F()
189 + (i % params->sample_size); in TEST_F()
192 write_res = snd_pcm_writei(handle, samples, params->rate * params->time); in TEST_F()
203 * of bytes. In the interleaved mode the buffer will contain samples in the following order:
212 struct pcmtest_test_params *params = &self->params; in TEST_F()
214 samples = calloc(self->params.sec_buf_len * self->params.time, 1); in TEST_F()
217 snd_pcm_sw_params_alloca(&self->swparams); in TEST_F()
218 snd_pcm_hw_params_alloca(&self->hwparams); in TEST_F()
220 ASSERT_EQ(setup_handle(&handle, self->swparams, self->hwparams, in TEST_F()
221 params, self->card, SND_PCM_STREAM_CAPTURE), 0); in TEST_F()
222 snd_pcm_format_set_silence(params->format, samples, in TEST_F()
223 params->rate * params->channels * params->time); in TEST_F()
224 read_res = snd_pcm_readi(handle, samples, params->rate * params->time); in TEST_F()
228 for (i = 0; i < self->params.sec_buf_len * self->params.time; i++) { in TEST_F()
229 cur_ch = (i / params->sample_size) % CH_NUM; in TEST_F()
230 pos_in_ch = i / params->sample_size / CH_NUM * params->sample_size in TEST_F()
231 + (i % params->sample_size); in TEST_F()
237 // Test capture in the non-interleaved access mode. The are buffers for each recorded channel
240 struct pcmtest_test_params params = self->params; in TEST_F()
247 snd_pcm_sw_params_alloca(&self->swparams); in TEST_F()
248 snd_pcm_hw_params_alloca(&self->hwparams); in TEST_F()
252 ASSERT_EQ(setup_handle(&handle, self->swparams, self->hwparams, in TEST_F()
253 &params, self->card, SND_PCM_STREAM_CAPTURE), 0); in TEST_F()
274 struct pcmtest_test_params params = self->params; in TEST_F()
282 snd_pcm_sw_params_alloca(&self->swparams); in TEST_F()
283 snd_pcm_hw_params_alloca(&self->hwparams); in TEST_F()
287 ASSERT_EQ(setup_handle(&handle, self->swparams, self->hwparams, in TEST_F()
288 &params, self->card, SND_PCM_STREAM_PLAYBACK), 0); in TEST_F()
317 struct pcmtest_test_params *params = &self->params; in TEST_F()
319 snd_pcm_sw_params_alloca(&self->swparams); in TEST_F()
320 snd_pcm_hw_params_alloca(&self->hwparams); in TEST_F()
322 ASSERT_EQ(setup_handle(&handle, self->swparams, self->hwparams, params, in TEST_F()
323 self->card, SND_PCM_STREAM_CAPTURE), 0); in TEST_F()