SpectMorph
smtimeinfo.hh
1 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl-2.1.html
2 
3 #pragma once
4 
5 #include "smutils.hh"
6 
7 namespace SpectMorph
8 {
9 
10 class TimeInfo
11 {
12 public:
13  double time_ms = 0;
14  double ppq_pos = 0;
15 };
16 
18 {
19  double m_tempo = 120;
20  double m_ppq_pos = 0;
21  double m_mix_freq = 0;
22  double m_max_ppq_pos = 0;
23  double m_min_ppq_pos = 0;
24  double m_next_min_ppq_pos = 0;
25  double m_max_time_ms = 0;
26 
27  uint64 m_audio_time_stamp = 0;
28  uint m_position = 0;
29 
30  double samples_to_beats (double samples) const;
31  double samples_to_ms (double samples) const;
32 
33 public:
34  TimeInfoGenerator (double mix_freq);
35 
36  void start_block (uint64 audio_time_stamp, uint n_samples, double ppq_pos, double tempo);
37  void update_time_stamp (uint64 audio_time_stamp);
38 
39  TimeInfo time_info (double offset_ms) const;
40 };
41 
42 }
Definition: smtimeinfo.hh:18
Definition: smtimeinfo.hh:11