using namespace PBD;
using namespace Glib;
-#include "i18n.h"
+#include "pbd/i18n.h"
MidiControlUI* MidiControlUI::_instance = 0;
}
bool
-MidiControlUI::midi_input_handler (IOCondition ioc, boost::shared_ptr<AsyncMIDIPort> port)
+MidiControlUI::midi_input_handler (IOCondition ioc, boost::weak_ptr<AsyncMIDIPort> wport)
{
+ boost::shared_ptr<AsyncMIDIPort> port = wport.lock ();
+ if (!port) {
+ return false;
+ }
+
DEBUG_TRACE (DEBUG::MidiIO, string_compose ("something happend on %1\n", boost::shared_ptr<ARDOUR::Port> (port)->name()));
if (ioc & ~IO_IN) {
port->clear ();
DEBUG_TRACE (DEBUG::MidiIO, string_compose ("data available on %1\n", boost::shared_ptr<ARDOUR::Port>(port)->name()));
- framepos_t now = _session.engine().sample_time();
+ samplepos_t now = _session.engine().sample_time();
port->parse (now);
}
}
for (vector<boost::shared_ptr<AsyncMIDIPort> >::const_iterator pi = ports.begin(); pi != ports.end(); ++pi) {
- (*pi)->xthread().set_receive_handler (sigc::bind (sigc::mem_fun (this, &MidiControlUI::midi_input_handler), *pi));
+ (*pi)->xthread().set_receive_handler (sigc::bind (
+ sigc::mem_fun (this, &MidiControlUI::midi_input_handler), boost::weak_ptr<AsyncMIDIPort>(*pi)));
(*pi)->xthread().attach (_main_loop->get_context());
}
}
void
MidiControlUI::thread_init ()
{
- struct sched_param rtparam;
-
pthread_set_name (X_("midiUI"));
PBD::notify_event_loops_about_thread_creation (pthread_self(), X_("midiUI"), 2048);
SessionEvent::create_per_thread_pool (X_("midiUI"), 128);
- memset (&rtparam, 0, sizeof (rtparam));
- rtparam.sched_priority = 9; /* XXX should be relative to audio (JACK) thread */
-
- if (pthread_setschedparam (pthread_self(), SCHED_FIFO, &rtparam) != 0) {
- // do we care? not particularly.
- }
+ set_thread_priority ();
reset_ports ();
}