Merge branch 'audiorecorder-3.2.59'

This commit is contained in:
Alexey Kuznetsov 2019-03-25 20:55:02 +03:00
commit 2cdf59122e
2 changed files with 15 additions and 9 deletions

View file

@ -8,8 +8,8 @@ android {
applicationId "com.github.axet.audiorecorder"
minSdkVersion 9
targetSdkVersion 26
versionCode 316
versionName "3.2.58"
versionCode 317
versionName "3.2.59"
}
signingConfigs {
release {

View file

@ -705,23 +705,29 @@ public class RecordingActivity extends AppCompatThemeActivity {
void setState(String s) {
long free = 0;
try {
free = Storage.getFree(recording.storage.getTempRecording());
} catch (RuntimeException e) { // IllegalArgumentException
}
final SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
int rate = Integer.parseInt(shared.getString(AudioApplication.PREFERENCE_RATE, ""));
int m = Sound.getChannels(this);
int c = Sound.DEFAULT_AUDIOFORMAT == AudioFormat.ENCODING_PCM_16BIT ? 2 : 1;
long perSec = c * m * rate;
long perSec;
String ext = shared.getString(AudioApplication.PREFERENCE_ENCODING, "");
if (shared.getBoolean(AudioApplication.PREFERENCE_FLY, false))
if (shared.getBoolean(AudioApplication.PREFERENCE_FLY, false)) {
perSec = Factory.getEncoderRate(ext, recording.sampleRate);
try {
free = Storage.getFree(this, recording.targetUri);
} catch (RuntimeException e) { // IllegalArgumentException
}
} else { // raw file on tmp device
perSec = c * m * rate;
try {
free = Storage.getFree(recording.storage.getTempRecording());
} catch (RuntimeException e) { // IllegalArgumentException
}
}
long sec = free / perSec * 1000;