Skip to content

Commit 51987d2

Browse files
committed
Audio: Template: Use s16/32 versions of source and sink API
This patch modifies the template component to use in process functions the source_get_data_s16/32() and sink_get_buffer_s16/32() functions. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 51de413 commit 51987d2

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/audio/template_comp/template-generic.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ static int template_comp_s16(const struct processing_module *mod,
3030
uint32_t frames)
3131
{
3232
struct template_comp_comp_data *cd = module_get_private_data(mod);
33-
int16_t *x, *x_start, *x_end;
33+
int16_t const *x, *x_start, *x_end;
3434
int16_t *y, *y_start, *y_end;
35-
size_t size;
3635
int x_size, y_size;
3736
int source_samples_without_wrap;
3837
int samples_without_wrap;
@@ -47,19 +46,15 @@ static int template_comp_s16(const struct processing_module *mod,
4746
* control the samples process loop. If the number of bytes requested is not
4847
* possible, an error is returned.
4948
*/
50-
ret = source_get_data(source, bytes, (void const **)&x, (void const **)&x_start, &size);
49+
ret = source_get_data_s16(source, bytes, &x, &x_start, &x_size);
5150
if (ret)
5251
return ret;
5352

54-
x_size = size >> 1; /* Bytes to number of s16 samples */
55-
5653
/* Similarly get pointer to sink data in circular buffer, buffer start and size. */
57-
ret = sink_get_buffer(sink, bytes, (void **)&y, (void **)&y_start, &size);
54+
ret = sink_get_buffer_s16(sink, bytes, &y, &y_start, &y_size);
5855
if (ret)
5956
return ret;
6057

61-
y_size = size >> 1; /* Bytes to number of s16 samples */
62-
6358
/* Set helper pointers to buffer end for wrap check. Then loop until all
6459
* samples are processed.
6560
*/
@@ -122,9 +117,8 @@ static int template_comp_s32(const struct processing_module *mod,
122117
uint32_t frames)
123118
{
124119
struct template_comp_comp_data *cd = module_get_private_data(mod);
125-
int32_t *x, *x_start, *x_end;
120+
int32_t const *x, *x_start, *x_end;
126121
int32_t *y, *y_start, *y_end;
127-
size_t size;
128122
int x_size, y_size;
129123
int source_samples_without_wrap;
130124
int samples_without_wrap;
@@ -139,19 +133,15 @@ static int template_comp_s32(const struct processing_module *mod,
139133
* control the samples process loop. If the number of bytes requested is not
140134
* possible, an error is returned.
141135
*/
142-
ret = source_get_data(source, bytes, (void const **)&x, (void const **)&x_start, &size);
136+
ret = source_get_data_s32(source, bytes, &x, &x_start, &x_size);
143137
if (ret)
144138
return ret;
145139

146-
x_size = size >> 2; /* Bytes to number of s32 samples */
147-
148140
/* Similarly get pointer to sink data in circular buffer, buffer start and size. */
149-
ret = sink_get_buffer(sink, bytes, (void **)&y, (void **)&y_start, &size);
141+
ret = sink_get_buffer_s32(sink, bytes, &y, &y_start, &y_size);
150142
if (ret)
151143
return ret;
152144

153-
y_size = size >> 2; /* Bytes to number of s32 samples */
154-
155145
/* Set helper pointers to buffer end for wrap check. Then loop until all
156146
* samples are processed.
157147
*/

0 commit comments

Comments
 (0)