Skip to content

Commit fd6dfae

Browse files
committed
Added warning messages when defining a smaller does not have an effect
1 parent 9ecdd09 commit fd6dfae

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

internal/config_checks_esp32.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_INPUT, MOZZI_AUDIO_INPUT_NONE)
220220
// All modes besides timed external bypass the output buffer!
221221
#if !MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED, MOZZI_OUTPUT_INTERNAL_DAC, MOZZI_OUTPUT_PWM)
222222
# define BYPASS_MOZZI_OUTPUT_BUFFER true
223+
#if (MOZZI_OUTPUT_BUFFER_SIZE != 256)
224+
# warning MOZZI_OUTPUT_BUFFER_SIZE does not have an effect in this mode.
225+
#endif
223226
#endif
224227

225228
#define MOZZI__INTERNAL_ANALOG_READ_RESOLUTION 12

internal/config_checks_esp8266.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_BITS, 16)
114114
// esp. since i2s output already has output rate control -> no need for a
115115
// separate output timer
116116
#define BYPASS_MOZZI_OUTPUT_BUFFER true
117+
#if (MOZZI_OUTPUT_BUFFER_SIZE != 256)
118+
# warning MOZZI_OUTPUT_BUFFER_SIZE does not have an effect in this mode.
119+
#endif
117120
#endif
118121

119122
#define MOZZI__INTERNAL_ANALOG_READ_RESOLUTION 10

internal/config_checks_mbed.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,12 @@ MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_INPUT, MOZZI_AUDIO_INPUT_NONE, MOZZI_AUDIO_INP
117117
# endif
118118
#endif
119119

120-
// All modes besides timed external bypass the output buffer!
120+
// All modes besides timed external bypass the output buffer! In these modes, the buffer size is not configurable at the moment: throw an error if the user tries to change it.
121121
#if !MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED)
122122
# define BYPASS_MOZZI_OUTPUT_BUFFER true
123+
# if (MOZZI_OUTPUT_BUFFER_SIZE != 256) // has been modified
124+
# warning MOZZI_OUTPUT_BUFFER_SIZE does not have an effect in this mode.
125+
# endif
123126
#endif
124127

125128
// TODO: This value is correct for Arduino Giga and Arduino Portenta, but not necessarily everywhere else

internal/config_checks_rp2040.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED, MOZZI_OUTPU
9595
# endif
9696
# define BYPASS_MOZZI_OUTPUT_BUFFER true
9797
# define MOZZI_RP2040_BUFFERS 8 // number of DMA buffers used
98-
# define MOZZI_RP2040_BUFFER_SIZE 256 // total size of the buffer, in samples
98+
# if !defined MOZZI_RP2040_BUFFER_SIZE
99+
# define MOZZI_RP2040_BUFFER_SIZE MOZZI_OUTPUT_BUFFER_SIZE // total size of the buffer, in samples
100+
# if (MOZZI_OUTPUT_BUFFER_SIZE < MOZZI_RP2040_BUFFERS)
101+
# error MOZZI_OUTPUT_BUFFER_SIZE cannot be lower than 8 on this platform at the moment
102+
# endif
103+
# endif
99104
#endif
100105

101106
#if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_I2S_DAC)
@@ -115,7 +120,12 @@ MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED, MOZZI_OUTPU
115120
MOZZI_CHECK_SUPPORTED(MOZZI_I2S_FORMAT, MOZZI_I2S_FORMAT_PLAIN, MOZZI_I2S_FORMAT_LSBJ)
116121
# define BYPASS_MOZZI_OUTPUT_BUFFER true
117122
# define MOZZI_RP2040_BUFFERS 8 // number of DMA buffers used
118-
# define MOZZI_RP2040_BUFFER_SIZE 256 // total size of the buffer, in samples
123+
# if !defined MOZZI_RP2040_BUFFER_SIZE
124+
# define MOZZI_RP2040_BUFFER_SIZE MOZZI_OUTPUT_BUFFER_SIZE // total size of the buffer, in samples
125+
# if (MOZZI_OUTPUT_BUFFER_SIZE < MOZZI_RP2040_BUFFERS)
126+
# error MOZZI_OUTPUT_BUFFER_SIZE cannot be lower than 8 on this platform at the moment
127+
# endif
128+
# endif
119129
#endif
120130

121131
#if !defined(MOZZI_ANALOG_READ)

0 commit comments

Comments
 (0)