28 FRONT_LEFT_OF_CENTER = 0x40,
29 FRONT_RIGHT_OF_CENTER = 0x80,
34 TOP_FRONT_LEFT = 0x1000,
35 TOP_FRONT_CENTER = 0x2000,
36 TOP_FRONT_RIGHT = 0x4000,
37 TOP_BACK_LEFT = 0x8000,
38 TOP_BACK_CENTER = 0x10000,
39 TOP_BACK_RIGHT = 0x20000,
40 SIDE_SURROUND_50 = STEREO_30 | SIDE_LEFT | SIDE_RIGHT,
54constexpr const int64 MIN_BPM = 10;
55constexpr const int64 MAX_BPM = 1776;
56constexpr const int64 MIN_SAMPLERATE = 8000;
57constexpr const int64 MAX_SAMPLERATE = 192000;
62 static constexpr const int64 offset_ = 0;
65 int32 beat_ticks_ = 0;
69 int64 ticks_per_minute_ = 0;
70 double ticks_per_second_ = 0;
71 double inv_ticks_per_second_ = 0;
72 double ticks_per_sample_ = 0;
73 double sample_per_ticks_ = 0;
87 double ticks_per_sample ()
const {
return ticks_per_sample_; }
90 double bpm ()
const {
return bpm_; }
91 int32 bar_ticks ()
const {
return bar_ticks_; }
92 int32 beat_ticks ()
const {
return beat_ticks_; }
93 int64 start_offset ()
const {
return offset_; }
106 TickSignature (
double bpm,
uint8 beats_per_bar,
uint8 beat_unit);
107 TickSignature (
const TickSignature &other);
108 TickSignature& operator= (
const TickSignature &src);
122 int64 current_tick = 0;
123 __attribute__ ((aligned (64)))
124 double current_tick_d = 0;
131 int64 current_bar_tick = 0;
132 int64 next_bar_tick = 0;
134 void running (
bool r);
135 void tempo (
double newbpm,
uint8 newnumerator,
uint8 newdenominator);
137 void set_tick (
int64 newtick);
139 void advance (
uint nsamples);
140 void update_current ();
142 int64 sample_to_tick (
int64 sample)
const {
return tick_sig.sample_to_tick (sample); }
143 int64 sample_from_tick (
int64 tick)
const {
return tick_sig.sample_from_tick (tick); }
148TickSignature::sample_to_tick (
int64 sample)
const
150 return ticks_per_sample_ *
sample;
154TickSignature::sample_from_tick (
int64 tick)
const
156 return sample_per_ticks_ * tick;
The Anklang C++ API namespace.
int32_t int32
A 32-bit signed integer.
SpeakerArrangement
Flags to indicate channel arrangements of a bus.
@ FRONT_LEFT
Stereo Left (FL)
@ FRONT_RIGHT
Stereo Right (FR)
@ AUX
Flag for side chain uses.
@ LOW_FREQUENCY
Low Frequency Effects (LFE)
uint8_t uint8
An 8-bit unsigned integer.
int8_t int8
An 8-bit signed integer.
int64_t int64
A 64-bit unsigned integer, use PRI*64 in format strings.
constexpr const int64 TRANSPORT_PPQN
Maximum number of sample frames to calculate in Processor::render().
uint32_t uint
Provide 'uint' as convenience type.
Transport information for AudioSignal processing.
int32 current_bar
Bar of current_tick position.
double current_semiquaver
The sixteenth with fraction within beat.
const uint nyquist
Half the samplerate.
const uint samplerate
Sample rate (mixing frequency) in Hz used for rendering.
const double isamplerate
Precalculated 1.0 / samplerate.
double current_seconds
Seconds of current_tick position.
int64 current_frame
Number of sample frames processed since playback start.
int8 current_beat
Beat within bar of current_tick position.
float current_bpm
Running tempo in beats per minute.
int32 current_minutes
Minute of current_tick position.
const double inyquist
Precalculated 1.0 / nyquist.
const SpeakerArrangement speaker_arrangement
Audio output configuration.
Musical time signature and tick conversions.
double seconds
Seconds with fraction after the minute.
Beat beat_from_tick(int64 tick) const
Calculate beat from tick, requires set_signature().
int64 bar_to_tick(int32 bar) const
Calculate tick from bar, requires set_signature().
double bpm_
Current tempo in beats per minute.
void set_samplerate(uint samplerate)
Assign sample rate.
uint8 beats_per_bar_
Upper numeral (numerator), how many beats constitute a bar.
uint8 beat_unit_
Lower numeral (denominator in [1 2 4 8 16]), note value that represents one beat.
double inv_samplerate_
Precalculated 1.0 / samplerate.
int32 minutes
Tick position in minutes.
int32 samplerate_
Sample rate (mixing frequency) in Hz.
int64 time_to_tick(const Time &time) const
Calculate tick from time, requires set_bpm().
int32 bar
Bar of tick position.
int64 beat_to_tick(const Beat &beat) const
Calculate tick from beat, requires set_signature().
double semiquaver
The sixteenth with fraction within beat.
Time time_from_tick(int64 tick) const
Calculate time from tick, requires set_bpm().
bool set_signature(uint8 beats_per_bar, uint8 beat_unit)
Assign time signature and offset for the signature to take effect.
int32 bar_from_tick(int64 tick) const
Calculate bar from tick, requires set_signature().
void set_bpm(double bpm)
Assign tempo in beats per minute.
int8 beat
Beat within bar of tick position.