fixes for MIDI port setup; options editor now sets trace options correctly (still not saved); MTC now sent immediately after asking for it, not after first stop; add svn_revision.h to avoid compile errors

git-svn-id: svn://localhost/ardour2/trunk@1138 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2006-11-17 16:14:44 +00:00
parent 98d93c221a
commit 5f37d76935
10 changed files with 87 additions and 75 deletions

View File

@ -269,7 +269,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt
Gtk::Requisition requisition;
scrollbar.size_request (requisition);
scrollbar_height = requisition.height;
cerr << "scrollbar height = " << scrollbar_height << endl;
}
EventBox* spacer = manage (new EventBox);

View File

@ -322,8 +322,6 @@ OptionEditor::destructo_xfade_adjustment_changed ()
Config->set_destructive_xfade_msecs ((uint32_t) floor (val));
cerr << "set destructo fade to " << Config->get_destructive_xfade_msecs () << endl;
if (session) {
SndFileSource::setup_standard_crossfades (session->frame_rate());
}
@ -423,19 +421,19 @@ OptionEditor::setup_midi_options ()
}
tb->set_active (!(*i).second->input()->offline());
tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
(*i).second->input()->OfflineStatusChanged.connect (bind (mem_fun(*this, &OptionEditor::map_port_online), (*i).second, tb));
table->attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL);
tb = manage (new ToggleButton ());
tb->set_name ("OptionEditorToggleButton");
tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
tb->set_size_request (10, 10);
table->attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL);
tb = manage (new ToggleButton ());
tb->set_name ("OptionEditorToggleButton");
tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
tb->set_size_request (10, 10);
table->attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL);
@ -547,15 +545,14 @@ OptionEditor::midi_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb)
}
}
gint
OptionEditor::port_online_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
void
OptionEditor::port_online_toggled (MIDI::Port* port, ToggleButton* tb)
{
bool wanted = tb->get_active(); /* it hasn't changed at this point */
bool wanted = tb->get_active();
if (wanted != port->input()->offline()) {
port->input()->set_offline (wanted);
}
return stop_signal (*tb, "button_press_event");
}
void
@ -570,24 +567,24 @@ OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb)
}
}
gint
OptionEditor::port_trace_in_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
void
OptionEditor::port_trace_in_toggled (MIDI::Port* port, ToggleButton* tb)
{
/* XXX not very good MVC style here */
bool trace = tb->get_active();
port->input()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" input: "));
tb->set_active (!tb->get_active());
return stop_signal (*tb, "button_press_event");
if (port->input()->tracing() != trace) {
port->output()->trace (trace, &cerr, string (port->name()) + string (" input: "));
}
}
gint
OptionEditor::port_trace_out_toggled (GdkEventButton* ev,MIDI::Port* port, ToggleButton* tb)
void
OptionEditor::port_trace_out_toggled (MIDI::Port* port, ToggleButton* tb)
{
/* XXX not very good MVC style here */
bool trace = tb->get_active();
port->output()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" output: "));
tb->set_active (!tb->get_active());
return stop_signal (*tb, "button_press_event");
if (port->output()->tracing() != trace) {
port->output()->trace (trace, &cerr, string (port->name()) + string (" output: "));
}
}
void

View File

@ -116,9 +116,9 @@ class OptionEditor : public Gtk::Dialog
Gtk::RadioButton::Group mmc_button_group;
Gtk::RadioButton::Group midi_button_group;
gint port_online_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
gint port_trace_in_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
gint port_trace_out_toggled (GdkEventButton*,MIDI::Port*,Gtk::ToggleButton*);
void port_online_toggled (MIDI::Port*,Gtk::ToggleButton*);
void port_trace_in_toggled (MIDI::Port*,Gtk::ToggleButton*);
void port_trace_out_toggled (MIDI::Port*,Gtk::ToggleButton*);
void mmc_port_chosen (MIDI::Port*,Gtk::RadioButton*);
void mtc_port_chosen (MIDI::Port*,Gtk::RadioButton*);

View File

@ -127,6 +127,8 @@ setup_midi ()
}
MIDI::Manager::instance()->add_port (request);
nports++;
}
if (nports > 1) {

View File

@ -3026,6 +3026,10 @@ Session::config_changed (const char* parameter_name)
if (_mtc_port != 0) {
session_send_mtc = Config->get_send_mtc();
if (session_send_mtc) {
/* mark us ready to send */
next_quarter_frame_to_send = 0;
}
}
} else if (PARAM_IS ("send-mmc")) {

View File

@ -372,9 +372,6 @@ Session::non_realtime_stop (bool abort)
}
}
}
deliver_mmc (MIDI::MachineControl::cmdLocate, _transport_frame);
#ifdef LEAVE_TRANSPORT_UNADJUSTED
}
#endif

View File

@ -30,9 +30,8 @@ namespace MIDI {
class PortFactory {
public:
Port *create_port (PortRequest &req);
static void add_port_request (std::vector<PortRequest *> &reqs,
const std::string &reqstr);
static bool ignore_duplicate_devices (Port::Type);
};
} // namespace MIDI

View File

@ -76,20 +76,28 @@ PortFactory::create_port (PortRequest &req)
return port;
}
void
PortFactory::add_port_request (vector<PortRequest *> &reqs,
const string &str)
bool
PortFactory::ignore_duplicate_devices (Port::Type type)
{
PortRequest *req;
bool ret = false;
req = new PortRequest;
req->devname = strdup (str.c_str());
req->tagname = strdup (str.c_str());
switch (type) {
#ifdef WITH_ALSA
case Port::ALSA_Sequencer:
ret = true;
break;
#endif // WITH_ALSA
req->mode = O_RDWR;
req->type = Port::ALSA_RawMidi;
#if WITH_COREMIDI
case Port::CoreMidi_MidiPort:
ret = true;
break;
#endif // WITH_COREMIDI
reqs.push_back (req);
default:
break;
}
return ret;
}

View File

@ -72,41 +72,43 @@ Manager::add_port (PortRequest &req)
PortMap::iterator existing;
pair<string, Port *> newpair;
if ((existing = ports_by_device.find (req.devname)) !=
ports_by_device.end()) {
port = (*existing).second;
if (port->mode() == req.mode) {
if (!PortFactory::ignore_duplicate_devices (req.type)) {
if ((existing = ports_by_device.find (req.devname)) != ports_by_device.end()) {
/* Same mode - reuse the port, and just
create a new tag entry.
port = (*existing).second;
if (port->mode() == req.mode) {
/* Same mode - reuse the port, and just
create a new tag entry.
*/
newpair.first = req.tagname;
newpair.second = port;
ports_by_tag.insert (newpair);
return port;
}
/* If the existing is duplex, and this request
is not, then fail, because most drivers won't
allow opening twice with duplex and non-duplex
operation.
*/
newpair.first = req.tagname;
newpair.second = port;
ports_by_tag.insert (newpair);
return port;
}
/* If the existing is duplex, and this request
is not, then fail, because most drivers won't
allow opening twice with duplex and non-duplex
operation.
*/
if ((req.mode == O_RDWR && port->mode() != O_RDWR) ||
(req.mode != O_RDWR && port->mode() == O_RDWR)) {
error << "MIDIManager: port tagged \""
<< req.tagname
<< "\" cannot be opened duplex and non-duplex"
<< endmsg;
return 0;
}
/* modes must be different or complementary */
}
if ((req.mode == O_RDWR && port->mode() != O_RDWR) ||
(req.mode != O_RDWR && port->mode() == O_RDWR)) {
error << "MIDIManager: port tagged \""
<< req.tagname
<< "\" cannot be opened duplex and non-duplex"
<< endmsg;
return 0;
}
/* modes must be different or complementary */
}
}
port = factory.create_port (req);

4
svn_revision.h Normal file
View File

@ -0,0 +1,4 @@
#ifndef __ardour_svn_revision_h__
#define __ardour_svn_revision_h__
static const char* ardour_svn_revision = "1137";
#endif