HART  0.2.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
hart_audio_buffer_fill_with.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace hart {
6
7template <typename SampleType>
9{
10 if (getNumChannels() == 0)
11 HART_THROW_OR_RETURN_VOID (hart::ChannelLayoutError, "Can't fill an AudioBuffer with Signal if the buffer is default-constructed or has no channels allocated");
12
13 if (getNumFrames() == 0)
14 HART_THROW_OR_RETURN_VOID (hart::SizeError, "Can't fill an AudioBuffer with Signal if the buffer is default-constructed or has no frames allocated");
15
16 if (! hasSampleRate())
17 HART_THROW_OR_RETURN_VOID (hart::SampleRateError, "Can't fill an AudioBuffer with Signal if the buffer's sample rate is undefined");
18
20 HART_THROW_OR_RETURN_VOID (hart::ChannelLayoutError, "Signal or an effect in its DSP chain doesn't support the number of channels that this buffer has");
21
23 HART_THROW_OR_RETURN_VOID (hart::SampleRateError, "Signal or an effect in its DSP chain doesn't support the sample rate that this buffer has");
24
26
29
32
34 {
35 // Render in one go
37 return;
38 }
39
42
43 while (offsetFrames < getNumFrames())
44 {
47
49 {
50 // Expecting partial block at the end
53
55 }
56
58
61
64
66 }
67}
68
69} // namespace hart
#define HART_THROW_OR_RETURN_VOID(ExceptionType, message)
Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and returns otherwise.
#define hassert(condition)
Triggers a HartAssertException if the condition is false