M meson.build => meson.build +14 -4
@@ 1,17 1,27 @@
project('alsa_rnnoise', 'c')
+rnnoise = dependency('rnnoise')
+alsa = dependency('alsa')
+
pdir = get_option('plugin_dir')
if pdir == ''
pdir = get_option('prefix') / get_option('libdir') / 'alsa-lib'
endif
+cc = meson.get_compiler('c')
+has_frame_func = cc.has_function('rnnoise_get_frame_size',
+ prefix: '#include <rnnoise.h>',
+ dependencies: rnnoise)
+
+if not has_frame_func
+ add_project_arguments('-DNO_RNNOISE_GET_FRAME_SIZE', language: 'c')
+endif
+
summary({
- 'plugin directory': pdir
+ 'plugin directory': pdir,
+ 'rnnoise_get_frame_size() detected?': has_frame_func
}, section: 'build configuration')
-rnnoise = dependency('rnnoise')
-alsa = dependency('alsa')
-
shared_library('asound_module_pcm_rnnoise',
'src/main.c',
dependencies: [rnnoise, alsa],
M src/main.c => src/main.c +7 -0
@@ 17,6 17,13 @@
#include <alsa/pcm_external.h>
#include <rnnoise.h>
+#ifdef DNO_RNNOISE_GET_FRAME_SIZE
+/* backwards compat with older rnnoise revisions */
+static inline int rnnoise_get_frame_size() {
+ return 480;
+}
+#endif
+
typedef struct {
snd_pcm_extplug_t ext;
DenoiseState *rnnoise;