Skip to content

Commit 9dd495c

Browse files
committed
Build on GCC: the buffer arrival struct a default argument names is defined outside the pipeline
GCC will not use a nested class's member initialisers before the class around it is complete, so `Arrival arrival = {}` inside InputPipeline did not compile there. audio::BufferArrival is the same two fields at namespace scope, and InputPipeline::Arrival names it.
1 parent f018325 commit 9dd495c

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

‎src/core/audio/input_pipeline.hpp‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@
1515

1616
namespace takt4::audio {
1717

18+
/// When a buffer arrived, for stamping what it carries with when it was heard
19+
/// (`HopProcessor::beginBuffer`): the moment, in nanoseconds on `std::chrono::steady_clock`, and
20+
/// how long before it the buffer's first sample was at the input — the input latency the driver
21+
/// reports. A zero moment is not known — a test feeding audio faster than it plays, or a file —
22+
/// and nothing is said about the buffer. `InputPipeline::Arrival`.
23+
///
24+
/// Out here rather than inside `InputPipeline`, because it is a default argument there: GCC will
25+
/// not use a nested class's member initialisers before the class around it is complete.
26+
struct BufferArrival {
27+
std::int64_t steadyNanos = 0;
28+
double inputLatencySeconds = 0.0;
29+
};
30+
1831
/// The audio-thread half of HANDOFF §4.1's input stage, with no PortAudio in it so it
1932
/// can be driven from a test: interleaved device block → ChannelPicker → mono →
2033
/// Resampler → 22050 Hz → HopAccumulator → HopProcessor, one hop at a time.
@@ -32,15 +45,8 @@ class InputPipeline {
3245
InputPipeline(const InputPipeline&) = delete;
3346
InputPipeline& operator=(const InputPipeline&) = delete;
3447

35-
/// When a buffer arrived, for stamping what it carries with when it was heard
36-
/// (`HopProcessor::beginBuffer`): the moment, in nanoseconds on `std::chrono::steady_clock`,
37-
/// and how long before it the buffer's first sample was at the input — the input latency the
38-
/// driver reports. A zero moment is not known — a test feeding audio faster than it plays,
39-
/// or a file — and nothing is said about the buffer.
40-
struct Arrival {
41-
std::int64_t steadyNanos = 0;
42-
double inputLatencySeconds = 0.0;
43-
};
48+
/// See `BufferArrival`.
49+
using Arrival = BufferArrival;
4450

4551
/// Real-time. `interleaved` holds `frames` frames of picker().streamChannelCount()
4652
/// channels at the input rate, which arrived as `arrival` says.

0 commit comments

Comments
 (0)