From 2017de6da8235e06018e990ed0bff371c92e56cc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 12 May 2021 20:16:53 +0200 Subject: [PATCH] filter-chain: add copy function --- src/modules/module-filter-chain/builtin.h | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/modules/module-filter-chain/builtin.h b/src/modules/module-filter-chain/builtin.h index 93b29e217..eef024e83 100644 --- a/src/modules/module-filter-chain/builtin.h +++ b/src/modules/module-filter-chain/builtin.h @@ -61,6 +61,42 @@ static void builtin_cleanup(LADSPA_Handle Instance) free(impl); } +/** copy */ +static void copy_run(LADSPA_Handle Instance, unsigned long SampleCount) +{ + struct builtin *impl = Instance; + float *in = impl->port[1], *out = impl->port[0]; + memcpy(out, in, SampleCount * sizeof(float)); +} + +static const LADSPA_PortDescriptor copy_port_desc[] = { + LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO, + LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO, +}; + +static const char * const copy_port_names[] = { + "Out", "In" +}; + +static const LADSPA_PortRangeHint copy_range_hints[] = { + { 0, }, { 0, }, +}; + +static const LADSPA_Descriptor copy_desc = { + .Label = "copy", + .Name = "Copy input to output", + .Maker = "PipeWire", + .Copyright = "MIT", + .PortCount = 2, + .PortDescriptors = copy_port_desc, + .PortNames = copy_port_names, + .PortRangeHints = copy_range_hints, + .instantiate = builtin_instantiate, + .connect_port = builtin_connect_port, + .run = copy_run, + .cleanup = builtin_cleanup, +}; + /** mixer */ static void mixer_run(LADSPA_Handle Instance, unsigned long SampleCount) { @@ -377,6 +413,8 @@ static const LADSPA_Descriptor * builtin_ladspa_descriptor(unsigned long Index) return &bq_notch_desc; case 8: return &bq_allpass_desc; + case 9: + return ©_desc; } return NULL; }