2#ifndef __ASE_TRANSPORT_HH__
3#define __ASE_TRANSPORT_HH__
29 FRONT_LEFT_OF_CENTER = 0x40,
30 FRONT_RIGHT_OF_CENTER = 0x80,
35 TOP_FRONT_LEFT = 0x1000,
36 TOP_FRONT_CENTER = 0x2000,
37 TOP_FRONT_RIGHT = 0x4000,
38 TOP_BACK_LEFT = 0x8000,
39 TOP_BACK_CENTER = 0x10000,
40 TOP_BACK_RIGHT = 0x20000,
41 SIDE_SURROUND_50 = STEREO_30 | SIDE_LEFT | SIDE_RIGHT,
55constexpr const int64 MIN_BPM = 10;
56constexpr const int64 MAX_BPM = 1776;
57constexpr const int64 MIN_SAMPLERATE = 8000;
58constexpr const int64 MAX_SAMPLERATE = 192000;
63 static constexpr const int64 offset_ = 0;
66 int32 beat_ticks_ = 0;
70 int64 ticks_per_minute_ = 0;
71 double ticks_per_second_ = 0;
72 double inv_ticks_per_second_ = 0;
73 double ticks_per_sample_ = 0;
74 double sample_per_ticks_ = 0;
88 double ticks_per_sample ()
const {
return ticks_per_sample_; }
91 double bpm ()
const {
return bpm_; }
92 int32 bar_ticks ()
const {
return bar_ticks_; }
93 int32 beat_ticks ()
const {
return beat_ticks_; }
94 int64 start_offset ()
const {
return offset_; }
107 TickSignature (
double bpm,
uint8 beats_per_bar,
uint8 beat_unit);
108 TickSignature (
const TickSignature &other);
109 TickSignature& operator= (
const TickSignature &src);
123 int64 current_tick = 0;
124 __attribute__ ((aligned (64)))
125 double current_tick_d = 0;
132 int64 current_bar_tick = 0;
133 int64 next_bar_tick = 0;
135 void running (
bool r);
136 void tempo (
double newbpm,
uint8 newnumerator,
uint8 newdenominator);
138 void set_tick (
int64 newtick);
140 void advance (
uint nsamples);
141 void update_current ();
143 int64 sample_to_tick (
int64 sample)
const {
return tick_sig.sample_to_tick (sample); }
144 int64 sample_from_tick (
int64 tick)
const {
return tick_sig.sample_from_tick (tick); }
149TickSignature::sample_to_tick (
int64 sample)
const
151 return ticks_per_sample_ *
sample;
155TickSignature::sample_from_tick (
int64 tick)
const
157 return sample_per_ticks_ * tick;
The Anklang C++ API namespace.
int32_t int32
A 32-bit signed integer.
@ 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.