From: fennecdjay Date: Fri, 27 Jan 2023 10:12:24 +0000 (+0100) Subject: :art: Add in, out and samplerate to config X-Git-Tag: nightly~206^2~10 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=16cb57ff4f7e49b5c141915cc451d5ba09c2d420;p=gwion.git :art: Add in, out and samplerate to config --- diff --git a/scripts/embed.bash b/scripts/embed.bash index bf56e91b..0701c385 100644 --- a/scripts/embed.bash +++ b/scripts/embed.bash @@ -119,3 +119,14 @@ echo "}" >> embed/embed_foot 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 + diff --git a/src/soundinfo.c b/src/soundinfo.c index 6fc0472a..cea3bb21 100644 --- a/src/soundinfo.c +++ b/src/soundinfo.c @@ -1,10 +1,23 @@ #include #include +#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; }