Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
20 
21 #include <stdint.h>
22 
23 #include "pbd/integer_division.h"
24 
25 #include "temporal/visibility.h"
26 
27 #ifdef DEBUG_EARLY_SCTS_USE
28 #include <cstdlib>
29 #include <csignal>
30 #endif
31 
32 namespace Temporal {
33 
34 typedef int64_t superclock_t;
36 
37 #ifdef DEBUG_EARLY_SCTS_USE
40  raise (SIGUSR2);
41  }
43 }
44 #else
46 #endif
47 
49 static inline superclock_t samples_to_superclock (int64_t samples, int sr) { return PBD::muldiv_round (samples, superclock_ticks_per_second(), superclock_t (sr)); }
50 
52 
55 
56 }
57 
58 #define TEMPORAL_SAMPLE_RATE (Temporal::most_recent_engine_sample_rate)
59 
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:48
superclock_t _superclock_ticks_per_second
static superclock_t samples_to_superclock(int64_t samples, int sr)
Definition: superclock.h:49
static superclock_t superclock_ticks_per_second()
Definition: superclock.h:45
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:34
#define LIBTEMPORAL_API