Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaji Khan committed Aug 26, 2024
1 parent 75eb6f6 commit e80dac1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions app/src/main/cpp/FileWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -210,6 +214,7 @@ void FileWriter::closeFile () {
}

if (soundfile) {
LOGD ("[sndfile] free buffer\n");
sf_close(soundfile);
soundfile = NULL;
}
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -614,4 +620,4 @@ void FileWriter::setLamePreset (int preset) {
IN
lame_set_preset(lame, preset);
OUT
}
}
2 changes: 2 additions & 0 deletions app/src/main/cpp/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/cpp/Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class Plugin {
#endif

void setFileName(std::string filename);
std::string loadedFileName ;
int loadedFileType = -1 ;

void lv2FeaturesInit();
void lv2FeaturesURID();
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <stdbool.h>
#include <stdint.h>

#include <cstdlib>

#define ATOMIC_NAME(name) \
name##_atomic
Expand Down

0 comments on commit e80dac1

Please sign in to comment.