summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-04-19 02:11:39 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-04-19 02:11:39 +0000
commit74e6e37d3038cfe45b856d92576b66aca519f43f (patch)
tree71763925dfb3f1ff26516f489a028b83655096e9 /libs
parent099c4c8d064dce9f0517ae3e32d694a19d580d71 (diff)
a) fix editor hscroller to follow PT behaviour - scrollbar always
covers 0...full session + 10% of current zoom page size b) add "big meter" mode to tranzport and fix more bugs with tranzport support git-svn-id: svn://localhost/trunk/ardour2@455 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/control_protocol.cc15
-rw-r--r--libs/ardour/session.cc28
-rw-r--r--libs/surfaces/tranzport/tranzport_control_protocol.cc74
-rw-r--r--libs/surfaces/tranzport/tranzport_control_protocol.h5
5 files changed, 88 insertions, 35 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 201cc48ada..924a482936 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -365,6 +365,7 @@ class Session : public sigc::trackable, public Stateful
int remove_region_from_region_list (Region&);
+ jack_nframes_t get_maximum_extent () const;
jack_nframes_t current_end_frame() const { return end_location->start(); }
jack_nframes_t current_start_frame() const { return start_location->start(); }
jack_nframes_t frame_rate() const { return _current_frame_rate; }
diff --git a/libs/ardour/control_protocol.cc b/libs/ardour/control_protocol.cc
index 2a28921d53..1e4bd8efc9 100644
--- a/libs/ardour/control_protocol.cc
+++ b/libs/ardour/control_protocol.cc
@@ -153,6 +153,8 @@ ControlProtocol::thread_work ()
struct sched_param rtparam;
int err;
+ cerr << _name << " receiver thread running\n";
+
memset (&rtparam, 0, sizeof (rtparam));
rtparam.sched_priority = 3; /* XXX should be relative to audio (JACK) thread */
@@ -238,15 +240,12 @@ ControlProtocol::thread_work ()
continue;
}
- if (send()) {
-
- if (send_route_feedback ()) {
- list<Route*> routes = session.get_routes(); /* copies the routes */
- send_route_feedback (routes);
- }
-
- send_global_feedback ();
+ if (send_route_feedback ()) {
+ list<Route*> routes = session.get_routes(); /* copies the routes */
+ send_route_feedback (routes);
}
+
+ send_global_feedback ();
}
return 0;
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 216517e668..125e0387f3 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -2227,29 +2227,37 @@ Session::route_by_remote_id (uint32_t id)
void
Session::find_current_end ()
{
- jack_nframes_t max = 0;
- jack_nframes_t me;
-
if (_state_of_the_state & Loading) {
return;
}
+ jack_nframes_t max = get_maximum_extent ();
+
+ if (max > end_location->end()) {
+ end_location->set_end (max);
+ set_dirty();
+ DurationChanged(); /* EMIT SIGNAL */
+ }
+}
+
+jack_nframes_t
+Session::get_maximum_extent () const
+{
+ jack_nframes_t max = 0;
+ jack_nframes_t me;
+
/* Don't take the diskstream lock. Caller must have other ways to
ensure atomicity.
*/
- for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
+ for (DiskStreamList::const_iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
Playlist* pl = (*i)->playlist();
if ((me = pl->get_maximum_extent()) > max) {
max = me;
}
}
-
- if (max > end_location->end()) {
- end_location->set_end (max);
- set_dirty();
- DurationChanged(); /* EMIT SIGNAL */
- }
+
+ return max;
}
DiskStream *
diff --git a/libs/surfaces/tranzport/tranzport_control_protocol.cc b/libs/surfaces/tranzport/tranzport_control_protocol.cc
index 34ba54c8b6..6760caac63 100644
--- a/libs/surfaces/tranzport/tranzport_control_protocol.cc
+++ b/libs/surfaces/tranzport/tranzport_control_protocol.cc
@@ -49,8 +49,8 @@ TranzportControlProtocol::TranzportControlProtocol (Session& s)
TranzportControlProtocol::~TranzportControlProtocol ()
{
if (udev) {
- lcd_clear ();
pthread_cancel_one (thread);
+ lcd_clear ();
close ();
}
}
@@ -63,9 +63,7 @@ TranzportControlProtocol::init ()
}
lcd_clear ();
-
- print (0, 0, "Welcome to");
- print (1, 0, "Ardour");
+ lights_off ();
show_wheel_mode();
next_track ();
@@ -77,7 +75,7 @@ TranzportControlProtocol::init ()
/* inbound thread */
- pthread_create_and_store (X_("tranzport monitor"), &thread, 0, _thread_work, this);
+ pthread_create_and_store (X_("tranzport monitor"), &thread, 0, _monitor_work, this);
return 0;
}
@@ -126,8 +124,6 @@ TranzportControlProtocol::send_global_feedback ()
void
TranzportControlProtocol::next_display_mode ()
{
- cerr << "Next display mode\n";
-
switch (display_mode) {
case DisplayNormal:
requested_display_mode = DisplayBigMeter;
@@ -144,6 +140,7 @@ TranzportControlProtocol::enter_big_meter_mode ()
{
lcd_clear ();
lights_off ();
+ last_meter_fill = 0;
display_mode = DisplayBigMeter;
}
@@ -154,6 +151,7 @@ TranzportControlProtocol::enter_normal_display_mode ()
lights_off ();
show_current_track ();
show_wheel_mode ();
+ last_where += 1; /* force time redisplay */
show_transport_time ();
display_mode = DisplayNormal;
}
@@ -199,17 +197,51 @@ TranzportControlProtocol::show_meter ()
float level = current_route->peak_input_power (0);
float fraction = log_meter (level);
- int fill = (int) floor (fraction * 20);
+
+ /* we draw using a choice of a sort of double colon-like character ("::") or a single, left-aligned ":".
+ the screen is 20 chars wide, so we can display 40 different levels. compute the level,
+ then figure out how many "::" to fill. if the answer is odd, make the last one a ":"
+ */
+
+ uint32_t fill = (uint32_t) floor (fraction * 40);
char buf[21];
int i;
+ if (fill == last_meter_fill) {
+ /* nothing to do */
+ return;
+ }
+
+ last_meter_fill = fill;
+
+ bool add_single_level = (fill % 2 != 0);
+ fill /= 2;
+
+ if (fraction > 0.98) {
+ light_on (LightAnysolo);
+ }
+
+ /* add all full steps */
+
for (i = 0; i < fill; ++i) {
- buf[i] = 0x70; /* tranzport special code for 4 quadrant LCD block */
+ buf[i] = 0x07; /* tranzport special code for 4 quadrant LCD block */
}
+
+ /* add a possible half-step */
+
+ if (i < 20 && add_single_level) {
+ buf[i] = 0x03; /* tranzport special code for 2 left quadrant LCD block */
+ ++i;
+ }
+
+ /* fill rest with space */
+
for (; i < 20; ++i) {
buf[i] = ' ';
}
+ /* print() requires this */
+
buf[21] = '\0';
print (0, 0, buf);
@@ -249,13 +281,13 @@ TranzportControlProtocol::show_transport_time ()
}
void*
-TranzportControlProtocol::_thread_work (void* arg)
+TranzportControlProtocol::_monitor_work (void* arg)
{
- return static_cast<TranzportControlProtocol*>(arg)->thread_work ();
+ return static_cast<TranzportControlProtocol*>(arg)->monitor_work ();
}
void*
-TranzportControlProtocol::thread_work ()
+TranzportControlProtocol::monitor_work ()
{
PBD::ThreadCreated (pthread_self(), X_("tranzport monitor"));
@@ -678,8 +710,15 @@ void
TranzportControlProtocol::track_gain_changed (void* ignored)
{
char buf[8];
- snprintf (buf, sizeof (buf), "%.1fdB", coefficient_to_dB (current_route->gain()));
- print (0, 9, buf);
+
+ switch (display_mode) {
+ case DisplayNormal:
+ snprintf (buf, sizeof (buf), "%.1fdB", coefficient_to_dB (current_route->gain()));
+ print (0, 9, buf);
+ break;
+ default:
+ break;
+ }
}
void
@@ -793,6 +832,11 @@ TranzportControlProtocol::button_event_trackmute_release (bool shifted)
void
TranzportControlProtocol::button_event_tracksolo_press (bool shifted)
{
+ if (display_mode == DisplayBigMeter) {
+ light_off (LightAnysolo);
+ return;
+ }
+
if (shifted) {
session.set_all_solo (!session.soloing());
} else {
@@ -1353,7 +1397,7 @@ TranzportControlProtocol::print (int row, int col, const char *text)
/* copy current cell contents into tmp */
memcpy (tmp, &current_screen[row][base_col], 4);
-
+
/* overwrite with new text */
uint32_t tocopy = min ((4U - offset), left);
diff --git a/libs/surfaces/tranzport/tranzport_control_protocol.h b/libs/surfaces/tranzport/tranzport_control_protocol.h
index d460a6c74a..925ac72e2a 100644
--- a/libs/surfaces/tranzport/tranzport_control_protocol.h
+++ b/libs/surfaces/tranzport/tranzport_control_protocol.h
@@ -99,6 +99,7 @@ class TranzportControlProtocol : public ControlProtocol {
int last_wheel_dir;
DisplayMode display_mode;
DisplayMode requested_display_mode;
+ uint32_t last_meter_fill;
std::vector<sigc::connection> track_connections;
@@ -159,8 +160,8 @@ class TranzportControlProtocol : public ControlProtocol {
void step_pan_right ();
void step_pan_left ();
- static void* _thread_work (void* arg);
- void* thread_work ();
+ static void* _monitor_work (void* arg);
+ void* monitor_work ();
void button_event_battery_press (bool shifted);
void button_event_battery_release (bool shifted);