diff --git a/app/src/main/assets/lv2/liblooper.so/looper.json b/app/src/main/assets/lv2/liblooper.so/looper.json index 071cc715..9ccc4011 100644 --- a/app/src/main/assets/lv2/liblooper.so/looper.json +++ b/app/src/main/assets/lv2/liblooper.so/looper.json @@ -1 +1 @@ -{"-1": {"Plugin": true, "AmplifierPlugin": true, "optionalFeature": "http://lv2plug.in/ns/lv2core#hardRTCapable", "port": "_:n62c4bb580b1c42edb579f4b1e2d6cc04b8", "project": "http://lv2plug.in/ns/lv2", "http://usefulinc.com/ns/doap#license": "http://opensource.org/licenses/isc", "http://usefulinc.com/ns/doap#name": "Looper Plugin", "pluginName": "Looper"}, "0": {"InputPort": true, "ControlPort": true, "default": "0.0", "index": 0, "maximum": 1, "minimum": 0, "name": "Toggle Record", "symbol": "toggle_rec"}, "1": {"InputPort": true, "ControlPort": true, "default": "0.0", "index": 1, "maximum": 1, "minimum": 0, "name": "Toggle Playback", "symbol": "toggle_play"}, "3": {"InputPort": true, "ControlPort": true, "default": "1.0", "index": 3, "maximum": 6, "minimum": 0, "name": "Gain", "symbol": "gain"}, "4": {"InputPort": true, "ControlPort": true, "default": 1024, "index": 4, "maximum": 2048, "minimum": 128, "name": "Buffer Size", "symbol": "buffer_size_control"}, "5": {"InputPort": true, "ControlPort": true, "default": 0, "index": 5, "maximum": 25, "minimum": 0, "step": 0.5, "name": "Start", "symbol": "start"}, "6": {"InputPort": true, "ControlPort": true, "step": 0.5, "default": 100, "index": 6, "maximum": 100, "minimum": 75, "name": "End", "symbol": "end"}, "7": {"AudioPort": true, "InputPort": true, "index": 7, "name": "In", "symbol": "input"}, "8": {"AudioPort": true, "OutputPort": true, "index": 8, "name": "Out", "symbol": "output"}} \ No newline at end of file +{"-1": {"Plugin": true, "AmplifierPlugin": true, "optionalFeature": "http://lv2plug.in/ns/lv2core#hardRTCapable", "port": "_:n62c4bb580b1c42edb579f4b1e2d6cc04b8", "project": "http://lv2plug.in/ns/lv2", "http://usefulinc.com/ns/doap#license": "http://opensource.org/licenses/isc", "http://usefulinc.com/ns/doap#name": "Looper Plugin", "pluginName": "Looper"}, "0": {"InputPort": true, "ControlPort": true, "default": "0.0", "index": 0, "maximum": 1, "minimum": 0, "name": "Toggle Record", "symbol": "toggle_rec"}, "1": {"InputPort": true, "ControlPort": true, "default": "0.0", "index": 1, "maximum": 1, "minimum": 0, "name": "Toggle Playback", "symbol": "toggle_play"}, "3": {"InputPort": true, "ControlPort": true, "default": "1.0", "index": 3, "maximum": 6, "minimum": 0, "name": "Gain", "symbol": "gain"}, "4": {"InputPort": true, "ControlPort": true, "default": 1024, "index": 4, "maximum": 2048, "minimum": 128, "name": "Buffer Size", "symbol": "buffer_size_control"}, "5": {"InputPort": true, "ControlPort": true, "default": 0, "index": 5, "maximum": 25, "minimum": 0, "step": 0.5, "name": "✂ Start", "symbol": "start"}, "6": {"InputPort": true, "ControlPort": true, "step": 0.5, "default": 100, "index": 6, "maximum": 100, "minimum": 75, "name": "✂ End", "symbol": "end"}, "7": {"AudioPort": true, "InputPort": true, "index": 7, "name": "In", "symbol": "input"}, "8": {"AudioPort": true, "OutputPort": true, "index": 8, "name": "Out", "symbol": "output"}} \ No newline at end of file diff --git a/app/src/main/java/com/shajikhan/ladspa/amprack/AudioDecoder.java b/app/src/main/java/com/shajikhan/ladspa/amprack/AudioDecoder.java index d7f51651..f4c43889 100644 --- a/app/src/main/java/com/shajikhan/ladspa/amprack/AudioDecoder.java +++ b/app/src/main/java/com/shajikhan/ladspa/amprack/AudioDecoder.java @@ -96,6 +96,8 @@ float[] decode (FileDescriptor fileDescriptor, String mimeType, int _sampleRate) int channels = format.getInteger(MediaFormat.KEY_CHANNEL_COUNT); String mime = format.getString(MediaFormat.KEY_MIME); Log.d(TAG, String.format ("mimetype: %s", mimeType)); + codec = MediaCodec.createDecoderByType(mime); + /* if (_sampleRate != -1) { codec = MediaCodec.createEncoderByType(mimeType); Log.d(TAG, String.format ("converting to: %s [%d]", mimeType, sampleRate)); @@ -104,9 +106,11 @@ float[] decode (FileDescriptor fileDescriptor, String mimeType, int _sampleRate) Log.d(TAG, String.format ("converting to: %s [%d]", mime, sampleRate)); } + */ + Log.i(TAG, "decode: detected format " + mime); - if (_sampleRate != -1) - format.setInteger(MediaFormat.KEY_SAMPLE_RATE, sampleRate); +// if (_sampleRate != -1) +// format.setInteger(MediaFormat.KEY_SAMPLE_RATE, sampleRate); codec.configure(format, null /* surface */, null /* crypto */, 0 /* flags */); codec.start(); @@ -217,7 +221,7 @@ float[] decode (FileDescriptor fileDescriptor, String mimeType, int _sampleRate) decoded = mono; } - if (sampleRate == 48000) + if (sampleRate == _sampleRate) return decoded; ByteBuffer bb = ByteBuffer.allocateDirect(decoded.length * 4); @@ -227,7 +231,7 @@ float[] decode (FileDescriptor fileDescriptor, String mimeType, int _sampleRate) floatBuffer.position(0); Resampler resampler = new Resampler(true,0.1,30); - boolean result = resampler.process((double)48000.0/sampleRate,floatBuffer,true,resampled); + boolean result = resampler.process((double)_sampleRate/sampleRate,floatBuffer,true,resampled); float [] res = new float[resampled.limit()]; // resampled.position(0); for (int i = 0 ; i < resampled.limit(); i ++) { diff --git a/app/src/main/java/com/shajikhan/ladspa/amprack/MainActivity.java b/app/src/main/java/com/shajikhan/ladspa/amprack/MainActivity.java index 4647ecaa..a67bd600 100644 --- a/app/src/main/java/com/shajikhan/ladspa/amprack/MainActivity.java +++ b/app/src/main/java/com/shajikhan/ladspa/amprack/MainActivity.java @@ -1579,7 +1579,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { } try { - float [] samples = audioDecoder.decode(data.getData(), null, -1); + float [] samples = audioDecoder.decode(data.getData(), null, AudioEngine.getSampleRate()); AudioEngine.setPluginBuffer(samples, plugin); } catch (IOException e) { toast(e.getMessage()); diff --git a/app/src/main/res/drawable/dev.jpg b/app/src/main/res/drawable/dev.jpg new file mode 100644 index 00000000..1aa0d460 Binary files /dev/null and b/app/src/main/res/drawable/dev.jpg differ