13
0

add per-thread sample rate variable and libardour method to update it

This commit is contained in:
Paul Davis 2020-08-05 16:02:19 -06:00
parent 1f0d9159a7
commit f42bd3fe47
4 changed files with 55 additions and 2 deletions

28
libs/ardour/superclock.cc Normal file
View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2020 Paul Davis <paul@linuxaudiosystems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "temporal/superclock.h"
#include "ardour/audioengine.h"
void
update_sample_rate ()
{
Temporal::_thread_sample_rate = ARDOUR::AudioEngine::instance()->sample_rate();
}

View File

@ -251,7 +251,8 @@ libardour_sources = [
'stripable.cc',
'step_sequencer.cc',
'strip_silence.cc',
'system_exec.cc',
'superclock.cc',
'system_exec.cc',
'revision.cc',
'rt_midibuffer.cc',
'template_utils.cc',

View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2020 Paul Davis <paul@linuxaudiosystems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "temporal/superclock.h"
namespace Temporal {
thread_local uint32_t _thread_sample_rate = 0;
}

View File

@ -24,7 +24,7 @@ APPNAME = 'temporal'
VERSION = TEMPORAL_VERSION
I18N_PACKAGE = 'libtemporal'
temporal_sources = [ 'time.cc', 'bbt_time.cc', 'tempo.cc', 'timeline.cc' ]
temporal_sources = [ 'time.cc', 'bbt_time.cc', 'tempo.cc', 'timeline.cc', 'superclock.cc' ]
def options(opt):
autowaf.set_options(opt)