13
0

use Temporal::set_thread_sample_rate() rather than explicit assignment

This commit is contained in:
Paul Davis 2020-11-29 12:50:51 -07:00
parent 62ea0fc24c
commit ae01dafcce
5 changed files with 14 additions and 8 deletions

View File

@ -3117,11 +3117,9 @@ ARDOUR_UI::setup_toplevel_window (Gtk::Window& window, const string& name, void*
void
ARDOUR_UI::event_loop_precall ()
{
std::cout << "ev precall\n";
if (_session) {
Temporal::_thread_sample_rate = _session->sample_rate ();
Temporal::set_thread_sample_rate (_session->sample_rate ());
} else {
Temporal::_thread_sample_rate = 44100;
Temporal::set_thread_sample_rate (44100);
}
}

View File

@ -1142,7 +1142,7 @@ Editor::_import_thread (void *arg)
void *
Editor::import_thread ()
{
Temporal::_thread_sample_rate = _session->sample_rate();
Temporal::set_thread_sample_rate (_session->sample_rate());
Temporal::TempoMap::fetch ();
_session->import_files (import_status);

View File

@ -288,6 +288,10 @@ AudioEngine::process_callback (pframes_t nframes)
thread_init_callback (NULL);
}
#warning NUTEMPO session sample rate or backend sample rate?
Temporal::set_thread_sample_rate (sample_rate());
Temporal::TempoMap::fetch ();
/* This is for JACK, where the latency callback arrives in sync with
* port registration (usually while ardour holds the process-lock
* or with _adding_routes_in_progress or _route_deletion_in_progress set,
@ -1429,7 +1433,7 @@ AudioEngine::thread_init_callback (void* arg)
PBD::notify_event_loops_about_thread_creation (pthread_self(), thread_name, 4096);
AsyncMIDIPort::set_process_thread (pthread_self());
Temporal::_thread_sample_rate = 44100; /* will change later as appropriate */
Temporal::set_thread_sample_rate (44100); /* will change later as appropriate */
Temporal::TempoMap::fetch ();
if (arg) {

View File

@ -23,6 +23,9 @@
#include <cmath>
#include <stdio.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include "pbd/compose.h"
#include "pbd/debug_rt_alloc.h"
#include "pbd/pthread_utils.h"
@ -470,6 +473,7 @@ Graph::helper_thread ()
pt->get_buffers ();
while (!g_atomic_int_get (&_terminate)) {
// printf ("HELPER %s %ld\n", pthread_name(), syscall (SYS_gettid)); fflush (stdout);
setup_thread_local_variables ();
run_one ();
}
@ -535,7 +539,7 @@ again:
void
Graph::setup_thread_local_variables ()
{
Temporal::_thread_sample_rate = _session.sample_rate ();
Temporal::set_thread_sample_rate (_session.sample_rate ());
Temporal::TempoMap::fetch ();
}

View File

@ -72,7 +72,7 @@ using namespace std;
void
Session::setup_thread_local_variables ()
{
Temporal::_thread_sample_rate = sample_rate();
Temporal::set_thread_sample_rate (sample_rate());
}
/** Called by the audio engine when there is work to be done with JACK.