13
0

OSC: Change all time feedback to /position/<type>

This commit is contained in:
Len Ovens 2016-07-01 17:28:08 -07:00
parent 1874aa6acd
commit 55722a74fb
2 changed files with 39 additions and 18 deletions

View File

@ -114,21 +114,6 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
OSCSelectObserver* sel_obs; // So we can sync select feedback with selected channel
Sorted strips; // list of stripables for this surface
};
/*
* Reminder of what strip_types there are
*
AudioTrack = 0x1 = [0]
MidiTrack = 0x2 = [1]
AudioBus = 0x4 = [2]
MidiBus = 0x8 = [3]
VCA = 0x10 = [4]
MasterOut = 0x20 = [5]
MonitorOut = 0x40 = [6]
Auditioner = 0x80 = [7] skip don't look for.
Selected = 0x100 = [8]
Hidden = 0x200 = [9]
OrderSet = 0x400,
*/
/*
* feedback bits:
* [0] - Strips - buttons
@ -141,6 +126,9 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
* [7] - Send metering as dB or positional depending on gainmode
* [8] - Send metering as 16 bits (led strip)
* [9] - Send signal present (signal greater than -20dB)
* [10] - Send Playhead position as samples
* [11] - Send Playhead position as minutes seconds
* [12] - Send Playhead position like primary/secondary GUI clocks
*/

View File

@ -147,12 +147,12 @@ OSCGlobalObserver::tick ()
os << setw(2) << setfill('0') << timecode.minutes;
os << ':';
os << setw(2) << setfill('0') << timecode.seconds;
os << '.';
os << ':';
os << setw(2) << setfill('0') << timecode.frames;
lo_message msg = lo_message_new ();
lo_message_add_string (msg, os.str().c_str());
lo_send_message (addr, "/timecode", msg);
lo_send_message (addr, "/position/smpte", msg);
lo_message_free (msg);
}
if (feedback[5]) { // Bar beat enabled
@ -171,7 +171,40 @@ OSCGlobalObserver::tick ()
lo_message msg = lo_message_new ();
lo_message_add_string (msg, os.str().c_str());
lo_send_message (addr, "/bar_beat", msg);
lo_send_message (addr, "/position/bbt", msg);
lo_message_free (msg);
}
if (feedback[11]) { // minutes/seconds enabled
framepos_t left = now_frame;
int hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
left -= (framecnt_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
int mins = (int) floor (left / (session->frame_rate() * 60.0f));
left -= (framecnt_t) floor (mins * session->frame_rate() * 60.0f);
int secs = (int) floor (left / (float) session->frame_rate());
left -= (framecnt_t) floor ((double)(secs * session->frame_rate()));
int millisecs = floor (left * 1000.0 / (float) session->frame_rate());
// Min/sec mode: Hours/Minutes/Seconds/msec
ostringstream os;
os << setw(2) << setfill('0') << hrs;
os << ':';
os << setw(2) << setfill('0') << mins;
os << ':';
os << setw(2) << setfill('0') << secs;
os << '.';
os << setw(3) << setfill('0') << millisecs;
lo_message msg = lo_message_new ();
lo_message_add_string (msg, os.str().c_str());
lo_send_message (addr, "/position/time", msg);
lo_message_free (msg);
}
if (feedback[10]) { // samples
ostringstream os;
os << now_frame;
lo_message msg = lo_message_new ();
lo_message_add_string (msg, os.str().c_str());
lo_send_message (addr, "/position/samples", msg);
lo_message_free (msg);
}
_last_frame = now_frame;