adrielcafe / AndroidAudioConverter

Convert audio files inside your Android app easily. Supported formats: AAC, MP3, M4A, WMA, WAV and FLAC.
1.33k stars 254 forks source link

only last file being converted from filelist #6

Open Ankurjain30 opened 7 years ago

Ankurjain30 commented 7 years ago

I called your method to convert files in File[] but only last file passed through method is converted to set extension. Why so? Here is the code used.

final File pathname = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/sdcard/test"); // System.out.println(pathname);

    File files[] = pathname.listFiles();
    for (File s : files) {
        if (s.getAbsolutePath().endsWith(".wav")) {
            System.out.println(s);
            IConvertCallback callback = new IConvertCallback() {

                @Override
                public void onSuccess(File convertedFile) {

                }

                @Override
                public void onFailure(Exception error) {

                }
            };

            AndroidAudioConverter.with(this)
                    .setFile(s)
                    .setFormat(AudioFormat.MP3)
                    .setCallback(callback)
                    .convert();
sunpan3213 commented 5 years ago

because of single Thread. don't support concurrent