Consolidate ctrl surface code
This commit is contained in:
@@ -144,19 +144,12 @@ MidiControlUI::reset_ports ()
|
|||||||
void
|
void
|
||||||
MidiControlUI::thread_init ()
|
MidiControlUI::thread_init ()
|
||||||
{
|
{
|
||||||
struct sched_param rtparam;
|
|
||||||
|
|
||||||
pthread_set_name (X_("midiUI"));
|
pthread_set_name (X_("midiUI"));
|
||||||
|
|
||||||
PBD::notify_event_loops_about_thread_creation (pthread_self(), X_("midiUI"), 2048);
|
PBD::notify_event_loops_about_thread_creation (pthread_self(), X_("midiUI"), 2048);
|
||||||
SessionEvent::create_per_thread_pool (X_("midiUI"), 128);
|
SessionEvent::create_per_thread_pool (X_("midiUI"), 128);
|
||||||
|
|
||||||
memset (&rtparam, 0, sizeof (rtparam));
|
set_thread_priority ();
|
||||||
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.
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_ports ();
|
reset_ports ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,19 +268,12 @@ CC121::stop ()
|
|||||||
void
|
void
|
||||||
CC121::thread_init ()
|
CC121::thread_init ()
|
||||||
{
|
{
|
||||||
struct sched_param rtparam;
|
|
||||||
|
|
||||||
pthread_set_name (event_loop_name().c_str());
|
pthread_set_name (event_loop_name().c_str());
|
||||||
|
|
||||||
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
|
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
|
||||||
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
|
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
|
||||||
|
|
||||||
memset (&rtparam, 0, sizeof (rtparam));
|
set_thread_priority ();
|
||||||
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.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -286,19 +286,12 @@ FaderPort::stop ()
|
|||||||
void
|
void
|
||||||
FaderPort::thread_init ()
|
FaderPort::thread_init ()
|
||||||
{
|
{
|
||||||
struct sched_param rtparam;
|
|
||||||
|
|
||||||
pthread_set_name (event_loop_name().c_str());
|
pthread_set_name (event_loop_name().c_str());
|
||||||
|
|
||||||
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
|
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
|
||||||
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
|
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
|
||||||
|
|
||||||
memset (&rtparam, 0, sizeof (rtparam));
|
set_thread_priority ();
|
||||||
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.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -210,19 +210,12 @@ FaderPort8::stop ()
|
|||||||
void
|
void
|
||||||
FaderPort8::thread_init ()
|
FaderPort8::thread_init ()
|
||||||
{
|
{
|
||||||
struct sched_param rtparam;
|
|
||||||
|
|
||||||
pthread_set_name (event_loop_name().c_str());
|
pthread_set_name (event_loop_name().c_str());
|
||||||
|
|
||||||
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
|
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
|
||||||
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
|
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
|
||||||
|
|
||||||
memset (&rtparam, 0, sizeof (rtparam));
|
set_thread_priority ();
|
||||||
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.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -184,19 +184,12 @@ MackieControlProtocol::~MackieControlProtocol()
|
|||||||
void
|
void
|
||||||
MackieControlProtocol::thread_init ()
|
MackieControlProtocol::thread_init ()
|
||||||
{
|
{
|
||||||
struct sched_param rtparam;
|
|
||||||
|
|
||||||
pthread_set_name (event_loop_name().c_str());
|
pthread_set_name (event_loop_name().c_str());
|
||||||
|
|
||||||
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
|
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
|
||||||
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
|
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
|
||||||
|
|
||||||
memset (&rtparam, 0, sizeof (rtparam));
|
set_thread_priority ();
|
||||||
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.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -849,19 +849,12 @@ Push2::handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t pb)
|
|||||||
void
|
void
|
||||||
Push2::thread_init ()
|
Push2::thread_init ()
|
||||||
{
|
{
|
||||||
struct sched_param rtparam;
|
|
||||||
|
|
||||||
pthread_set_name (event_loop_name().c_str());
|
pthread_set_name (event_loop_name().c_str());
|
||||||
|
|
||||||
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
|
PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048);
|
||||||
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
|
ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128);
|
||||||
|
|
||||||
memset (&rtparam, 0, sizeof (rtparam));
|
set_thread_priority ();
|
||||||
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.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -43,16 +43,12 @@ TranzportControlProtocol::~TranzportControlProtocol ()
|
|||||||
|
|
||||||
int TranzportControlProtocol::rtpriority_set(int priority)
|
int TranzportControlProtocol::rtpriority_set(int priority)
|
||||||
{
|
{
|
||||||
struct sched_param rtparam;
|
|
||||||
int err;
|
|
||||||
char *a = (char*) alloca(4096*2); a[0] = 'a'; a[4096] = 'b';
|
char *a = (char*) alloca(4096*2); a[0] = 'a'; a[4096] = 'b';
|
||||||
memset (&rtparam, 0, sizeof (rtparam));
|
|
||||||
rtparam.sched_priority = priority; /* XXX should be relative to audio (JACK) thread */
|
|
||||||
// Note - try SCHED_RR with a low limit
|
// Note - try SCHED_RR with a low limit
|
||||||
// - we don't care if we can't write everything this ms
|
// - we don't care if we can't write everything this ms
|
||||||
// and it will help if we lose the device
|
// and it will help if we lose the device
|
||||||
if ((err = pthread_setschedparam (pthread_self(), SCHED_FIFO, &rtparam)) != 0) {
|
if (set_thread_priority (SCHED_FIFO, priority)) {
|
||||||
PBD::info << string_compose (_("%1: thread not running with realtime scheduling (%2)"), name(), strerror (errno)) << endmsg;
|
PBD::info << string_compose (_("%1: thread not running with realtime scheduling."), name(), strerror (errno)) << endmsg;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user