Skip to content

Commit

Permalink
lock free manager compiles,
Browse files Browse the repository at this point in the history
and if it compiles it must run, right?
right???
  • Loading branch information
Shaji Khan committed Mar 8, 2024
1 parent 92cbedd commit 39b6036
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions app/src/main/cpp/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Engine::Engine () {
assert(mOutputChannelCount == mInputChannelCount);
// queueManager = new LockFreeQueueManager ();
fileWriter = new FileWriter ();
queueManager.add_function (
reinterpret_cast<int (*)(float *, unsigned long)>(fileWriter->disk_write));
queueManager.add_function (fileWriter->disk_write);
// discoverPlugins();
// loadPlugins();
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/FileWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ int FileWriter::disk_write_callback(float *arg,size_t nframes) {
return 0 ;
}

int FileWriter::disk_write(float *data,size_t frames) {
int FileWriter::disk_write(float *data,int frames) {

/*
LOGD("----------| %d |-----------", std::chrono::system_clock::now()) ;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/FileWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class FileWriter {
public:
FileWriter ();
~FileWriter ();
static int disk_write(float *data, size_t frames);
static int disk_write(float *data, int frames);
int disk_write_callback(float *data, size_t frames);

static void * mp3_buffer ;
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/cpp/LockFreeQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ void LockFreeQueueManager::init (int _buffer_size) {
fileWriteThread = std::thread (&LockFreeQueueManager::main, this);
}

void LockFreeQueueManager::add_function (int (* f) (float *, unsigned long)) {
void LockFreeQueueManager::add_function (int (* f) (float *, int)) {
IN
if (functions_count > MAX_FUNCTIONS) {
HERE LOGE ("already have %d functions added to queue, cannot add any more!", MAX_FUNCTIONS);
return ;
OUT return ;
}

functions [functions_count] = reinterpret_cast<void (*)(float *, int)>(f);
functions_count ++ ;
OUT
}

void LockFreeQueueManager::process (float * data, int samplesToProcess) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/LockFreeQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class LockFreeQueueManager {

public:
void init (int _buffer_size) ;
void add_function(int (*f)(float *, unsigned long));
void add_function(int (*f)(float *, int));
void process (float * data, int samplesToProcess) ;
void main () ;
void quit () ;
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/cpp/Meter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Meter::Meter(JavaVM *pVm) {
vringbuffer_set_receiver_callback(vringbuffer,meter_callback);
vringbuffer_set_receiver_callback(vringbufferOutput,meter_callback_output);

/*
envOutput = getEnv();
if (envOutput == nullptr)
LOGF("envOutput is null");
Expand Down Expand Up @@ -142,6 +143,7 @@ Meter::Meter(JavaVM *pVm) {
if (setMixerMeter == nullptr) {
LOGF("cannot find method!");
}
*/
OUT
}

Expand Down

0 comments on commit 39b6036

Please sign in to comment.