summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoRo <dos21h@gmail.com>2021-07-23 19:52:29 +0100
committerZoRo <dos21h@gmail.com>2021-07-23 19:52:29 +0100
commitbfd38b1766b323848bfd5896d783fafdbd15a16b (patch)
tree56843f9a21bb6b2e0a158664ce3c64c1b08f4c6a
parent269f63b5d8a71712f587370f1e0c54660e4c55ab (diff)
downloadWasmAudio-bfd38b1766b323848bfd5896d783fafdbd15a16b.tar.gz
WasmAudio-bfd38b1766b323848bfd5896d783fafdbd15a16b.zip
Fixed on Linux
-rw-r--r--Build/Makefile3
-rw-r--r--WasmAudio/main.c10
2 files changed, 7 insertions, 6 deletions
diff --git a/Build/Makefile b/Build/Makefile
index 338fca8..5126c48 100644
--- a/Build/Makefile
+++ b/Build/Makefile
@@ -1,12 +1,13 @@
EMCC=emcc
CC=gcc
SOURCEDIR=../WasmAudio
-LDFLAGS=-lSDL2 -lSDL2_ttf
+LDFLAGS=-lSDL2 -lSDL2_ttf -lm
EM_LDFALGS=-s USE_SDL=2 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s LLD_REPORT_UNDEFINED -s USE_GLFW=3
make:
$(CC) -c $(SOURCEDIR)/../FIR/firmath.c -g3
$(CC) -c $(SOURCEDIR)/main.c -g3
+ $(CC) main.o firmath.o -o WasmAudio $(LDFLAGS)
emcc:
$(EMCC) $(SOURCEDIR)/main.c ../FIR/firmath.c -s WASM=1 -O3 -o index.js $(EM_LDFALGS) -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]'
diff --git a/WasmAudio/main.c b/WasmAudio/main.c
index e3c094b..c8a5191 100644
--- a/WasmAudio/main.c
+++ b/WasmAudio/main.c
@@ -67,9 +67,9 @@ int current_state=0;
int audio_rec_buffer_size=-1;
int audio_rec_buffer_max_size=-1;
static uint8_t audio_rec_buffer_[BUFSIZE];
-const int process_buf_size = BUFSIZE4;
-static double process_buf[process_buf_size+100];
-static double process_buf2[process_buf_size+100];
+#define PROCESS_BUF_SIZE (BUFSIZE4)
+static double process_buf[PROCESS_BUF_SIZE+100];
+static double process_buf2[PROCESS_BUF_SIZE+100];
uint8_t *audio_rec_buffer=NULL;
FILE *f_1,*f_2;
@@ -288,8 +288,8 @@ int main_tick() {
//fir filter apply
#if 1
- fir_filter(&fir_lp, process_buf, process_buf_size, process_buf2, process_buf_size);
- memcpy(process_buf,process_buf2,process_buf_size*sizeof(double));
+ fir_filter(&fir_lp, process_buf, PROCESS_BUF_SIZE, process_buf2, PROCESS_BUF_SIZE);
+ memcpy(process_buf,process_buf2,PROCESS_BUF_SIZE*sizeof(double));
save_to_matlab("B2");
#endif
convert_double_to_f32();