From e80dac10f1bfaf5ccc8000b46ec77d7d9e9c6868 Mon Sep 17 00:00:00 2001 From: Shaji Khan Date: Mon, 26 Aug 2024 14:39:17 +0530 Subject: [PATCH] minor --- app/src/main/cpp/FileWriter.cpp | 10 ++++++++-- app/src/main/cpp/Plugin.cpp | 2 ++ app/src/main/cpp/Plugin.h | 2 ++ app/src/main/cpp/atomic.h | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/FileWriter.cpp b/app/src/main/cpp/FileWriter.cpp index 4eb07d2b..854427f4 100644 --- a/app/src/main/cpp/FileWriter.cpp +++ b/app/src/main/cpp/FileWriter.cpp @@ -182,6 +182,7 @@ void FileWriter::setChannels (int channels) { void FileWriter::closeFile () { IN if (fileType == MP3) { + LOGD ("[mp3] free buffer\n"); unsigned char *mp3buf ; mp3buf = (unsigned char *) malloc (8192*3); lame_encode_flush(lame, mp3buf, 8192*3); @@ -195,11 +196,14 @@ void FileWriter::closeFile () { } else if (fileType == WAV && outputFile) { + LOGD ("[wav] free buffer\n"); fclose(outputFile); outputFile = NULL; } else if (fileType == OPUS ) { + LOGD ("[opus] free buffer\n"); + if (oggOpusEnc) { ope_encoder_drain(oggOpusEnc); ope_encoder_destroy(oggOpusEnc); @@ -210,6 +214,7 @@ void FileWriter::closeFile () { } if (soundfile) { + LOGD ("[sndfile] free buffer\n"); sf_close(soundfile); soundfile = NULL; } @@ -344,9 +349,10 @@ void FileWriter::stopRecording () { // vringbuffer_stop_callbacks(vringbuffer); ready = false ; closeFile(); + HERE // fileWriteThread.join(); LOGD("recording stopped: %d buffer underruns", total_overruns); - bg_buffer->pos = 0 ; + //~ bg_buffer->pos = 0 ; OUT } @@ -614,4 +620,4 @@ void FileWriter::setLamePreset (int preset) { IN lame_set_preset(lame, preset); OUT -} \ No newline at end of file +} diff --git a/app/src/main/cpp/Plugin.cpp b/app/src/main/cpp/Plugin.cpp index f825e0a3..4a84f606 100644 --- a/app/src/main/cpp/Plugin.cpp +++ b/app/src/main/cpp/Plugin.cpp @@ -343,6 +343,8 @@ void Plugin::setFileName (std::string filename) { float s = filename.size() ; lv2Descriptor->connect_port(handle, 99, (void *) &s); lv2Descriptor->connect_port(handle, 100, (void *) filename.c_str()); + loadedFileName = std::string (filename); + loadedFileType = 1 ; OUT } diff --git a/app/src/main/cpp/Plugin.h b/app/src/main/cpp/Plugin.h index 511043c7..6a86222f 100644 --- a/app/src/main/cpp/Plugin.h +++ b/app/src/main/cpp/Plugin.h @@ -71,6 +71,8 @@ class Plugin { #endif void setFileName(std::string filename); + std::string loadedFileName ; + int loadedFileType = -1 ; void lv2FeaturesInit(); void lv2FeaturesURID(); diff --git a/app/src/main/cpp/atomic.h b/app/src/main/cpp/atomic.h index 9d9af5af..ef82fe8b 100644 --- a/app/src/main/cpp/atomic.h +++ b/app/src/main/cpp/atomic.h @@ -4,7 +4,7 @@ #include #include - +#include #define ATOMIC_NAME(name) \ name##_atomic