13
0

websockets provide BBT

This commit is contained in:
Remi Thebault 2022-01-09 22:19:20 +01:00 committed by Robin Gareus
parent c9a1dfb928
commit 93987de09f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
5 changed files with 24 additions and 5 deletions

View File

@ -130,6 +130,7 @@ WebsocketsDispatcher::update_all_nodes (Client client)
update (client, Node::transport_tempo, transport ().tempo ());
update (client, Node::transport_time, transport ().time ());
update (client, Node::transport_bbt, transport ().bbt ());
update (client, Node::transport_roll, transport ().roll ());
update (client, Node::transport_record, transport ().record ());
}

View File

@ -210,6 +210,7 @@ bool
ArdourFeedback::poll () const
{
update_all (Node::transport_time, transport ().time ());
update_all (Node::transport_bbt, transport ().bbt ());
Glib::Threads::Mutex::Lock lock (mixer ().mutex ());

View File

@ -44,6 +44,7 @@ namespace Node
const std::string strip_plugin_param_value = "strip_plugin_param_value";
const std::string transport_tempo = "transport_tempo";
const std::string transport_time = "transport_time";
const std::string transport_bbt = "transport_bbt";
const std::string transport_roll = "transport_roll";
const std::string transport_record = "transport_record";
} // namespace Node

View File

@ -16,6 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <sstream>
#include "ardour/tempo.h"
#include "transport.h"
@ -52,6 +54,16 @@ ArdourTransport::time () const
return static_cast<double>(t) / static_cast<double>(f);
}
std::string
ArdourTransport::bbt () const
{
const samplepos_t t = session ().transport_sample ();
const Temporal::BBT_Time bbt_time = Temporal::TempoMap::fetch()->bbt_at (timepos_t (t));
std::ostringstream oss;
bbt_time.print_padded(oss);
return oss.str();
}
bool
ArdourTransport::roll () const
{

View File

@ -19,6 +19,8 @@
#ifndef _ardour_surface_websockets_transport_h_
#define _ardour_surface_websockets_transport_h_
#include <string>
#include "component.h"
namespace ArdourSurface {
@ -35,6 +37,8 @@ public:
double time () const;
std::string bbt () const;
bool roll () const;
void set_roll (bool);