Skip to content

Commit

Permalink
it plucking works
Browse files Browse the repository at this point in the history
i cannot believe it
i really cannot believe it
  • Loading branch information
Shaji Khan committed Mar 21, 2024
1 parent 7fa613f commit bf1c9b8
Show file tree
Hide file tree
Showing 171 changed files with 285 additions and 20,441 deletions.
23 changes: 0 additions & 23 deletions app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ set_target_properties( # Specifies the target library.
${CMAKE_CURRENT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libopus.a )

add_library(libopusenc STATIC IMPORTED)
add_library(libap4 STATIC IMPORTED)

set_target_properties( # Specifies the target library.
libopusenc
Expand All @@ -45,17 +44,7 @@ set_target_properties( # Specifies the target library.
# Provides the path to the library you want to import.
${CMAKE_CURRENT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libopusenc.a )

set_target_properties( # Specifies the target library.
libap4

# Specifies the parameter you want to define.
PROPERTIES IMPORTED_LOCATION

# Provides the path to the library you want to import.
${CMAKE_CURRENT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libap4.a )

add_library(libmp3lame STATIC IMPORTED)
add_library(libfaac STATIC IMPORTED)
set_target_properties( # Specifies the target library.
libmp3lame

Expand All @@ -65,15 +54,6 @@ set_target_properties( # Specifies the target library.
# Provides the path to the library you want to import.
${CMAKE_CURRENT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libmp3lame.a )

set_target_properties( # Specifies the target library.
libfaac

# Specifies the parameter you want to define.
PROPERTIES IMPORTED_LOCATION

# Provides the path to the library you want to import.
${CMAKE_CURRENT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libfaac.a )


add_library( # Sets the name of the library.
amprack
Expand All @@ -96,7 +76,6 @@ add_library( # Sets the name of the library.
Plugin2.cpp
Meter.cpp
LockFreeQueue.cpp
MP4.cpp
)

# Searches for a specified prebuilt library and stores the path as a
Expand All @@ -122,10 +101,8 @@ target_link_libraries( # Specifies the target library.
oboe::oboe
libsndfile
libopusenc
libap4
libopus
libmp3lame
libfaac
mediandk
android
OpenMAXAL
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/cpp/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ bool Engine::setEffectOn(bool isOn) {
meter->lastRecordedFileName = fileWriter->filename;
meter->enable();
meter->start();
meter->faacInit(mSampleRate, bufferSizeInFrames);
meter->faacConfig();
// addPluginToRack(0, 0);
mIsEffectOn = isOn;
}
Expand All @@ -106,7 +104,6 @@ bool Engine::setEffectOn(bool isOn) {
mFullDuplexPass.stop();
closeStreams();
mIsEffectOn = isOn;
meter->faacClose();
}
}

Expand Down
151 changes: 0 additions & 151 deletions app/src/main/cpp/MP4.cpp

This file was deleted.

40 changes: 0 additions & 40 deletions app/src/main/cpp/MP4.h

This file was deleted.

43 changes: 0 additions & 43 deletions app/src/main/cpp/Meter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

#define TUNER_ARRAY_SIZE 4096

MP4 * Meter::mp4 ;

unsigned char * Meter::audioToVideoBytes = NULL ;
faacEncHandle Meter::faacEncHandle = nullptr;
jfloatArray Meter::jfloatArray1 ;
int Meter::jfloatArray1_index = 0 ;
int Meter::jfloatArray1_Size = 0 ;
Expand Down Expand Up @@ -467,43 +464,3 @@ void Meter::process (int nframes, const float * data, bool isInput) {
*/
}

void Meter::faacInit (int sampleRate, unsigned long maxSamples) {
LOGD("[faac] init %d %d", sampleRate, maxSamples);
unsigned long maxBytes = TUNER_ARRAY_SIZE ;
jack_samplerate = sampleRate ;
faacEncHandle = faacEncOpen(
sampleRate,
1,
&maxSamples,
&maxBytes
) ;

if (faacEncHandle == NULL) {
LOGE("[faac] unable to initialize encoder!");
}
}

void Meter::faacClose () {
faacEncClose(faacEncHandle);
}

void Meter::faacConfig () {
faacEncConfigurationPtr config = faacEncGetCurrentConfiguration(faacEncHandle);
config -> bitRate = 160000 ;
config->inputFormat = 4 ; // aaaaahhhhhhhhhhh
faacEncSetConfiguration(faacEncHandle, config);
}

int Meter::faacEncode (float * data, int nframes, unsigned char *outputBuffer,
unsigned int bufferSize) {
int bytesWritten = faacEncEncode(faacEncHandle, (int32_t *) data, nframes, (unsigned char *) outputBuffer, bufferSize) ;
if (bytesWritten < 0) {
LOGE("[faac] error: %d", bytesWritten);
}

// for (int i = 0 ; i < bytesWritten ; i ++)
// LOGD("%c", outputBuffer [i]);
//
// LOGD("[faac] in %d: out: %d", nframes, bytesWritten);
return bytesWritten;
}
12 changes: 0 additions & 12 deletions app/src/main/cpp/Meter.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ extern "C" {
}
#endif
#include "LockFreeQueue.h"
#include "faac.h"
#include "MP4.h"

//#include "FileWriter.h"
JNIEnv* getEnv() ;
Expand Down Expand Up @@ -62,7 +60,6 @@ class Meter {
public:
Meter(JavaVM *pVm);
std::string lastRecordedFileName ;
static MP4 * mp4 ;
static bool tunerEnabled ;
static jmethodID setMixerMeter ;
static jclass mainActivity ;
Expand Down Expand Up @@ -219,17 +216,8 @@ class Meter {
static int jfloatArray1_index;
static jmethodID pushToVideo;
static bool videoRecording;
static faacEncHandle faacEncHandle;

public:
void faacInit(int sampleRate, unsigned long maxSamples);

void faacClose();

void faacConfig();

static int faacEncode(float * data, int nframes, unsigned char *outputBuffer, unsigned int bufferSize);

static unsigned char *audioToVideoBytes;
};

Expand Down
Loading

0 comments on commit bf1c9b8

Please sign in to comment.