mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
provide an easier way to add mixed (audio+MIDI) tracks to a session, to facilitate the use of plugins like Reaktor which accept both audio & MIDI data. there's probably still a paradigm shift waiting to happen here but its likely post-3.0.
git-svn-id: svn://localhost/ardour2/branches/3.0@12816 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
774e55bcc0
commit
d70429a066
7 changed files with 145 additions and 61 deletions
|
|
@ -77,6 +77,7 @@ AddRouteDialog::AddRouteDialog (Session* s)
|
||||||
|
|
||||||
track_bus_combo.append_text (_("Audio Tracks"));
|
track_bus_combo.append_text (_("Audio Tracks"));
|
||||||
track_bus_combo.append_text (_("MIDI Tracks"));
|
track_bus_combo.append_text (_("MIDI Tracks"));
|
||||||
|
track_bus_combo.append_text (_("Audio+MIDI Tracks"));
|
||||||
track_bus_combo.append_text (_("Busses"));
|
track_bus_combo.append_text (_("Busses"));
|
||||||
track_bus_combo.set_active (0);
|
track_bus_combo.set_active (0);
|
||||||
|
|
||||||
|
|
@ -191,6 +192,23 @@ AddRouteDialog::channel_combo_changed ()
|
||||||
refill_track_modes ();
|
refill_track_modes ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddRouteDialog::TypeWanted
|
||||||
|
AddRouteDialog::type_wanted() const
|
||||||
|
{
|
||||||
|
switch (track_bus_combo.get_active_row_number ()) {
|
||||||
|
case 0:
|
||||||
|
return AudioTrack;
|
||||||
|
case 1:
|
||||||
|
return MidiTrack;
|
||||||
|
case 2:
|
||||||
|
return MixedTrack;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return AudioBus;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AddRouteDialog::maybe_update_name_template_entry ()
|
AddRouteDialog::maybe_update_name_template_entry ()
|
||||||
{
|
{
|
||||||
|
|
@ -198,59 +216,68 @@ AddRouteDialog::maybe_update_name_template_entry ()
|
||||||
name_template_entry.get_text() != "" &&
|
name_template_entry.get_text() != "" &&
|
||||||
name_template_entry.get_text() != _("Audio") &&
|
name_template_entry.get_text() != _("Audio") &&
|
||||||
name_template_entry.get_text() != _("MIDI") &&
|
name_template_entry.get_text() != _("MIDI") &&
|
||||||
|
name_template_entry.get_text() != _("Audio+MIDI") &&
|
||||||
name_template_entry.get_text() != _("Bus")) {
|
name_template_entry.get_text() != _("Bus")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audio_tracks_wanted ()) {
|
switch (type_wanted()) {
|
||||||
|
case AudioTrack:
|
||||||
name_template_entry.set_text (_("Audio"));
|
name_template_entry.set_text (_("Audio"));
|
||||||
} else if (midi_tracks_wanted()) {
|
break;
|
||||||
|
case MidiTrack:
|
||||||
name_template_entry.set_text (_("MIDI"));
|
name_template_entry.set_text (_("MIDI"));
|
||||||
} else {
|
break;
|
||||||
|
case MixedTrack:
|
||||||
|
name_template_entry.set_text (_("Audio+MIDI"));
|
||||||
|
break;
|
||||||
|
case AudioBus:
|
||||||
name_template_entry.set_text (_("Bus"));
|
name_template_entry.set_text (_("Bus"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AddRouteDialog::track_type_chosen ()
|
AddRouteDialog::track_type_chosen ()
|
||||||
{
|
{
|
||||||
if (midi_tracks_wanted()) {
|
switch (type_wanted()) {
|
||||||
channel_combo.set_sensitive (false);
|
case AudioTrack:
|
||||||
mode_combo.set_sensitive (false);
|
|
||||||
instrument_combo.set_sensitive (true);
|
|
||||||
configuration_label.set_sensitive (false);
|
|
||||||
mode_label.set_sensitive (false);
|
|
||||||
instrument_label.set_sensitive (true);
|
|
||||||
} else if (audio_tracks_wanted()) {
|
|
||||||
mode_combo.set_sensitive (true);
|
mode_combo.set_sensitive (true);
|
||||||
channel_combo.set_sensitive (true);
|
channel_combo.set_sensitive (true);
|
||||||
instrument_combo.set_sensitive (false);
|
instrument_combo.set_sensitive (false);
|
||||||
configuration_label.set_sensitive (true);
|
configuration_label.set_sensitive (true);
|
||||||
mode_label.set_sensitive (true);
|
mode_label.set_sensitive (true);
|
||||||
instrument_label.set_sensitive (false);
|
instrument_label.set_sensitive (false);
|
||||||
} else {
|
break;
|
||||||
|
case MidiTrack:
|
||||||
|
channel_combo.set_sensitive (false);
|
||||||
|
mode_combo.set_sensitive (false);
|
||||||
|
instrument_combo.set_sensitive (true);
|
||||||
|
configuration_label.set_sensitive (false);
|
||||||
|
mode_label.set_sensitive (false);
|
||||||
|
instrument_label.set_sensitive (true);
|
||||||
|
break;
|
||||||
|
case MixedTrack:
|
||||||
|
channel_combo.set_sensitive (true);
|
||||||
|
mode_combo.set_sensitive (true);
|
||||||
|
instrument_combo.set_sensitive (true);
|
||||||
|
configuration_label.set_sensitive (true);
|
||||||
|
mode_label.set_sensitive (true);
|
||||||
|
instrument_label.set_sensitive (true);
|
||||||
|
break;
|
||||||
|
case AudioBus:
|
||||||
mode_combo.set_sensitive (false);
|
mode_combo.set_sensitive (false);
|
||||||
channel_combo.set_sensitive (true);
|
channel_combo.set_sensitive (true);
|
||||||
instrument_combo.set_sensitive (false);
|
instrument_combo.set_sensitive (false);
|
||||||
configuration_label.set_sensitive (true);
|
configuration_label.set_sensitive (true);
|
||||||
mode_label.set_sensitive (true);
|
mode_label.set_sensitive (true);
|
||||||
instrument_label.set_sensitive (false);
|
instrument_label.set_sensitive (false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
maybe_update_name_template_entry ();
|
maybe_update_name_template_entry ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
AddRouteDialog::audio_tracks_wanted ()
|
|
||||||
{
|
|
||||||
return track_bus_combo.get_active_row_number () == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
AddRouteDialog::midi_tracks_wanted ()
|
|
||||||
{
|
|
||||||
return track_bus_combo.get_active_row_number () == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
string
|
string
|
||||||
AddRouteDialog::name_template ()
|
AddRouteDialog::name_template ()
|
||||||
|
|
@ -303,18 +330,42 @@ AddRouteDialog::mode ()
|
||||||
return ARDOUR::Normal;
|
return ARDOUR::Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
ChanCount
|
||||||
AddRouteDialog::channels ()
|
AddRouteDialog::channels ()
|
||||||
{
|
{
|
||||||
string str = channel_combo.get_active_text();
|
ChanCount ret;
|
||||||
|
string str;
|
||||||
for (ChannelSetups::iterator i = channel_setups.begin(); i != channel_setups.end(); ++i) {
|
switch (type_wanted()) {
|
||||||
if (str == (*i).name) {
|
case AudioTrack:
|
||||||
return (*i).channels;
|
case AudioBus:
|
||||||
|
str = channel_combo.get_active_text();
|
||||||
|
for (ChannelSetups::iterator i = channel_setups.begin(); i != channel_setups.end(); ++i) {
|
||||||
|
if (str == (*i).name) {
|
||||||
|
ret.set (DataType::AUDIO, (*i).channels);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
ret.set (DataType::MIDI, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
return 0;
|
case MidiTrack:
|
||||||
|
ret.set (DataType::AUDIO, 0);
|
||||||
|
ret.set (DataType::MIDI, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MixedTrack:
|
||||||
|
str = channel_combo.get_active_text();
|
||||||
|
for (ChannelSetups::iterator i = channel_setups.begin(); i != channel_setups.end(); ++i) {
|
||||||
|
if (str == (*i).name) {
|
||||||
|
ret.set (DataType::AUDIO, (*i).channels);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret.set (DataType::MIDI, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,15 @@ class AddRouteDialog : public ArdourDialog
|
||||||
AddRouteDialog (ARDOUR::Session*);
|
AddRouteDialog (ARDOUR::Session*);
|
||||||
~AddRouteDialog ();
|
~AddRouteDialog ();
|
||||||
|
|
||||||
bool audio_tracks_wanted ();
|
enum TypeWanted {
|
||||||
bool midi_tracks_wanted ();
|
AudioTrack,
|
||||||
int channels ();
|
MidiTrack,
|
||||||
|
MixedTrack,
|
||||||
|
AudioBus
|
||||||
|
};
|
||||||
|
TypeWanted type_wanted() const;
|
||||||
|
|
||||||
|
ARDOUR::ChanCount channels ();
|
||||||
int count ();
|
int count ();
|
||||||
|
|
||||||
std::string name_template ();
|
std::string name_template ();
|
||||||
|
|
|
||||||
|
|
@ -753,7 +753,6 @@ void
|
||||||
ARDOUR_UI::finish()
|
ARDOUR_UI::finish()
|
||||||
{
|
{
|
||||||
if (_session) {
|
if (_session) {
|
||||||
int tries = 0;
|
|
||||||
|
|
||||||
if (_session->dirty()) {
|
if (_session->dirty()) {
|
||||||
vector<string> actions;
|
vector<string> actions;
|
||||||
|
|
@ -1361,7 +1360,8 @@ ARDOUR_UI::open_session ()
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t how_many, const string& name_template, PluginInfoPtr instrument)
|
ARDOUR_UI::session_add_mixed_track (const ChanCount& input, const ChanCount& output, RouteGroup* route_group,
|
||||||
|
uint32_t how_many, const string& name_template, PluginInfoPtr instrument)
|
||||||
{
|
{
|
||||||
list<boost::shared_ptr<MidiTrack> > tracks;
|
list<boost::shared_ptr<MidiTrack> > tracks;
|
||||||
|
|
||||||
|
|
@ -1371,18 +1371,14 @@ ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (disk) {
|
tracks = _session->new_midi_track (input, output, instrument, ARDOUR::Normal, route_group, how_many, name_template);
|
||||||
|
|
||||||
tracks = _session->new_midi_track (instrument, ARDOUR::Normal, route_group, how_many, name_template);
|
if (tracks.size() != how_many) {
|
||||||
|
if (how_many == 1) {
|
||||||
if (tracks.size() != how_many) {
|
error << _("could not create a new mixed track") << endmsg;
|
||||||
if (how_many == 1) {
|
} else {
|
||||||
error << _("could not create a new midi track") << endmsg;
|
error << string_compose (_("could not create %1 new mixed tracks"), how_many) << endmsg;
|
||||||
} else {
|
|
||||||
error << string_compose (_("could not create %1 new midi tracks"), how_many) << endmsg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1395,7 +1391,18 @@ restart JACK with more ports."), PROGRAM_NAME));
|
||||||
msg.run ();
|
msg.run ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t how_many, const string& name_template, PluginInfoPtr instrument)
|
||||||
|
{
|
||||||
|
ChanCount one_midi_channel;
|
||||||
|
one_midi_channel.set (DataType::MIDI, 1);
|
||||||
|
|
||||||
|
if (disk) {
|
||||||
|
session_add_mixed_track (one_midi_channel, one_midi_channel, route_group, how_many, name_template, instrument);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ARDOUR_UI::session_add_audio_route (
|
ARDOUR_UI::session_add_audio_route (
|
||||||
|
|
@ -3120,8 +3127,8 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t input_chan = add_route_dialog->channels ();
|
ChanCount input_chan= add_route_dialog->channels ();
|
||||||
uint32_t output_chan;
|
ChanCount output_chan;
|
||||||
string name_template = add_route_dialog->name_template ();
|
string name_template = add_route_dialog->name_template ();
|
||||||
PluginInfoPtr instrument = add_route_dialog->requested_instrument ();
|
PluginInfoPtr instrument = add_route_dialog->requested_instrument ();
|
||||||
RouteGroup* route_group = add_route_dialog->route_group ();
|
RouteGroup* route_group = add_route_dialog->route_group ();
|
||||||
|
|
@ -3129,19 +3136,29 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
|
||||||
AutoConnectOption oac = Config->get_output_auto_connect();
|
AutoConnectOption oac = Config->get_output_auto_connect();
|
||||||
|
|
||||||
if (oac & AutoConnectMaster) {
|
if (oac & AutoConnectMaster) {
|
||||||
output_chan = (_session->master_out() ? _session->master_out()->n_inputs().n_audio() : input_chan);
|
output_chan.set (DataType::AUDIO, (_session->master_out() ? _session->master_out()->n_inputs().n_audio() : input_chan.n_audio()));
|
||||||
|
output_chan.set (DataType::MIDI, 0);
|
||||||
} else {
|
} else {
|
||||||
output_chan = input_chan;
|
output_chan = input_chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cerr << "ARD said " << input_chan << " and " << output_chan << endl;
|
||||||
|
|
||||||
/* XXX do something with name template */
|
/* XXX do something with name template */
|
||||||
|
|
||||||
if (add_route_dialog->midi_tracks_wanted()) {
|
switch (add_route_dialog->type_wanted()) {
|
||||||
|
case AddRouteDialog::AudioTrack:
|
||||||
|
session_add_audio_track (input_chan.n_audio(), output_chan.n_audio(), add_route_dialog->mode(), route_group, count, name_template);
|
||||||
|
break;
|
||||||
|
case AddRouteDialog::MidiTrack:
|
||||||
session_add_midi_track (route_group, count, name_template, instrument);
|
session_add_midi_track (route_group, count, name_template, instrument);
|
||||||
} else if (add_route_dialog->audio_tracks_wanted()) {
|
break;
|
||||||
session_add_audio_track (input_chan, output_chan, add_route_dialog->mode(), route_group, count, name_template);
|
case AddRouteDialog::MixedTrack:
|
||||||
} else {
|
session_add_mixed_track (input_chan, output_chan, route_group, count, name_template, instrument);
|
||||||
session_add_audio_bus (input_chan, output_chan, route_group, count, name_template);
|
break;
|
||||||
|
case AddRouteDialog::AudioBus:
|
||||||
|
session_add_audio_bus (input_chan.n_audio(), output_chan.n_audio(), route_group, count, name_template);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||||
session_add_midi_route (true, route_group, how_many, name_template, instrument);
|
session_add_midi_route (true, route_group, how_many, name_template, instrument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void session_add_mixed_track (const ARDOUR::ChanCount& input, const ARDOUR::ChanCount& output, ARDOUR::RouteGroup* route_group, uint32_t how_many, std::string const & name_template,
|
||||||
|
ARDOUR::PluginInfoPtr instrument);
|
||||||
|
|
||||||
/*void session_add_midi_bus () {
|
/*void session_add_midi_bus () {
|
||||||
session_add_midi_route (false);
|
session_add_midi_route (false);
|
||||||
}*/
|
}*/
|
||||||
|
|
|
||||||
|
|
@ -934,7 +934,10 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t
|
||||||
|
|
||||||
existing_track = at.front();
|
existing_track = at.front();
|
||||||
} else if (mr) {
|
} else if (mr) {
|
||||||
list<boost::shared_ptr<MidiTrack> > mt (_session->new_midi_track (boost::shared_ptr<PluginInfo>(), Normal, 0, 1));
|
list<boost::shared_ptr<MidiTrack> > mt (_session->new_midi_track (ChanCount (DataType::MIDI, 1),
|
||||||
|
ChanCount (DataType::MIDI, 1),
|
||||||
|
boost::shared_ptr<PluginInfo>(),
|
||||||
|
Normal, 0, 1));
|
||||||
|
|
||||||
if (mt.empty()) {
|
if (mt.empty()) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -454,6 +454,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
||||||
);
|
);
|
||||||
|
|
||||||
std::list<boost::shared_ptr<MidiTrack> > new_midi_track (
|
std::list<boost::shared_ptr<MidiTrack> > new_midi_track (
|
||||||
|
const ChanCount& input, const ChanCount& output,
|
||||||
boost::shared_ptr<PluginInfo> instrument = boost::shared_ptr<PluginInfo>(),
|
boost::shared_ptr<PluginInfo> instrument = boost::shared_ptr<PluginInfo>(),
|
||||||
TrackMode mode = Normal,
|
TrackMode mode = Normal,
|
||||||
RouteGroup* route_group = 0, uint32_t how_many = 1, std::string name_template = ""
|
RouteGroup* route_group = 0, uint32_t how_many = 1, std::string name_template = ""
|
||||||
|
|
|
||||||
|
|
@ -1595,7 +1595,8 @@ Session::count_existing_track_channels (ChanCount& in, ChanCount& out)
|
||||||
* @param instrument plugin info for the instrument to insert pre-fader, if any
|
* @param instrument plugin info for the instrument to insert pre-fader, if any
|
||||||
*/
|
*/
|
||||||
list<boost::shared_ptr<MidiTrack> >
|
list<boost::shared_ptr<MidiTrack> >
|
||||||
Session::new_midi_track (boost::shared_ptr<PluginInfo> instrument, TrackMode mode, RouteGroup* route_group, uint32_t how_many, string name_template)
|
Session::new_midi_track (const ChanCount& input, const ChanCount& output, boost::shared_ptr<PluginInfo> instrument,
|
||||||
|
TrackMode mode, RouteGroup* route_group, uint32_t how_many, string name_template)
|
||||||
{
|
{
|
||||||
char track_name[32];
|
char track_name[32];
|
||||||
uint32_t track_id = 0;
|
uint32_t track_id = 0;
|
||||||
|
|
@ -1604,6 +1605,8 @@ Session::new_midi_track (boost::shared_ptr<PluginInfo> instrument, TrackMode mod
|
||||||
list<boost::shared_ptr<MidiTrack> > ret;
|
list<boost::shared_ptr<MidiTrack> > ret;
|
||||||
uint32_t control_id;
|
uint32_t control_id;
|
||||||
|
|
||||||
|
cerr << "Adding MIDI track with in = " << input << " out = " << output << endl;
|
||||||
|
|
||||||
control_id = next_control_id ();
|
control_id = next_control_id ();
|
||||||
|
|
||||||
bool const use_number = (how_many != 1) || name_template.empty () || name_template == _("MIDI");
|
bool const use_number = (how_many != 1) || name_template.empty () || name_template == _("MIDI");
|
||||||
|
|
@ -1630,13 +1633,13 @@ Session::new_midi_track (boost::shared_ptr<PluginInfo> instrument, TrackMode mod
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
|
Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
|
||||||
if (track->input()->ensure_io (ChanCount(DataType::MIDI, 1), false, this)) {
|
if (track->input()->ensure_io (input, false, this)) {
|
||||||
error << "cannot configure 1 in/1 out configuration for new midi track" << endmsg;
|
error << "cannot configure " << input << " out configuration for new midi track" << endmsg;
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track->output()->ensure_io (ChanCount(DataType::MIDI, 1), false, this)) {
|
if (track->output()->ensure_io (output, false, this)) {
|
||||||
error << "cannot configure 1 in/1 out configuration for new midi track" << endmsg;
|
error << "cannot configure " << output << " out configuration for new midi track" << endmsg;
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue