cat embed/embed_head embed/embed_body embed/embed_foot > embed/embed.c
rm embed/embed_head embed/embed_body embed/embed_foot
+audio=$(jq -rc '.audio' <<< "$json")
+in=$(jq -rc '.in' <<< "$audio")
+out=$(jq -rc '.out' <<< "$audio")
+samplerate=$(jq -rc '.samplerate' <<< "$audio")
+# check is truthy
+{
+[ "$in" != "null" ] && echo "CFLAGS += -DGWION_DEFAULT_NIN=$in"
+[ "$out" != "null" ] && echo "CFLAGS += -DGWION_DEFAULT_NOUT=$out"
+[ "$samplerate" != "null" ] && echo "CFLAGS += -DGWION_DEFAULT_SAMPLERATE=$samplerate"
+} >> embed/embed.mk
+
#include <gwion_util.h>
#include <soundinfo.h>
+#ifndef GWION_DEFAULT_NIN
+#define GWION_DEFAULT_NIN 2
+#endif
+
+#ifndef GWION_DEFAULT_NOUT
+#define GWION_DEFAULT_NOUT 2
+#endif
+
+#ifndef GWION_DEFAULT_SAMPLERATE
+#define GWION_DEFAULT_SAMPLERATE 48000
+#endif
+
struct SoundInfo_ *new_soundinfo(MemPool p) {
struct SoundInfo_ *si = mp_calloc(p, SoundInfo);
- si->in = si->out = 2;
- si->sr = 48000;
+ si->in = GWION_DEFAULT_NIN;
+ si->out = GWION_DEFAULT_NOUT;
+ si->sr = GWION_DEFAULT_SAMPLERATE;
return si;
}