X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Ftranzport%2Finit.cc;h=56501b2c2cbb8d38e0c878670057bb0f2258595f;hb=e9013c0f99a3f16097800276241e8363fda33e8f;hp=3a01185407e8636feda85cf5ad9cf0de84a5d3ba;hpb=4dc63966f0872efe768dad61eb9b8785d06b92d1;p=ardour.git diff --git a/libs/surfaces/tranzport/init.cc b/libs/surfaces/tranzport/init.cc index 3a01185407..56501b2c2c 100644 --- a/libs/surfaces/tranzport/init.cc +++ b/libs/surfaces/tranzport/init.cc @@ -26,7 +26,7 @@ using namespace std; using namespace sigc; using namespace PBD; -#include "i18n.h" +#include "pbd/i18n.h" #include @@ -43,16 +43,12 @@ TranzportControlProtocol::~TranzportControlProtocol () int TranzportControlProtocol::rtpriority_set(int priority) { - struct sched_param rtparam; - int err; 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 // - we don't care if we can't write everything this ms // and it will help if we lose the device - if ((err = pthread_setschedparam (pthread_self(), SCHED_FIFO, &rtparam)) != 0) { - PBD::info << string_compose (_("%1: thread not running with realtime scheduling (%2)"), name(), strerror (errno)) << endmsg; + if (set_thread_priority (SCHED_FIFO, priority)) { + PBD::info << string_compose (_("%1: thread not running with realtime scheduling."), name(), strerror (errno)) << endmsg; return 1; } return 0; @@ -65,7 +61,7 @@ int TranzportControlProtocol::rtpriority_unset(int priority) struct sched_param rtparam; int err; memset (&rtparam, 0, sizeof (rtparam)); - rtparam.sched_priority = priority; + rtparam.sched_priority = priority; if ((err = pthread_setschedparam (pthread_self(), SCHED_FIFO, &rtparam)) != 0) { PBD::info << string_compose (_("%1: can't stop realtime scheduling (%2)"), name(), strerror (errno)) << endmsg; return 1; @@ -127,7 +123,7 @@ TranzportControlProtocol::TranzportControlProtocol (Session& s) _device_status = STATUS_OFFLINE; udev = 0; current_track_id = 0; - last_where = max_frames; + last_where = max_samples; wheel_mode = WheelTimeline; wheel_shift_mode = WheelShiftGain; wheel_increment = WheelIncrScreen; @@ -208,7 +204,7 @@ TranzportControlProtocol::monitor_work () case 3: val = read(buf,DEFAULT_USB_TIMEOUT*2); break; // Hoo, boy, we're in trouble default: break; // not reached } - + #if DEBUG_TRANZPORT_BITS > 9 if(_device_status != STATUS_OFFLINE && _device_status != STATUS_ONLINE && _device_status != STATUS_OK) { printf("The device has more status bits than off or online: %d\n",_device_status); @@ -265,7 +261,7 @@ TranzportControlProtocol::monitor_work () printf("OFFLINE : %02x %02x %02x %02x %02x %02x %02x %02x\n", buf[0],buf[1],buf[2], buf[3], buf[4], buf[5],buf[6],buf[7]); } - + if(_device_status == STATUS_OK) { printf("OK : %02x %02x %02x %02x %02x %02x %02x %02x\n", buf[0],buf[1],buf[2], buf[3], buf[4], buf[5],buf[6],buf[7]);