mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
Fix DSP::process_map() plugin-pin I/O map handing
The previous approach failed in case where PluginInsert uses no-inplace buffers with a linear map. Since buffers are replicated up to a total of number of all (inputs + outputs), the number of output buffers could not be determined. There was insufficient information using the I/O map alone. With a known number of outputs processing and applying the i/o map is also a lot easier and faster. This break the API of process_map().
This commit is contained in:
parent
a5c956883d
commit
d27cdb3855
4 changed files with 23 additions and 35 deletions
|
|
@ -166,10 +166,10 @@ namespace ARDOUR { namespace DSP {
|
||||||
float log_meter_coeff (float coeff);
|
float log_meter_coeff (float coeff);
|
||||||
|
|
||||||
void process_map (BufferSet* bufs,
|
void process_map (BufferSet* bufs,
|
||||||
const ChanMapping& in,
|
const ChanCount& n_out,
|
||||||
const ChanMapping& out,
|
const ChanMapping& in_map,
|
||||||
pframes_t nframes, samplecnt_t offset,
|
const ChanMapping& out_map,
|
||||||
const DataType&);
|
pframes_t nframes, samplecnt_t offset);
|
||||||
|
|
||||||
/** 1st order Low Pass filter */
|
/** 1st order Low Pass filter */
|
||||||
class LIBARDOUR_API LowPass {
|
class LIBARDOUR_API LowPass {
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ void
|
||||||
Convolution::run (BufferSet& bufs, ChanMapping const& in_map, ChanMapping const& out_map, pframes_t n_samples, samplecnt_t offset)
|
Convolution::run (BufferSet& bufs, ChanMapping const& in_map, ChanMapping const& out_map, pframes_t n_samples, samplecnt_t offset)
|
||||||
{
|
{
|
||||||
if (!ready ()) {
|
if (!ready ()) {
|
||||||
process_map (&bufs, in_map, out_map, n_samples, offset, DataType::AUDIO);
|
process_map (&bufs, ChanCount (DataType::AUDIO, _n_outputs), in_map, out_map, n_samples, offset);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,40 +75,28 @@ ARDOUR::DSP::peaks (const float *data, float &min, float &max, uint32_t n_sample
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ARDOUR::DSP::process_map (BufferSet* bufs, const ChanMapping& in, const ChanMapping& out, pframes_t nframes, samplecnt_t offset, const DataType& dt)
|
ARDOUR::DSP::process_map (BufferSet* bufs, const ChanCount& n_out, const ChanMapping& in_map, const ChanMapping& out_map, pframes_t nframes, samplecnt_t offset)
|
||||||
{
|
{
|
||||||
const ChanMapping::Mappings& im (in.mappings());
|
/* PluginInsert already handles most, in particular `no-inplace` buffers in case
|
||||||
const ChanMapping::Mappings& om (out.mappings());
|
* or x-over connections, and through connections.
|
||||||
|
*
|
||||||
for (ChanMapping::Mappings::const_iterator tm = im.begin(); tm != im.end(); ++tm) {
|
* This just fills output buffers, forwarding inputs as needed:
|
||||||
if (tm->first != dt) { continue; }
|
* Input -> plugin-sink == plugin-src -> Output
|
||||||
for (ChanMapping::TypeMapping::const_iterator i = tm->second.begin(); i != tm->second.end(); ++i) {
|
*/
|
||||||
|
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
|
||||||
|
for (uint32_t out = 0; out < n_out.get (*t); ++out) {
|
||||||
bool valid;
|
bool valid;
|
||||||
const uint32_t idx = out.get (dt, i->second, &valid);
|
uint32_t out_idx = out_map.get (*t, out, &valid);
|
||||||
if (valid && idx != i->first) {
|
|
||||||
bufs->get_available (dt, idx).read_from (bufs->get_available (dt, i->first), nframes, offset, offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (ChanMapping::Mappings::const_iterator tm = im.begin(); tm != im.end(); ++tm) {
|
|
||||||
if (tm->first != dt) { continue; }
|
|
||||||
for (ChanMapping::TypeMapping::const_iterator i = tm->second.begin(); i != tm->second.end(); ++i) {
|
|
||||||
bool valid;
|
|
||||||
in.get_src (dt, i->first, &valid);
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
bufs->get_available (dt, i->second).silence (nframes, offset);
|
continue;
|
||||||
}
|
}
|
||||||
}
|
uint32_t in_idx = in_map.get (*t, out, &valid);
|
||||||
}
|
|
||||||
|
|
||||||
/* reverse lookup (in case input map is empty */
|
|
||||||
for (ChanMapping::Mappings::const_iterator tm = om.begin(); tm != om.end(); ++tm) {
|
|
||||||
if (tm->first != dt) { continue; }
|
|
||||||
for (ChanMapping::TypeMapping::const_iterator i = tm->second.begin(); i != tm->second.end(); ++i) {
|
|
||||||
bool valid;
|
|
||||||
in.get_src (dt, i->first, &valid);
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
bufs->get_available (dt, i->second).silence (nframes, offset);
|
bufs->get_available (*t, out_idx).silence (nframes, offset);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (in_idx != out_idx) {
|
||||||
|
bufs->get_available (*t, out_idx).read_from (bufs->get_available (*t, in_idx), nframes, offset, offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -571,7 +571,7 @@ LuaProc::configure_io (ChanCount in, ChanCount out)
|
||||||
luabridge::LuaRef lua_dsp_configure = luabridge::getGlobal (L, "dsp_configure");
|
luabridge::LuaRef lua_dsp_configure = luabridge::getGlobal (L, "dsp_configure");
|
||||||
if (lua_dsp_configure.type () == LUA_TFUNCTION) {
|
if (lua_dsp_configure.type () == LUA_TFUNCTION) {
|
||||||
try {
|
try {
|
||||||
luabridge::LuaRef io = lua_dsp_configure (&in, &out);
|
luabridge::LuaRef io = lua_dsp_configure (in, out);
|
||||||
if (io.isTable ()) {
|
if (io.isTable ()) {
|
||||||
ChanCount lin (_selected_in);
|
ChanCount lin (_selected_in);
|
||||||
ChanCount lout (_selected_out);
|
ChanCount lout (_selected_out);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue