Include bus number in IOPortDescription

This commit is contained in:
Robin Gareus 2023-01-06 00:50:16 +01:00
parent e87b989501
commit 617ec6f54f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 17 additions and 9 deletions

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2007 Taybin Rutkin <taybin@taybin.com> * Copyright (C) 2005-2007 Taybin Rutkin <taybin@taybin.com>
* Copyright (C) 2006-2014 David Robillard <d@drobilla.net> * Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
* Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net> * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
* Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org> * Copyright (C) 2013-2023 Robin Gareus <robin@gareus.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -131,11 +131,12 @@ public:
struct LIBARDOUR_API IOPortDescription { struct LIBARDOUR_API IOPortDescription {
public: public:
IOPortDescription (const std::string& n, bool sc = false, std::string gn = "", uint32_t gc = 0) IOPortDescription (const std::string& n, bool sc = false, std::string gn = "", uint32_t gc = 0, uint32_t bn = 0)
: name (n) : name (n)
, is_sidechain (sc) , is_sidechain (sc)
, group_name (gn.empty () ? n : gn) , group_name (gn.empty () ? n : gn)
, group_channel (gc) , group_channel (gc)
, bus_number (bn)
{ } { }
IOPortDescription (const IOPortDescription& other) IOPortDescription (const IOPortDescription& other)
@ -143,6 +144,7 @@ public:
, is_sidechain (other.is_sidechain) , is_sidechain (other.is_sidechain)
, group_name (other.group_name) , group_name (other.group_name)
, group_channel (other.group_channel) , group_channel (other.group_channel)
, bus_number (other.bus_number)
{ } { }
std::string name; std::string name;
@ -150,6 +152,7 @@ public:
std::string group_name; std::string group_name;
uint32_t group_channel; uint32_t group_channel;
uint32_t bus_number;
}; };
virtual IOPortDescription describe_io_port (DataType dt, bool input, uint32_t id) const; virtual IOPortDescription describe_io_port (DataType dt, bool input, uint32_t id) const;

View File

@ -2,7 +2,7 @@
* Copyright (C) 2006-2016 David Robillard <d@drobilla.net> * Copyright (C) 2006-2016 David Robillard <d@drobilla.net>
* Copyright (C) 2007-2017 Paul Davis <paul@linuxaudiosystems.com> * Copyright (C) 2007-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2010 Carl Hetherington <carl@carlh.net> * Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
* Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org> * Copyright (C) 2013-2023 Robin Gareus <robin@gareus.org>
* Copyright (C) 2014-2017 Tim Mayberry <mojofunk@gmail.com> * Copyright (C) 2014-2017 Tim Mayberry <mojofunk@gmail.com>
* Copyright (C) 2015-2016 Nick Mainsbridge <mainsbridge@gmail.com> * Copyright (C) 2015-2016 Nick Mainsbridge <mainsbridge@gmail.com>
* Copyright (C) 2018 Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr> * Copyright (C) 2018 Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
@ -1776,6 +1776,7 @@ AUPlugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
} }
std::string busname; std::string busname;
uint32_t bus_number = 0;
bool is_sidechain = false; bool is_sidechain = false;
if (dt == DataType::AUDIO) { if (dt == DataType::AUDIO) {
@ -1788,7 +1789,8 @@ AUPlugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
ss << " / Bus " << (1 + bus); ss << " / Bus " << (1 + bus);
busname = _bus_name_in[bus]; busname = _bus_name_in[bus];
is_sidechain = bus > 0; is_sidechain = bus > 0;
busname = _bus_name_in[bus]; busname = _bus_name_in[bus];
bus_number = bus;
break; break;
} }
pid -= bus_inused[bus]; pid -= bus_inused[bus];
@ -1801,7 +1803,8 @@ AUPlugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
id = pid; id = pid;
ss << _bus_name_out[bus]; ss << _bus_name_out[bus];
ss << " / Bus " << (1 + bus); ss << " / Bus " << (1 + bus);
busname = _bus_name_out[bus]; busname = _bus_name_out[bus];
bus_number = bus;
break; break;
} }
pid -= bus_outputs[bus]; pid -= bus_outputs[bus];
@ -1820,8 +1823,9 @@ AUPlugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
Plugin::IOPortDescription iod (ss.str()); Plugin::IOPortDescription iod (ss.str());
iod.is_sidechain = is_sidechain; iod.is_sidechain = is_sidechain;
if (!busname.empty()) { if (!busname.empty()) {
iod.group_name = busname; iod.group_name = busname;
iod.group_channel = id; iod.group_channel = id;
iod.bus_number = bus_number;
} }
return iod; return iod;
} }

View File

@ -2,7 +2,7 @@
* Copyright (C) 2008-2012 Carl Hetherington <carl@carlh.net> * Copyright (C) 2008-2012 Carl Hetherington <carl@carlh.net>
* Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com> * Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2008-2019 David Robillard <d@drobilla.net> * Copyright (C) 2008-2019 David Robillard <d@drobilla.net>
* Copyright (C) 2012-2019 Robin Gareus <robin@gareus.org> * Copyright (C) 2012-2023 Robin Gareus <robin@gareus.org>
* Copyright (C) 2013-2018 John Emmas <john@creativepost.co.uk> * Copyright (C) 2013-2018 John Emmas <john@creativepost.co.uk>
* Copyright (C) 2013 Michael R. Fisher <mfisher@bketech.com> * Copyright (C) 2013 Michael R. Fisher <mfisher@bketech.com>
* Copyright (C) 2014-2016 Tim Mayberry <mojofunk@gmail.com> * Copyright (C) 2014-2016 Tim Mayberry <mojofunk@gmail.com>
@ -2448,6 +2448,7 @@ LV2Plugin::describe_io_port (ARDOUR::DataType dt, bool input, uint32_t id) const
if (lilv_nodes_size (grouplabel) > 0) { if (lilv_nodes_size (grouplabel) > 0) {
const LilvNode* grpname = lilv_nodes_get_first (grouplabel); const LilvNode* grpname = lilv_nodes_get_first (grouplabel);
iod.group_name = lilv_node_as_string (grpname); iod.group_name = lilv_node_as_string (grpname);
// TODO set iod.bus_number (nth group)
} }
lilv_nodes_free (grouplabel); lilv_nodes_free (grouplabel);

View File

@ -1656,7 +1656,7 @@ VST3PI::count_channels (Vst::MediaType media, Vst::BusDirection dir, Vst::BusTyp
return std::min<int32> (1, bus.channelCount); return std::min<int32> (1, bus.channelCount);
#else #else
/* Some plugin leave it at zero, even though they accept events */ /* Some plugin leave it at zero, even though they accept events */
_io_name[media][dir].push_back (Plugin::IOPortDescription (bus_name, is_sidechain)); _io_name[media][dir].push_back (Plugin::IOPortDescription (bus_name, is_sidechain, "", 0, i));
return 1; return 1;
#endif #endif
} else { } else {
@ -1667,7 +1667,7 @@ VST3PI::count_channels (Vst::MediaType media, Vst::BusDirection dir, Vst::BusTyp
} else { } else {
channel_name = bus_name; channel_name = bus_name;
} }
_io_name[media][dir].push_back (Plugin::IOPortDescription (channel_name, is_sidechain, bus_name, j)); _io_name[media][dir].push_back (Plugin::IOPortDescription (channel_name, is_sidechain, bus_name, j, i));
} }
n_channels += bus.channelCount; n_channels += bus.channelCount;
} }