Merge branch 'audiorecorder-1.7.3'

This commit is contained in:
Alexey Kuznetsov 2017-06-16 19:23:26 +03:00
commit 0caebf8466
3 changed files with 15 additions and 13 deletions

View file

@ -8,8 +8,8 @@ android {
applicationId "com.github.axet.audiorecorder"
minSdkVersion 9
targetSdkVersion 23
versionCode 152
versionName "1.7.2"
versionCode 153
versionName "1.7.3"
}
signingConfigs {
release {
@ -43,5 +43,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.github.axet:android-audio-library:0.0.53' // compile project(':android-audio-library')
compile 'com.github.axet:android-audio-library:0.0.54' // compile project(':android-audio-library')
}

View file

@ -256,7 +256,6 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onDestroy() {
super.onDestroy();
recordings.close();
}

View file

@ -182,7 +182,7 @@ public class RecordingActivity extends AppCompatActivity {
sampleRate = Integer.parseInt(shared.getString(MainApplication.PREFERENCE_RATE, ""));
sampleRate = Sound.getValidRecordRate(MainApplication.getInMode(this), sampleRate);
if (sampleRate == -1)
sampleRate = Sound.DEFAULT_RATE;
throw new RuntimeException("Unable to initailze audio");
samplesUpdate = (int) (pitch.getPitchTime() * sampleRate / 1000.0);
updateBufferSize(false);
@ -222,7 +222,8 @@ public class RecordingActivity extends AppCompatActivity {
done.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
done.setClickable(false);
if (encoder != null)
return;
stopRecording(getString(R.string.encoding));
try {
encoding(new Runnable() {
@ -593,14 +594,16 @@ public class RecordingActivity extends AppCompatActivity {
rs.open(samplesTime);
int min = AudioRecord.getMinBufferSize(sampleRate, MainApplication.getInMode(RecordingActivity.this), Sound.DEFAULT_AUDIOFORMAT);
if (min <= 0) {
throw new RuntimeException("Unable to initialize AudioRecord: Bad audio values");
}
recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, MainApplication.getInMode(RecordingActivity.this), Sound.DEFAULT_AUDIOFORMAT, min * 2);
int c = MainApplication.getInMode(RecordingActivity.this);
int min = AudioRecord.getMinBufferSize(sampleRate, c, Sound.DEFAULT_AUDIOFORMAT);
if (min <= 0)
throw new RuntimeException("Unable to initialize AudioRecord: Bad audio values");
recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, c, Sound.DEFAULT_AUDIOFORMAT, min * 2);
if (recorder.getState() != AudioRecord.STATE_INITIALIZED) {
throw new RuntimeException("Unable to initialize AudioRecord");
recorder = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, sampleRate, c, Sound.DEFAULT_AUDIOFORMAT, min * 2);
if (recorder.getState() != AudioRecord.STATE_INITIALIZED)
throw new RuntimeException("Unable to initialize AudioRecord");
}
long start = System.currentTimeMillis();
@ -798,7 +801,7 @@ public class RecordingActivity extends AppCompatActivity {
RecordingService.startService(this, targetFile.getName(), thread != null, encoder != null);
final ProgressDialog d = new ProgressDialog(this);
d.setTitle(getString(R.string.encoding_title));
d.setTitle(R.string.encoding_title);
d.setMessage(".../" + targetFile.getName());
d.setMax(100);
d.setCancelable(false);