Skip to content

Commit

Permalink
nam and aida-x plugins only load .nam, .json and .zip
Browse files Browse the repository at this point in the history
looper and ir only load audio files
dont crash nam and aida-x if anything else other than json loaded
save selected model info with presets
save ir user loaded file
save looper loop
  • Loading branch information
Shaji Khan committed May 21, 2024
1 parent 49c4cf6 commit ecd9b1c
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions app/src/main/java/com/shajikhan/ladspa/amprack/DataAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -644,20 +644,22 @@ public boolean onTouch(View v, MotionEvent event) {
Button fileChooser = null;
if (pluginName.equals("AIDA-X") || pluginName .equals( "Looper") || pluginName.equals("Neural Amp Modeler") || pluginName.equals("TAP IR")|| pluginName.equals("SWH Impulse convolver")) {
if (audioFiles.containsKey(position) && pluginName.equals("Looper") || pluginName.equals("SWH Impulse convolver")) {
String audioFile = audioFiles.get(position);
AudioDecoder audioDecoder = new AudioDecoder(mainActivity);
int samplerate = AudioEngine.getSampleRate() ;
if (samplerate < 44100 /*aaaaaaaarghhh*/)
samplerate = 48000 ;
float [] samples = new float[0];
try {
samples = audioDecoder.decode(Uri.parse(audioFile), null, samplerate);
} catch (IOException e) {
throw new RuntimeException(e);
}
holder.audioFile = audioFiles.get(position);
if (holder.audioFile != null) {
AudioDecoder audioDecoder = new AudioDecoder(mainActivity);
int samplerate = AudioEngine.getSampleRate();
if (samplerate < 44100 /*aaaaaaaarghhh*/)
samplerate = 48000;
float[] samples = new float[0];
try {
samples = audioDecoder.decode(Uri.parse(holder.audioFile), null, samplerate);
} catch (IOException e) {
throw new RuntimeException(e);
}

if (samples != null)
AudioEngine.setPluginBuffer(samples, position);
if (samples != null)
AudioEngine.setPluginBuffer(samples, position);
}

audioFiles.remove(position);
}
Expand Down

0 comments on commit ecd9b1c

Please sign in to comment.