Ardour  8.7-14-g57a6773833
superclock.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Paul Davis <paul@linuxaudiosystems.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __ardour_superclock_h__
20 #define __ardour_superclock_h__
21 
22 #include <stdint.h>
23 
24 #include "pbd/integer_division.h"
25 
26 #include "temporal/visibility.h"
27 
28 #ifdef DEBUG_EARLY_SCTS_USE
29 #include <cstdlib>
30 #include <csignal>
31 #endif
32 
33 namespace Temporal {
34 
35 typedef int64_t superclock_t;
37 
38 #ifdef DEBUG_EARLY_SCTS_USE
41  raise (SIGUSR2);
42  }
44 }
45 #else
47 #endif
48 
50 static inline superclock_t samples_to_superclock (int64_t samples, int sr) { return PBD::muldiv_round (samples, superclock_ticks_per_second(), superclock_t (sr)); }
51 
53 
56 
57 }
58 
59 #define TEMPORAL_SAMPLE_RATE (Temporal::most_recent_engine_sample_rate)
60 
61 #endif /* __ardour_superclock_h__ */
int64_t muldiv_floor(int64_t v, int64_t n, int64_t d)
int64_t muldiv_round(int64_t v, int64_t n, int64_t d)
static superclock_t superclock_to_samples(superclock_t s, int sr)
Definition: superclock.h:49
superclock_t _superclock_ticks_per_second
static superclock_t samples_to_superclock(int64_t samples, int sr)
Definition: superclock.h:50
static superclock_t superclock_ticks_per_second()
Definition: superclock.h:46
int most_recent_engine_sample_rate
void set_sample_rate(int sr)
void set_superclock_ticks_per_second(superclock_t sc)
int64_t superclock_t
Definition: superclock.h:35
#define LIBTEMPORAL_API