mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
more adaptations to the latest changes in SG API
git-svn-id: svn://localhost/ardour2/branches/3.0-SG@13198 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
989830fb7e
commit
00d891e347
10 changed files with 348 additions and 230 deletions
|
|
@ -711,7 +711,7 @@ EngineControl::enumerate_devices (const string& driver)
|
||||||
/* XXX hard code 16 track estimate... takes no account of stereo, sends, busses, etc.
|
/* XXX hard code 16 track estimate... takes no account of stereo, sends, busses, etc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
soundgrid_init (16, 16, inputs_adjustment.get_value(), outputs_adjustment.get_value());
|
soundgrid_init (inputs_adjustment.get_value(), outputs_adjustment.get_value(), 16);
|
||||||
devices[driver] = SoundGrid::lan_port_names();
|
devices[driver] = SoundGrid::lan_port_names();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -74,23 +74,14 @@ soundgrid_shutdown ()
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
soundgrid_driver_init (uint32_t max_track_inputs, uint32_t max_track_outputs,
|
soundgrid_driver_init (uint32_t max_phys_inputs, uint32_t max_phys_outputs, uint32_t max_tracks)
|
||||||
uint32_t max_phys_inputs, uint32_t max_phys_outputs)
|
|
||||||
{
|
{
|
||||||
if (ARDOUR::SoundGrid::instance().configure_driver (max_track_inputs + max_phys_inputs, max_track_outputs + max_phys_outputs) == 0) {
|
ARDOUR::SoundGrid::instance().configure_driver (max_phys_inputs, max_phys_outputs, max_tracks);
|
||||||
if (ARDOUR::SoundGrid::instance().map_io_as_jack_ports (max_phys_inputs, max_phys_inputs)) {
|
|
||||||
error << "Failed to map " << max_phys_inputs << " inputs and "
|
|
||||||
<< max_phys_outputs << " outputs as JACK ports"
|
|
||||||
<< endmsg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false; /* do not call again */
|
return false; /* do not call again */
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
soundgrid_init (uint32_t max_track_inputs, uint32_t max_track_outputs,
|
soundgrid_init (uint32_t max_phys_inputs, uint32_t max_phys_outputs, uint32_t max_tracks)
|
||||||
uint32_t max_phys_inputs, uint32_t max_phys_outputs)
|
|
||||||
{
|
{
|
||||||
/* create a new window that we don't display (at least not as
|
/* create a new window that we don't display (at least not as
|
||||||
of August 2012, but we can give it to the SoundGrid library
|
of August 2012, but we can give it to the SoundGrid library
|
||||||
|
|
@ -107,8 +98,7 @@ soundgrid_init (uint32_t max_track_inputs, uint32_t max_track_outputs,
|
||||||
|
|
||||||
ARDOUR::SoundGrid::Shutdown.connect (sg_connection, MISSING_INVALIDATOR, soundgrid_shutdown, gui_context());
|
ARDOUR::SoundGrid::Shutdown.connect (sg_connection, MISSING_INVALIDATOR, soundgrid_shutdown, gui_context());
|
||||||
|
|
||||||
if (ARDOUR::SoundGrid::instance().initialize ([sg_window contentView], max_track_inputs, max_track_outputs,
|
if (ARDOUR::SoundGrid::instance().initialize ([sg_window contentView], max_tracks)) {
|
||||||
max_phys_inputs, max_phys_inputs)) {
|
|
||||||
|
|
||||||
[sg_window release];
|
[sg_window release];
|
||||||
sg_window = 0;
|
sg_window = 0;
|
||||||
|
|
@ -119,8 +109,7 @@ soundgrid_init (uint32_t max_track_inputs, uint32_t max_track_outputs,
|
||||||
/* as of early August 2012, we need to wait 5 seconds before configuring the CoreAudio driver */
|
/* as of early August 2012, we need to wait 5 seconds before configuring the CoreAudio driver */
|
||||||
|
|
||||||
Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (soundgrid_driver_init),
|
Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (soundgrid_driver_init),
|
||||||
max_track_inputs, max_track_outputs,
|
max_phys_inputs, max_phys_outputs, max_tracks), 5000);
|
||||||
max_phys_inputs, max_phys_outputs), 5000);
|
|
||||||
|
|
||||||
/* tell everyone/everything that we're using soundgrid */
|
/* tell everyone/everything that we're using soundgrid */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,7 @@ class SoundGrid : public boost::noncopyable
|
||||||
public:
|
public:
|
||||||
~SoundGrid ();
|
~SoundGrid ();
|
||||||
|
|
||||||
int initialize (void* window_handle, uint32_t max_track_inputs, uint32_t max_track_ouputs,
|
int initialize (void* window_handle, uint32_t max_tracks);
|
||||||
uint32_t max_phys_inputs, uint32_t max_phys_outputs);
|
|
||||||
int teardown ();
|
int teardown ();
|
||||||
|
|
||||||
static SoundGrid& instance();
|
static SoundGrid& instance();
|
||||||
|
|
@ -87,83 +86,136 @@ class SoundGrid : public boost::noncopyable
|
||||||
|
|
||||||
static PBD::Signal0<void> Shutdown;
|
static PBD::Signal0<void> Shutdown;
|
||||||
|
|
||||||
bool add_rack_synchronous (uint32_t clusterType, uint32_t &trackHandle);
|
bool add_rack_synchronous (uint32_t clusterType, int32_t process_group, uint32_t &trackHandle);
|
||||||
bool add_rack_asynchronous (uint32_t clusterType);
|
bool add_rack_asynchronous (uint32_t clusterType, int32_t process_group);
|
||||||
bool remove_rack_synchronous (uint32_t clusterType, uint32_t trackHandle);
|
bool remove_rack_synchronous (uint32_t clusterType, uint32_t trackHandle);
|
||||||
bool remove_all_racks_synchronous ();
|
bool remove_all_racks_synchronous ();
|
||||||
|
|
||||||
int set_gain (uint32_t in_clusterType, uint32_t in_trackHandle, double in_gainValue);
|
int set_gain (uint32_t in_clusterType, uint32_t in_trackHandle, double in_gainValue);
|
||||||
bool get_gain (uint32_t in_clusterType, uint32_t in_trackHandle, double &out_gainValue);
|
bool get_gain (uint32_t in_clusterType, uint32_t in_trackHandle, double &out_gainValue);
|
||||||
|
|
||||||
int configure_driver (uint32_t physical_inputs, uint32_t physical_outputs);
|
int configure_driver (uint32_t physical_inputs, uint32_t physical_outputs, uint32_t tracks);
|
||||||
|
|
||||||
struct Port {
|
struct Port {
|
||||||
uint32_t type;
|
|
||||||
uint32_t id;
|
|
||||||
uint32_t channel;
|
|
||||||
uint32_t matrix_sub;
|
|
||||||
|
|
||||||
Port (uint32_t t, uint32_t i, uint32_t c, uint32_t ms)
|
enum Position {
|
||||||
: type (t)
|
Pre,
|
||||||
, id (i)
|
Post
|
||||||
, channel (c)
|
};
|
||||||
, matrix_sub (ms) {}
|
|
||||||
|
uint32_t ctype;
|
||||||
|
uint32_t cid;
|
||||||
|
uint32_t stype;
|
||||||
|
uint32_t sindex;
|
||||||
|
uint32_t sid;
|
||||||
|
uint32_t channel;
|
||||||
|
Position position;
|
||||||
|
|
||||||
|
void set_source (WSAudioAssignment& assignment) const;
|
||||||
|
void set_destination (WSAudioAssignment& assignment) const;
|
||||||
|
|
||||||
/* control sorting and use in STL containers */
|
/* control sorting and use in STL containers */
|
||||||
bool operator<(const Port& other) const {
|
bool operator<(const Port& other) const {
|
||||||
return type < other.type && id < other.id && channel < other.channel && matrix_sub < other.matrix_sub;
|
return ctype < other.ctype &&
|
||||||
|
stype < other.stype &&
|
||||||
|
cid < other.cid &&
|
||||||
|
sid < other.sid &&
|
||||||
|
sindex < other.sindex &&
|
||||||
|
channel < other.channel &&
|
||||||
|
position < other.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool accepts_input () const {
|
||||||
|
if (ctype == eClusterType_Inputs) {
|
||||||
|
return true;
|
||||||
|
} else if (ctype == eClusterType_Outputs) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if (position == Post) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
EASGNSource sg_source () const {
|
||||||
|
switch (position) {
|
||||||
|
case Pre:
|
||||||
|
return kASGNPre;
|
||||||
|
default:
|
||||||
|
case Post:
|
||||||
|
return kASGNPost;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Port (uint32_t ct, uint32_t ci, uint32_t st, uint32_t si, uint32_t sd, uint32_t c, Position p)
|
||||||
|
: ctype (ct)
|
||||||
|
, cid (ci)
|
||||||
|
, stype (st)
|
||||||
|
, sindex (si)
|
||||||
|
, sid (sd)
|
||||||
|
, channel (c)
|
||||||
|
, position (p) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DriverInputPort : public Port {
|
struct DriverInputPort : public Port {
|
||||||
DriverInputPort (uint32_t channel)
|
DriverInputPort (uint32_t channel)
|
||||||
: Port (eClusterType_Inputs, eClusterHandle_Physical_Driver, eChainerSub_NoSub, channel) {}
|
: Port (eClusterType_Inputs, eClusterHandle_Physical_Driver,
|
||||||
|
wvEnum_Unknown, wvEnum_Unknown, wvEnum_Unknown, channel, Port::Pre) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DriverOutputPort : public Port {
|
struct DriverOutputPort : public Port {
|
||||||
DriverOutputPort (uint32_t channel)
|
DriverOutputPort (uint32_t channel)
|
||||||
: Port (eClusterType_Outputs, eClusterHandle_Physical_Driver, eChainerSub_NoSub, channel) {}
|
: Port (eClusterType_Outputs, eClusterHandle_Physical_Driver,
|
||||||
|
wvEnum_Unknown, wvEnum_Unknown, wvEnum_Unknown, channel, Port::Post) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PhysicalInputPort : public Port {
|
struct PhysicalInputPort : public Port {
|
||||||
PhysicalInputPort (uint32_t channel)
|
PhysicalInputPort (uint32_t channel)
|
||||||
: Port (eClusterType_Inputs, eClusterHandle_Physical_IO, eChainerSub_NoSub, channel) {}
|
: Port (eClusterType_Inputs, eClusterHandle_Physical_IO,
|
||||||
|
wvEnum_Unknown, wvEnum_Unknown, wvEnum_Unknown, channel, Port::Pre) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PhysicalOutputPort : public Port {
|
struct PhysicalOutputPort : public Port {
|
||||||
PhysicalOutputPort (uint32_t channel)
|
PhysicalOutputPort (uint32_t channel)
|
||||||
: Port (eClusterType_Outputs, eClusterHandle_Physical_IO, eChainerSub_NoSub, channel) {}
|
: Port (eClusterType_Outputs, eClusterHandle_Physical_IO,
|
||||||
|
wvEnum_Unknown, wvEnum_Unknown, wvEnum_Unknown, channel, Port::Post) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TrackInputPort : public Port {
|
struct TrackInputPort : public Port {
|
||||||
TrackInputPort (uint32_t chainer_id, uint32_t channel, uint32_t position)
|
TrackInputPort (uint32_t chainer_id, uint32_t channel)
|
||||||
: Port (eClusterType_Input, chainer_id, channel, position) {}
|
: Port (eClusterType_InputTrack, chainer_id,
|
||||||
|
eControlType_Input, 0, eControlID_Input_Digital_Trim, channel, Port::Pre) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TrackOutputPort : public Port {
|
struct TrackOutputPort : public Port {
|
||||||
TrackOutputPort (uint32_t chainer_id, uint32_t channel, uint32_t position)
|
TrackOutputPort (uint32_t chainer_id, uint32_t channel)
|
||||||
: Port (eClusterType_Input, chainer_id, channel, position) {}
|
: Port (eClusterType_InputTrack, chainer_id,
|
||||||
|
eControlType_Output, 0, eControlID_Output_Gain, channel, Port::Pre) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BusInputPort : public Port {
|
struct BusInputPort : public Port {
|
||||||
BusInputPort (uint32_t chainer_id, uint32_t channel, uint32_t position)
|
BusInputPort (uint32_t chainer_id, uint32_t channel)
|
||||||
: Port (eClusterType_Group, chainer_id, channel, position) {}
|
: Port (eClusterType_GroupTrack, chainer_id,
|
||||||
|
eControlType_Input, 0, eControlID_Input_Digital_Trim, channel, Port::Pre) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct BusOutputPort : public Port {
|
struct BusOutputPort : public Port {
|
||||||
BusOutputPort (uint32_t chainer_id, uint32_t channel, uint32_t position)
|
BusOutputPort (uint32_t chainer_id, uint32_t channel)
|
||||||
: Port (eClusterType_Group, chainer_id, channel, position) {}
|
: Port (eClusterType_GroupTrack, chainer_id,
|
||||||
|
eControlType_Output, 0, eControlID_Output_Gain, channel, Port::Pre) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int connect (const Port& src, const Port& dst);
|
int connect (const Port& src, const Port& dst);
|
||||||
int disconnect (const Port& src, const Port& dst);
|
int disconnect (const Port& src, const Port& dst);
|
||||||
|
|
||||||
std::string sg_port_as_jack_port (const Port& port);
|
std::string sg_port_as_jack_port (const Port& port);
|
||||||
bool jack_port_as_sg_port (const std::string& jack_port, Port& result);
|
bool jack_port_as_sg_port (const std::string& jack_port, Port& result);
|
||||||
|
|
||||||
int map_io_as_jack_ports (uint32_t ninputs, uint32_t noutputs);
|
void parameter_updated (WEParamType paramID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SoundGrid ();
|
SoundGrid ();
|
||||||
static SoundGrid* _instance;
|
static SoundGrid* _instance;
|
||||||
|
|
@ -216,7 +268,12 @@ class SoundGrid : public boost::noncopyable
|
||||||
};
|
};
|
||||||
|
|
||||||
void assignment_complete (WSCommand* cmd);
|
void assignment_complete (WSCommand* cmd);
|
||||||
|
bool get_driver_config (uint32_t& max_inputs,
|
||||||
|
uint32_t& max_outputs,
|
||||||
|
uint32_t& current_inputs,
|
||||||
|
uint32_t& current_outputs);
|
||||||
|
int connect_io_to_driver (uint32_t ninputs, uint32_t noutputs);
|
||||||
|
|
||||||
uint32_t _driver_ports; // how many total channels we tell the SG driver to allocate
|
uint32_t _driver_ports; // how many total channels we tell the SG driver to allocate
|
||||||
std::vector<bool> _driver_input_ports_in_use;
|
std::vector<bool> _driver_input_ports_in_use;
|
||||||
std::vector<bool> _driver_output_ports_in_use;
|
std::vector<bool> _driver_output_ports_in_use;
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ AutomationList::start_touch (double when)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AutomationList::stop_touch (bool mark, double when)
|
AutomationList::stop_touch (bool mark, double /*when*/)
|
||||||
{
|
{
|
||||||
if (g_atomic_int_get (&_touching) == 0) {
|
if (g_atomic_int_get (&_touching) == 0) {
|
||||||
/* this touch has already been stopped (probably by Automatable::transport_stopped),
|
/* this touch has already been stopped (probably by Automatable::transport_stopped),
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string&)
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[32];
|
char buf[32];
|
||||||
snprintf (buf, sizeof (buf), " %" PRIu32 " bit", absd.mBitsPerChannel);
|
snprintf (buf, sizeof (buf), " %" PRIu32 " bit", (uint32_t) absd.mBitsPerChannel);
|
||||||
_info.format_name += buf;
|
_info.format_name += buf;
|
||||||
_info.format_name += '\n';
|
_info.format_name += '\n';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include "ardour/ardour.h"
|
#include "ardour/ardour.h"
|
||||||
#include "ardour/debug.h"
|
#include "ardour/debug.h"
|
||||||
|
#include "ardour/port.h"
|
||||||
|
#include "ardour/port_set.h"
|
||||||
#include "ardour/route.h"
|
#include "ardour/route.h"
|
||||||
#include "ardour/track.h"
|
#include "ardour/track.h"
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
|
|
@ -43,19 +45,19 @@ SoundGridRack::SoundGridRack (Session& s, Route& r, const std::string& name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dynamic_cast<Track*> (&r) != 0) {
|
if (dynamic_cast<Track*> (&r) != 0) {
|
||||||
_cluster_type = eClusterType_Input;
|
_cluster_type = eClusterType_InputTrack;
|
||||||
} else {
|
} else {
|
||||||
/* bus */
|
/* bus */
|
||||||
if (r.is_master()) {
|
if (r.is_master()) {
|
||||||
_cluster_type = eClusterType_Input;
|
_cluster_type = eClusterType_InputTrack;
|
||||||
} else if (r.is_monitor()) {
|
} else if (r.is_monitor()) {
|
||||||
_cluster_type = eClusterType_Input;
|
_cluster_type = eClusterType_InputTrack;
|
||||||
} else {
|
} else {
|
||||||
_cluster_type = eClusterType_Input;
|
_cluster_type = eClusterType_InputTrack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SoundGrid::instance().add_rack_synchronous (_cluster_type, _rack_id)) {
|
if (SoundGrid::instance().add_rack_synchronous (_cluster_type, 0, _rack_id)) {
|
||||||
throw failed_constructor();
|
throw failed_constructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,32 +85,40 @@ SoundGridRack::make_connections ()
|
||||||
our output JACK ports to these JACK ports, thus establishing signal flow into the chainer.
|
our output JACK ports to these JACK ports, thus establishing signal flow into the chainer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if 0
|
|
||||||
string portname;
|
|
||||||
|
|
||||||
portname = SoundGrid::instance().sg_port_as_jack_port (SoundGrid::TrackInputPort (_rack_id, eChainerSub_NoSub, (uint32_t) -1));
|
|
||||||
|
|
||||||
if (portname.empty()) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_route.input()->disconnect (this);
|
|
||||||
_route.output()->disconnect (this);
|
_route.output()->disconnect (this);
|
||||||
|
|
||||||
/* wire up the driver input to the chainer input, thus allowing us to pick up data from the native OS driver
|
// SoundGrid::instance().connect (SoundGrid::PhysicalInputPort (0),
|
||||||
(where JACK will deliver it)
|
// SoundGrid::DriverOutputPort (0));
|
||||||
*/
|
|
||||||
|
PortSet& ports (_route.output()->ports());
|
||||||
|
uint32_t channel = 0;
|
||||||
|
|
||||||
SoundGrid::instance().connect (SoundGrid::PhysicalInputPort (0),
|
for (PortSet::iterator p = ports.begin(); p != ports.end(); ++p, ++channel) {
|
||||||
SoundGrid::DriverOutputPort (0));
|
|
||||||
|
|
||||||
SoundGrid::instance().connect (SoundGrid::DriverInputPort (0),
|
if (p->type() != DataType::AUDIO) {
|
||||||
SoundGrid::TrackInputPort (_rack_id, eChainerSub_NoSub, (uint32_t) -1));
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SoundGrid::instance().connect (SoundGrid::TrackOutputPort (_rack_id, eChainerSub_Left, eMixMatrixSub_PostFader),
|
/* find a JACK port that will be used to deliver data to the chainer input */
|
||||||
SoundGrid::PhysicalOutputPort (0));
|
|
||||||
|
|
||||||
|
string portname = SoundGrid::instance().sg_port_as_jack_port (SoundGrid::TrackInputPort (_rack_id, channel));
|
||||||
|
|
||||||
|
if (portname.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* connect this port to it */
|
||||||
|
|
||||||
|
p->connect (portname);
|
||||||
|
|
||||||
|
/* Now wire up the output of our SG chainer to ... yes, to what precisely ?
|
||||||
|
|
||||||
|
For now, wire it up to physical outputs 1 ( + 2, etc)
|
||||||
|
*/
|
||||||
|
|
||||||
|
SoundGrid::instance().connect (SoundGrid::TrackOutputPort (_rack_id, channel), SoundGrid::PhysicalOutputPort (channel));
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <WavesMixerCore/API/WCMixerCore_API.h>
|
#include <WavesMixerCore/API/WCMixerCore_API.h>
|
||||||
|
|
||||||
|
|
@ -103,22 +104,94 @@ SoundGrid::~SoundGrid()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SoundGrid::configure_driver (uint32_t inputs, uint32_t outputs)
|
SoundGrid::connect_io_to_driver (uint32_t ninputs, uint32_t noutputs)
|
||||||
|
{
|
||||||
|
/* the JACK ports for the native OS audio driver already exist,
|
||||||
|
because JACK will have created them based on the native
|
||||||
|
driver will have told JACK how many there are.
|
||||||
|
|
||||||
|
but we still need to connect the SG ports so that signal
|
||||||
|
does actually flow between the physical IO ports and the
|
||||||
|
native driver (thus enabling JACK to read/write data)
|
||||||
|
|
||||||
|
this is a special case that benefits from not calling connect() many times.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("setting up wiring for %1 inputs and %2 outputs\n", ninputs, noutputs));
|
||||||
|
|
||||||
|
if (ninputs) {
|
||||||
|
|
||||||
|
WSAssignmentsCommand inputsCommand;
|
||||||
|
Init_WSAddAssignmentsCommand(&inputsCommand, ninputs, (WSDControllerHandle)this, 0);
|
||||||
|
|
||||||
|
for (uint32_t n = 0; n < ninputs; ++n) {
|
||||||
|
|
||||||
|
ARDOUR::SoundGrid::DriverOutputPort dst (n); // readable driver/JACK port
|
||||||
|
ARDOUR::SoundGrid::PhysicalInputPort src (n); // where the signal should come from
|
||||||
|
WSAudioAssignment &assignment (inputsCommand.in_Assignments.m_aAssignments[n]);
|
||||||
|
|
||||||
|
src.set_source (assignment);
|
||||||
|
dst.set_destination (assignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = command (&inputsCommand.m_command);
|
||||||
|
|
||||||
|
Dispose_WSAudioAssignmentBatch (&inputsCommand.in_Assignments);
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (noutputs) {
|
||||||
|
|
||||||
|
WSAssignmentsCommand outputsCommand;
|
||||||
|
Init_WSAddAssignmentsCommand(&outputsCommand, noutputs, (WSDControllerHandle)this, 0);
|
||||||
|
|
||||||
|
for (uint32_t n = 0; n < noutputs; ++n) {
|
||||||
|
|
||||||
|
ARDOUR::SoundGrid::DriverInputPort src (n); // writable driver/JACK port
|
||||||
|
ARDOUR::SoundGrid::PhysicalOutputPort dst (n); // physical channel where the signal should go
|
||||||
|
WSAudioAssignment &assignment (outputsCommand.in_Assignments.m_aAssignments[n]);
|
||||||
|
|
||||||
|
src.set_source (assignment);
|
||||||
|
dst.set_destination (assignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = command (&outputsCommand.m_command);
|
||||||
|
|
||||||
|
Dispose_WSAudioAssignmentBatch (&outputsCommand.in_Assignments);
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SoundGrid::configure_driver (uint32_t inputs, uint32_t outputs, uint32_t tracks)
|
||||||
{
|
{
|
||||||
WSConfigSGDriverCommand myCommand;
|
WSConfigSGDriverCommand myCommand;
|
||||||
|
uint32_t in = inputs+tracks;
|
||||||
|
uint32_t out = outputs+tracks;
|
||||||
|
|
||||||
Init_WSConfigSGDriverCommand (&myCommand, inputs, outputs, (WSDControllerHandle)this, 0);
|
in = std::min (in, 32U);
|
||||||
|
out = std::min (out, 32U);
|
||||||
|
|
||||||
inputs = 32;
|
Init_WSConfigSGDriverCommand (&myCommand, in, out, (WSDControllerHandle)this, 0);
|
||||||
outputs = 32;
|
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("Initializing SG driver to use %1 inputs + %2 outputs\n",
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("Initializing SG driver to use %1 inputs + %2 outputs\n", in, out));
|
||||||
inputs, outputs));
|
|
||||||
|
|
||||||
if (command (&myCommand.m_command)) {
|
if (command (&myCommand.m_command)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* wire up inputs and outputs */
|
||||||
|
|
||||||
|
connect_io_to_driver (inputs, outputs);
|
||||||
|
|
||||||
/* set up the in-use bool vector */
|
/* set up the in-use bool vector */
|
||||||
|
|
||||||
_driver_output_ports_in_use.assign (outputs, false);
|
_driver_output_ports_in_use.assign (outputs, false);
|
||||||
|
|
@ -128,8 +201,7 @@ SoundGrid::configure_driver (uint32_t inputs, uint32_t outputs)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SoundGrid::initialize (void* window_handle, uint32_t max_track_inputs, uint32_t /*max_track_outputs*/,
|
SoundGrid::initialize (void* window_handle, uint32_t max_tracks)
|
||||||
uint32_t /*max_phys_inputs*/, uint32_t /*max_phys_outputs*/)
|
|
||||||
{
|
{
|
||||||
if (!_sg) {
|
if (!_sg) {
|
||||||
WTErr ret;
|
WTErr ret;
|
||||||
|
|
@ -141,13 +213,13 @@ SoundGrid::initialize (void* window_handle, uint32_t max_track_inputs, uint32_t
|
||||||
mixer_limits.m_clusterConfigs[eClusterType_Inputs].m_uiIndexNum = 2; // 1 for Ardour stuff, 1 for the coreaudio driver/JACK
|
mixer_limits.m_clusterConfigs[eClusterType_Inputs].m_uiIndexNum = 2; // 1 for Ardour stuff, 1 for the coreaudio driver/JACK
|
||||||
mixer_limits.m_clusterConfigs[eClusterType_Outputs].m_uiIndexNum = 2; // 1 for Ardour stuff, 1 for the coreaudio driver/JACK
|
mixer_limits.m_clusterConfigs[eClusterType_Outputs].m_uiIndexNum = 2; // 1 for Ardour stuff, 1 for the coreaudio driver/JACK
|
||||||
|
|
||||||
max_track_inputs = 64;
|
max_tracks = 64;
|
||||||
|
|
||||||
//the following is for the tracks that this app will create.
|
//the following is for the tracks that this app will create.
|
||||||
//This will probably be changed to eClusterType_Group in future.
|
//This will probably be changed to eClusterType_GroupTrack in future.
|
||||||
mixer_limits.m_clusterConfigs[eClusterType_Input].m_uiIndexNum = max_track_inputs;
|
mixer_limits.m_clusterConfigs[eClusterType_InputTrack].m_uiIndexNum = max_tracks;
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("Initializing SG Core with %1 tracks\n", max_track_inputs));
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("Initializing SG Core with %1 tracks\n", max_tracks));
|
||||||
|
|
||||||
// XXX use portable, installable technique for this
|
// XXX use portable, installable technique for this
|
||||||
|
|
||||||
|
|
@ -158,7 +230,7 @@ SoundGrid::initialize (void* window_handle, uint32_t max_track_inputs, uint32_t
|
||||||
driver_path += "/../build/libs/soundgrid/SurfaceDriver_App.bundle";
|
driver_path += "/../build/libs/soundgrid/SurfaceDriver_App.bundle";
|
||||||
|
|
||||||
if ((ret = InitializeMixerCoreDLL (&mixer_limits, driver_path.c_str(), window_handle, _sg_callback, this, &_sg)) != eNoErr) {
|
if ((ret = InitializeMixerCoreDLL (&mixer_limits, driver_path.c_str(), window_handle, _sg_callback, this, &_sg)) != eNoErr) {
|
||||||
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("Initialized SG core, ret = %1 core handle %2\n", ret, _sg));
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("Failed to initialize SG core, ret = %1 core handle %2\n", ret, _sg));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,18 +281,13 @@ SoundGrid::get (WSControlID* id, WSControlInfo* info)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_callback_table.getControlInfoProc (_host_handle, this, id, info) != eNoErr) {
|
if (_callback_table.getControlInfoProc (_host_handle, id, info) != eNoErr) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
SoundGrid::event_completed (int)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SoundGrid::finalize (void* ecc, int state)
|
SoundGrid::finalize (void* ecc, int state)
|
||||||
{
|
{
|
||||||
|
|
@ -237,14 +304,13 @@ SoundGrid::_finalize (void* p, int state)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SoundGrid::set (WSEvent* ev, const std::string& what)
|
SoundGrid::set (WSEvent* ev, const std::string& /*what*/)
|
||||||
{
|
{
|
||||||
if (!_host_handle) {
|
if (!_host_handle) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ev->sourceController = (WSDControllerHandle) this;
|
ev->sourceController = (WSDControllerHandle) this;
|
||||||
ev->eventTicket = new EventCompletionClosure (what, boost::bind (&SoundGrid::event_completed, this, _1));
|
|
||||||
|
|
||||||
if (_callback_table.setEventProc (_host_handle, this, ev) != eNoErr) {
|
if (_callback_table.setEventProc (_host_handle, this, ev) != eNoErr) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -342,6 +408,46 @@ SoundGrid::set_parameters (const std::string& device, int sr, int bufsize)
|
||||||
return instance().set ((WSEvent*) &ev, __SG_WHERE);
|
return instance().set ((WSEvent*) &ev, __SG_WHERE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
SoundGrid::get_driver_config (uint32_t& max_inputs,
|
||||||
|
uint32_t& max_outputs,
|
||||||
|
uint32_t& current_inputs,
|
||||||
|
uint32_t& current_outputs)
|
||||||
|
{
|
||||||
|
WSDriverConfigParam driverConfig;
|
||||||
|
WMSDErr errCode = _callback_table.getParamProc (_host_handle, eParamType_DriverConfig,
|
||||||
|
Init_WSDriverConfigParam (&driverConfig));
|
||||||
|
|
||||||
|
if (0 == errCode) {
|
||||||
|
max_inputs = driverConfig.out_MaxInputChannels;
|
||||||
|
max_outputs = driverConfig.out_MaxOutputChannels;
|
||||||
|
current_inputs = driverConfig.out_CurrentInputChannels;
|
||||||
|
current_outputs = driverConfig.out_CurrentOutputChannels;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("could not get soundgrid driver config, err = %1\n", errCode));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SoundGrid::parameter_updated (WEParamType paramID)
|
||||||
|
{
|
||||||
|
uint32_t maxInputs=0, maxOutputs=0, curInputs=0, curOutputs=0;
|
||||||
|
|
||||||
|
switch (paramID) {
|
||||||
|
case eParamType_DriverConfig:
|
||||||
|
if (get_driver_config (maxInputs, maxOutputs, curInputs, curOutputs)) {
|
||||||
|
// do something to tell the GUI ?
|
||||||
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("Driver configuration changed to max: %1/%2 current: %3/%4\n",
|
||||||
|
maxInputs, maxOutputs, curInputs, curOutputs));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
vector<string>
|
vector<string>
|
||||||
SoundGrid::lan_port_names ()
|
SoundGrid::lan_port_names ()
|
||||||
{
|
{
|
||||||
|
|
@ -503,6 +609,9 @@ SoundGrid::sg_callback (const WSControlID* cid)
|
||||||
void
|
void
|
||||||
SoundGrid::driver_register (const WSDCoreHandle ch, const WSCoreCallbackTable* ct, const WSMixerConfig* mc)
|
SoundGrid::driver_register (const WSDCoreHandle ch, const WSCoreCallbackTable* ct, const WSMixerConfig* mc)
|
||||||
{
|
{
|
||||||
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("Register driver complete, handles are core: %1 callbacks: %2, config: %3\n",
|
||||||
|
ch, ct, mc));
|
||||||
|
|
||||||
if (_instance) {
|
if (_instance) {
|
||||||
_instance->_host_handle = ch;
|
_instance->_host_handle = ch;
|
||||||
|
|
||||||
|
|
@ -527,23 +636,32 @@ SoundGrid::assignment_complete (WSCommand* cmd)
|
||||||
|
|
||||||
WSAssignmentsCommand* acmd = (WSAssignmentsCommand*) cmd;
|
WSAssignmentsCommand* acmd = (WSAssignmentsCommand*) cmd;
|
||||||
WSAudioAssignment& assignment (acmd->in_Assignments.m_aAssignments[0]);
|
WSAudioAssignment& assignment (acmd->in_Assignments.m_aAssignments[0]);
|
||||||
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("assignment complete for %1:%2:%3 to %4:%5:%6\n",
|
WSControlID &destination (assignment.m_asgnDest.m_controlID);
|
||||||
assignment.m_asgnSrc.m_chainerID.clusterType,
|
WSControlID &source (assignment.m_asgnSrc.m_controlID);
|
||||||
assignment.m_asgnSrc.m_chainerID.clusterHandle,
|
|
||||||
assignment.m_asgnSrc.m_uiMixMtxSubIndex,
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("assignment complete for %1:%2:%3:%4:%5:%6 => %7:%8:%9:%10:%11:%12\n",
|
||||||
assignment.m_asgnDest.m_chainerID.clusterType,
|
source.clusterID.clusterType,
|
||||||
assignment.m_asgnDest.m_chainerID.clusterHandle,
|
source.clusterID.clusterHandle,
|
||||||
assignment.m_asgnDest.m_uiMixMtxSubIndex));
|
source.sectionControlID.sectionType,
|
||||||
|
source.sectionControlID.sectionIndex,
|
||||||
|
source.sectionControlID.channelIndex,
|
||||||
|
assignment.m_asgnSrc.m_PrePost,
|
||||||
|
destination.clusterID.clusterType,
|
||||||
|
destination.clusterID.clusterHandle,
|
||||||
|
destination.sectionControlID.sectionType,
|
||||||
|
destination.sectionControlID.sectionIndex,
|
||||||
|
destination.sectionControlID.channelIndex,
|
||||||
|
assignment.m_asgnDest.m_PrePost));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actually do stuff */
|
/* Actually do stuff */
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SoundGrid::add_rack_synchronous (uint32_t clusterType, uint32_t &trackHandle)
|
SoundGrid::add_rack_synchronous (uint32_t clusterType, int32_t process_group, uint32_t &trackHandle)
|
||||||
{
|
{
|
||||||
WSAddTrackCommand myCommand;
|
WSAddTrackCommand myCommand;
|
||||||
|
|
||||||
command (Init_WSAddTrackCommand (&myCommand, clusterType, 1, (WSDControllerHandle)this, 0));
|
command (Init_WSAddTrackCommand (&myCommand, clusterType, 1, process_group, (WSDControllerHandle)this, 0));
|
||||||
|
|
||||||
if (0 == myCommand.m_command.out_status) {
|
if (0 == myCommand.m_command.out_status) {
|
||||||
trackHandle = myCommand.out_trackID.clusterHandle;
|
trackHandle = myCommand.out_trackID.clusterHandle;
|
||||||
|
|
@ -554,10 +672,10 @@ SoundGrid::add_rack_synchronous (uint32_t clusterType, uint32_t &trackHandle)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SoundGrid::add_rack_asynchronous (uint32_t clusterType)
|
SoundGrid::add_rack_asynchronous (uint32_t clusterType, int32_t process_group)
|
||||||
{
|
{
|
||||||
WSAddTrackCommand *pMyCommand = new WSAddTrackCommand;
|
WSAddTrackCommand *pMyCommand = new WSAddTrackCommand;
|
||||||
WMSDErr errCode = command (Init_WSAddTrackCommand (pMyCommand, clusterType, 1, (WSDControllerHandle)this, pMyCommand));
|
WMSDErr errCode = command (Init_WSAddTrackCommand (pMyCommand, clusterType, 1, process_group, (WSDControllerHandle)this, pMyCommand));
|
||||||
|
|
||||||
printf ("AddRack Command result = %d, command status = %d\n", errCode, pMyCommand->m_command.out_status);
|
printf ("AddRack Command result = %d, command status = %d\n", errCode, pMyCommand->m_command.out_status);
|
||||||
|
|
||||||
|
|
@ -619,7 +737,7 @@ SoundGrid::get_gain (uint32_t in_clusterType, uint32_t in_trackHandle, double &o
|
||||||
|
|
||||||
faderInfo.m_controlID.sectionControlID.sectionType = eControlType_Output;
|
faderInfo.m_controlID.sectionControlID.sectionType = eControlType_Output;
|
||||||
faderInfo.m_controlID.sectionControlID.sectionIndex = eControlType_Output_Local;
|
faderInfo.m_controlID.sectionControlID.sectionIndex = eControlType_Output_Local;
|
||||||
faderInfo.m_controlID.sectionControlID.channelIndex = 0;
|
faderInfo.m_controlID.sectionControlID.channelIndex = wvEnum_Unknown;
|
||||||
faderInfo.m_controlID.sectionControlID.controlID = eControlID_Output_Gain;
|
faderInfo.m_controlID.sectionControlID.controlID = eControlID_Output_Gain;
|
||||||
|
|
||||||
if (get (&faderInfo.m_controlID, &faderInfo) == 0) {
|
if (get (&faderInfo.m_controlID, &faderInfo) == 0) {
|
||||||
|
|
@ -663,7 +781,7 @@ SoundGrid::sg_port_as_jack_port (const Port& sgport)
|
||||||
bool found = false;
|
bool found = false;
|
||||||
bool inputs = false;
|
bool inputs = false;
|
||||||
|
|
||||||
if (sgport.type == eClusterType_Input || sgport.type == eClusterType_Inputs) {
|
if (sgport.accepts_input()) {
|
||||||
|
|
||||||
inputs = true;
|
inputs = true;
|
||||||
|
|
||||||
|
|
@ -712,12 +830,16 @@ SoundGrid::sg_port_as_jack_port (const Port& sgport)
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
if (inputs) {
|
if (inputs) {
|
||||||
Port driverport = DriverOutputPort (driver_channel);
|
Port driverport = DriverInputPort (driver_channel);
|
||||||
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("connecting driver_channel %2 to sgport %1\n",
|
||||||
|
sgport, driver_channel));
|
||||||
if (connect (driverport, sgport) != 0) {
|
if (connect (driverport, sgport) != 0) {
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Port driverport = DriverInputPort (driver_channel);
|
Port driverport = DriverOutputPort (driver_channel);
|
||||||
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("connecting sgport %1 to driver channel %2\n",
|
||||||
|
sgport, driver_channel));
|
||||||
if (connect (sgport, driverport) != 0) {
|
if (connect (sgport, driverport) != 0) {
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
@ -752,19 +874,16 @@ SoundGrid::connect (const Port& src, const Port& dst)
|
||||||
Init_WSAddAssignmentsCommand(&myCommand, 1, (WSDControllerHandle)this, 0);
|
Init_WSAddAssignmentsCommand(&myCommand, 1, (WSDControllerHandle)this, 0);
|
||||||
WSAudioAssignment &assignment (myCommand.in_Assignments.m_aAssignments[0]);
|
WSAudioAssignment &assignment (myCommand.in_Assignments.m_aAssignments[0]);
|
||||||
|
|
||||||
assignment.m_asgnSrc.m_chainerID.clusterType = src.type;
|
src.set_source (assignment);
|
||||||
assignment.m_asgnSrc.m_chainerID.clusterHandle = src.id;
|
dst.set_destination (assignment);
|
||||||
assignment.m_asgnSrc.m_eChainerSubIndex = (WEChainerSub) src.channel;
|
|
||||||
assignment.m_asgnSrc.m_uiMixMtxSubIndex = src.matrix_sub;
|
|
||||||
|
|
||||||
assignment.m_asgnDest.m_chainerID.clusterType = dst.type;
|
|
||||||
assignment.m_asgnDest.m_chainerID.clusterHandle = dst.id;
|
|
||||||
assignment.m_asgnDest.m_eChainerSubIndex = (WEChainerSub) dst.channel;
|
|
||||||
assignment.m_asgnDest.m_uiMixMtxSubIndex = dst.matrix_sub;
|
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("connect %1 => %2\n", src, dst));
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("connect %1 => %2\n", src, dst));
|
||||||
|
|
||||||
return command (&myCommand.m_command);
|
int ret = command (&myCommand.m_command);
|
||||||
|
|
||||||
|
Dispose_WSAudioAssignmentBatch (&myCommand.in_Assignments);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -775,104 +894,54 @@ SoundGrid::disconnect (const Port& src, const Port& dst)
|
||||||
Init_WSRemoveAssignmentsCommand(&myCommand, 1, (WSDControllerHandle)this, 0);
|
Init_WSRemoveAssignmentsCommand(&myCommand, 1, (WSDControllerHandle)this, 0);
|
||||||
WSAudioAssignment &assignment (myCommand.in_Assignments.m_aAssignments[0]);
|
WSAudioAssignment &assignment (myCommand.in_Assignments.m_aAssignments[0]);
|
||||||
|
|
||||||
assignment.m_asgnSrc.m_chainerID.clusterType = src.type;
|
src.set_source (assignment);
|
||||||
assignment.m_asgnSrc.m_chainerID.clusterHandle = src.id;
|
dst.set_destination (assignment);
|
||||||
assignment.m_asgnSrc.m_eChainerSubIndex = (WEChainerSub) src.channel;
|
|
||||||
assignment.m_asgnSrc.m_uiMixMtxSubIndex = src.matrix_sub;
|
|
||||||
|
|
||||||
assignment.m_asgnDest.m_chainerID.clusterType = dst.type;
|
|
||||||
assignment.m_asgnDest.m_chainerID.clusterHandle = dst.id;
|
|
||||||
assignment.m_asgnDest.m_eChainerSubIndex = (WEChainerSub) dst.channel;
|
|
||||||
assignment.m_asgnDest.m_uiMixMtxSubIndex = dst.matrix_sub;
|
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("DIS-connect %1 ... %2\n", src, dst));
|
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("DIS-connect %1 ... %2\n", src, dst));
|
||||||
|
|
||||||
return command (&myCommand.m_command);
|
int ret = command (&myCommand.m_command);
|
||||||
|
|
||||||
|
Dispose_WSAudioAssignmentBatch (&myCommand.in_Assignments);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
SoundGrid::map_io_as_jack_ports (uint32_t ninputs, uint32_t noutputs)
|
SoundGrid::Port::set_source (WSAudioAssignment& assignment) const
|
||||||
{
|
{
|
||||||
return 0;
|
WSControlID &c (assignment.m_asgnSrc.m_controlID);
|
||||||
|
|
||||||
ninputs = 0;
|
c.clusterID.clusterType = ctype;
|
||||||
noutputs = 1;
|
c.clusterID.clusterHandle = cid;
|
||||||
|
c.sectionControlID.sectionType = stype;
|
||||||
|
c.sectionControlID.sectionIndex = sindex;
|
||||||
|
c.sectionControlID.controlID = sid;
|
||||||
|
c.sectionControlID.channelIndex = channel;
|
||||||
|
|
||||||
/* the JACK ports for the native OS audio driver already exist,
|
assignment.m_asgnSrc.m_PrePost = sg_source();
|
||||||
because JACK will have created them based on the native
|
}
|
||||||
driver will have told JACK how many there are.
|
|
||||||
|
|
||||||
but we still need to connect the SG ports so that signal
|
void
|
||||||
does actually flow between the physical IO ports and the
|
SoundGrid::Port::set_destination (WSAudioAssignment& assignment) const
|
||||||
native driver (thus enabling JACK to read/write data)
|
{
|
||||||
|
WSControlID &c (assignment.m_asgnDest.m_controlID);
|
||||||
|
|
||||||
this is a special case that benefits from not calling connect() many times.
|
c.clusterID.clusterType = ctype;
|
||||||
*/
|
c.clusterID.clusterHandle = cid;
|
||||||
|
c.sectionControlID.sectionType = stype;
|
||||||
|
c.sectionControlID.sectionIndex = sindex;
|
||||||
|
c.sectionControlID.controlID = sid;
|
||||||
|
c.sectionControlID.channelIndex = channel;
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::SoundGrid, string_compose ("setting up wiring for %1 inputs and %2 outputs\n", ninputs, noutputs));
|
assignment.m_asgnDest.m_PrePost = sg_source();
|
||||||
|
|
||||||
if (ninputs) {
|
|
||||||
|
|
||||||
WSAssignmentsCommand inputsCommand;
|
|
||||||
Init_WSAddAssignmentsCommand(&inputsCommand, ninputs, (WSDControllerHandle)this, 0);
|
|
||||||
|
|
||||||
for (uint32_t n = 0; n < ninputs; ++n) {
|
|
||||||
|
|
||||||
WSAudioAssignment &assignment (inputsCommand.in_Assignments.m_aAssignments[n]);
|
|
||||||
ARDOUR::SoundGrid::DriverOutputPort dst (n); // readable driver/JACK port
|
|
||||||
ARDOUR::SoundGrid::PhysicalInputPort src (n); // where the signal should come from
|
|
||||||
|
|
||||||
assignment.m_asgnSrc.m_chainerID.clusterType = src.type;
|
|
||||||
assignment.m_asgnSrc.m_chainerID.clusterHandle = src.id;
|
|
||||||
assignment.m_asgnSrc.m_eChainerSubIndex = (WEChainerSub) src.channel;
|
|
||||||
assignment.m_asgnSrc.m_uiMixMtxSubIndex = src.matrix_sub;
|
|
||||||
|
|
||||||
assignment.m_asgnDest.m_chainerID.clusterType = dst.type;
|
|
||||||
assignment.m_asgnDest.m_chainerID.clusterHandle = dst.id;
|
|
||||||
assignment.m_asgnDest.m_eChainerSubIndex = (WEChainerSub) dst.channel;
|
|
||||||
assignment.m_asgnDest.m_uiMixMtxSubIndex = dst.matrix_sub;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (command (&inputsCommand.m_command) != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (noutputs) {
|
|
||||||
|
|
||||||
WSAssignmentsCommand outputsCommand;
|
|
||||||
Init_WSAddAssignmentsCommand(&outputsCommand, noutputs, (WSDControllerHandle)this, 0);
|
|
||||||
|
|
||||||
for (uint32_t n = 0; n < noutputs; ++n) {
|
|
||||||
|
|
||||||
WSAudioAssignment &assignment (outputsCommand.in_Assignments.m_aAssignments[n]);
|
|
||||||
ARDOUR::SoundGrid::DriverInputPort src (n); // writable driver/JACK port
|
|
||||||
ARDOUR::SoundGrid::PhysicalOutputPort dst (n); // physical channel where the signal should go
|
|
||||||
|
|
||||||
assignment.m_asgnSrc.m_chainerID.clusterType = src.type;
|
|
||||||
assignment.m_asgnSrc.m_chainerID.clusterHandle = src.id;
|
|
||||||
assignment.m_asgnSrc.m_eChainerSubIndex = (WEChainerSub) src.channel;
|
|
||||||
assignment.m_asgnSrc.m_uiMixMtxSubIndex = src.matrix_sub;
|
|
||||||
|
|
||||||
assignment.m_asgnDest.m_chainerID.clusterType = dst.type;
|
|
||||||
assignment.m_asgnDest.m_chainerID.clusterHandle = dst.id;
|
|
||||||
assignment.m_asgnDest.m_eChainerSubIndex = (WEChainerSub) dst.channel;
|
|
||||||
assignment.m_asgnDest.m_uiMixMtxSubIndex = dst.matrix_sub;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (command (&outputsCommand.m_command) != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<< (std::ostream& out, const SoundGrid::Port& p)
|
operator<< (std::ostream& out, const SoundGrid::Port& p)
|
||||||
{
|
{
|
||||||
out << p.type << ':' << p.id << ':' << p.channel << ':' << p.matrix_sub;
|
out << p.ctype << ':' << p.cid
|
||||||
|
<< ':' << p.stype << ':' << p.sindex << ':' << p.sid
|
||||||
|
<< ':' << p.channel << ':' << p.position;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -548,7 +548,7 @@ ControlList::start_write_pass (double when)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ControlList::write_pass_finished (double when)
|
ControlList::write_pass_finished (double /*when*/)
|
||||||
{
|
{
|
||||||
if (did_write_during_pass) {
|
if (did_write_during_pass) {
|
||||||
thin ();
|
thin ();
|
||||||
|
|
|
||||||
|
|
@ -423,7 +423,7 @@ MasterDeviceNames::find_patch(std::string mode, uint8_t channel, PatchPrimaryKey
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
MasterDeviceNames::set_state(const XMLTree& tree, const XMLNode& a_node)
|
MasterDeviceNames::set_state(const XMLTree& tree, const XMLNode& /*a_node*/)
|
||||||
{
|
{
|
||||||
// Manufacturer
|
// Manufacturer
|
||||||
boost::shared_ptr<XMLSharedNodeList> manufacturer = tree.find("//Manufacturer");
|
boost::shared_ptr<XMLSharedNodeList> manufacturer = tree.find("//Manufacturer");
|
||||||
|
|
@ -540,7 +540,7 @@ MIDINameDocument::MIDINameDocument (const string& filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
MIDINameDocument::set_state (const XMLTree& tree, const XMLNode& a_node)
|
MIDINameDocument::set_state (const XMLTree& tree, const XMLNode& /*a_node*/)
|
||||||
{
|
{
|
||||||
// Author
|
// Author
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ static const char* controller_type = PROGRAM_NAME;
|
||||||
uint32_t
|
uint32_t
|
||||||
WMSD_QueryInterfaceVersion()
|
WMSD_QueryInterfaceVersion()
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::SGDriver, string_compose ("ControllerDriver:%1\n", __FUNCTION__));
|
DEBUG_TRACE (DEBUG::SGDriver, string_compose ("ControllerDriver:%1 - response = %2\n", __FUNCTION__, WMSD_INTERFACE_VERSION));
|
||||||
return WMSD_INTERFACE_VERSION;
|
return WMSD_INTERFACE_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,9 +130,6 @@ WMSD_ControllerDisplayUpdate (const WSDControllerHandle controllerHandle,
|
||||||
case eClusterType_Global_Channel:
|
case eClusterType_Global_Channel:
|
||||||
DEBUG_TRACE (DEBUG::SGDriver, "Channel\n");
|
DEBUG_TRACE (DEBUG::SGDriver, "Channel\n");
|
||||||
break;
|
break;
|
||||||
case eClusterType_Global_RequestTimeout:
|
|
||||||
DEBUG_TRACE (DEBUG::SGDriver, "RequestTimeout\n");
|
|
||||||
break;
|
|
||||||
case eClusterType_Global_SurfacesSetup:
|
case eClusterType_Global_SurfacesSetup:
|
||||||
DEBUG_TRACE (DEBUG::SGDriver, "SurfacesSetup\n");
|
DEBUG_TRACE (DEBUG::SGDriver, "SurfacesSetup\n");
|
||||||
break;
|
break;
|
||||||
|
|
@ -170,30 +167,12 @@ WMSD_ControllerDisplayUpdate (const WSDControllerHandle controllerHandle,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eClusterType_Input:
|
case eClusterType_InputTrack:
|
||||||
// DEBUG_TRACE (DEBUG::SGDriver, "update, InputChannel\n");
|
// DEBUG_TRACE (DEBUG::SGDriver, "update, InputChannel\n");
|
||||||
break;
|
break;
|
||||||
case eClusterType_Group:
|
case eClusterType_GroupTrack:
|
||||||
// DEBUG_TRACE (DEBUG::SGDriver, "update, GroupChannel\n");
|
// DEBUG_TRACE (DEBUG::SGDriver, "update, GroupChannel\n");
|
||||||
break;
|
break;
|
||||||
case eClusterType_Aux:
|
|
||||||
// DEBUG_TRACE (DEBUG::SGDriver, "update, AuxChannel\n");
|
|
||||||
break;
|
|
||||||
case eClusterType_Matrix:
|
|
||||||
// DEBUG_TRACE (DEBUG::SGDriver, "update, MatrixChannel\n");
|
|
||||||
break;
|
|
||||||
case eClusterType_LCRM:
|
|
||||||
// DEBUG_TRACE (DEBUG::SGDriver, "update, LCRMChannel\n");
|
|
||||||
break;
|
|
||||||
case eClusterType_DCA:
|
|
||||||
// DEBUG_TRACE (DEBUG::SGDriver, "update, DCAChannel\n");
|
|
||||||
break;
|
|
||||||
case eClusterType_Cue:
|
|
||||||
// DEBUG_TRACE (DEBUG::SGDriver, "update, CueChannel\n");
|
|
||||||
break;
|
|
||||||
case eClusterType_TB:
|
|
||||||
// DEBUG_TRACE (DEBUG::SGDriver, "update, TBChannel\n");
|
|
||||||
break;
|
|
||||||
case eClusterType_Inputs:
|
case eClusterType_Inputs:
|
||||||
// DEBUG_TRACE (DEBUG::SGDriver, "update, Inputs\n");
|
// DEBUG_TRACE (DEBUG::SGDriver, "update, Inputs\n");
|
||||||
break;
|
break;
|
||||||
|
|
@ -224,4 +203,18 @@ WMSD_GetTypeForController (const WSDControllerHandle /*controllerHandle*/, char
|
||||||
return eNoErr;
|
return eNoErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WMSDErr
|
||||||
|
WMSD_ControllerParamUpdate (const WSDControllerHandle controllerHandle, WEParamType paramID)
|
||||||
|
{
|
||||||
|
SoundGrid* sg = (SoundGrid*) controllerHandle;
|
||||||
|
|
||||||
|
DEBUG_TRACE (DEBUG::SGDriver, string_compose ("ControllerDriver:%1\n", __FUNCTION__));
|
||||||
|
|
||||||
|
if (sg) {
|
||||||
|
sg->parameter_updated (paramID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return eNoErr;
|
||||||
|
}
|
||||||
|
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue