Skip to content

Commit

Permalink
finally finally
Browse files Browse the repository at this point in the history
finallyyyyyyyyy
impulse response plugin
  • Loading branch information
Shaji Khan committed May 17, 2024
1 parent 81c24cc commit 51bbdd5
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/src/main/assets/all_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
"library": "libhilbert_1440.so"
},
"5500": {
"name": "Nonbandlimited single-sample impulses (Frequency: Control)",
"name": "SWH Impulse convolver",
"id": 1885,
"plugin": 0,
"library": "libimpulse_1885.so"
Expand Down
26 changes: 26 additions & 0 deletions app/src/main/assets/amps.json
Original file line number Diff line number Diff line change
Expand Up @@ -665,5 +665,31 @@
"ON"

]
},
"SWH Impulse convolver": {
"0": [
"Unit impulse (identity) ",
"My flat (light natural reverb) ",
"Yamaha Marshall stack simulator ",
"Fender 68 Vibrolux (SM57 on axis) ",
"Fender 68 Vibrolux (SM57 off axis) ",
"Fender 68 Vibrolux (Audio-technica AT4050) ",
"Fender 68 Vibrolux (Neumann U87) ",
"Fender Bassman (SM57 on axis) ",
"Fender Bassman (SM57 off axis) ",
"Fender Bassman (Audio-technica AT4050) ",
"Fender Bassman (Neumann U87) ",
"Fender Superchamp (SM57 on axis) ",
"Fender Superchamp (SM57 off axis) ",
"Fender Superchamp (Audio-technica AT4050) ",
"Fender Superchamp (Neumann U87) ",
"Marshall JCM2000 (SM57 on axis) ",
"Marshall JCM2000 (SM57 off axis) ",
"Marshall Plexi (SM57 on axis) ",
"Marshall Plexi (SM57 off axis) ",
"Matchless Chieftan (SM57 on axis) ",
"Matchless Chieftan (SM57 off axis) ",
"Custom"
]
}
}
3 changes: 2 additions & 1 deletion app/src/main/assets/blacklist.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@
"1428": 1,
"27400": 1,
"19200": 1,
"33100": 1
"33100": 1,
"33200": 1
}
2 changes: 1 addition & 1 deletion app/src/main/assets/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"Neural Amp Modelling": [
8101
],
"Impulse Response": [8103],
"Impulse Response": [1885],
"Cabinet": [
2592, 2601, 2606, 2589, 15012, 8095, 8018, 24700, 7037, 5006, 5004,
6004,5033,4065,2603,2607,7033,7035,8027,8060,8092,7038,8029
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/cpp/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,15 @@ void Plugin::setBuffer (float * buffer, int read_bytes) {
IN
// dangerous non standard stuff
// dont try this at home
lv2Descriptor->connect_port(handle, 9, & read_bytes);
lv2Descriptor->connect_port(handle, 2, buffer);
if (type == SharedLibrary::LV2) {
LOGD("setting buffer for LV2 plugin") ;
lv2Descriptor->connect_port(handle, 9, &read_bytes);
lv2Descriptor->connect_port(handle, 2, buffer);
} else {
LOGD("setting buffer for LADSPA plugin");
descriptor->connect_port(handle, 99, reinterpret_cast<LADSPA_Data *>(&read_bytes));
descriptor->connect_port(handle, 100, buffer);
}
OUT
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.nio.FloatBuffer;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class AudioDecoder {
MainActivity mainActivity ;
Expand Down Expand Up @@ -72,7 +73,13 @@ float[] decode (FileDescriptor fileDescriptor, String mimeType, int _sampleRate)
ByteBuffer[] codecInputBuffers;
ByteBuffer[] codecOutputBuffers;
extractor = new MediaExtractor();
metadataRetriever.setDataSource(fileDescriptor);
try {
metadataRetriever.setDataSource(fileDescriptor);
} catch (RuntimeException re) {
Log.e(TAG, "decode: ", re);
MainActivity.alert("Unsupported file", re.getMessage());
return null;
}

HashMap <Integer, String> metadata = new HashMap();
int dataKeys [] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public void onClick(View v) {
}
});

if (pluginName.equals("Neural Amp Modeler") || hasFilePort) {
if (pluginName.equals("Neural Amp Modeler")) {
String dir = context.getExternalFilesDir(
Environment.DIRECTORY_DOWNLOADS) + "/" + pluginName + "/";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1699,13 +1699,12 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
*/

int plugin = requestCode - 5000 ;
boolean hasFilePort = AudioEngine.getFilePort(plugin);
Uri returnUri = data.getData();

if (returnUri != null) {
String mimeType = getContentResolver().getType(returnUri);
Log.d(TAG, String.format ("[mimetype]: %s", mimeType));
if (!mimeType.startsWith("audio") || hasFilePort) {
if (!mimeType.startsWith("audio")) {
DocumentFile file = DocumentFile.fromSingleUri(mainActivity, returnUri);
Log.d(TAG, String.format ("ayyo filename: %s", file.getName()));
String path = file.getName();
Expand Down Expand Up @@ -1773,6 +1772,8 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (samplerate < 44100 /*aaaaaaaarghhh*/)
samplerate = 48000 ;
float [] samples = audioDecoder.decode(data.getData(), null, samplerate);
if (samples == null)
return;
AudioEngine.setPluginBuffer(samples, plugin);
Log.d(TAG, String.format ("[decoder]: %d", samples.length));
} catch (IOException e) {
Expand Down
Binary file modified app/src/main/jniLibs/arm64-v8a/libconvoLV2.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/arm64-v8a/libimpulse_1885.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/armeabi-v7a/libconvoLV2.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/armeabi-v7a/libimpulse_1885.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86/libconvoLV2.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86/libimpulse_1885.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86_64/libconvoLV2.so
Binary file not shown.
Binary file modified app/src/main/jniLibs/x86_64/libimpulse_1885.so
Binary file not shown.

0 comments on commit 51bbdd5

Please sign in to comment.