Bug fixes, usability improvements

aprs 1.35
sh123 2022-08-12 00:36:09 +03:00
rodzic 638d9a4425
commit 4231791caf
3 zmienionych plików z 13 dodań i 17 usunięć

Wyświetl plik

@ -80,7 +80,7 @@ public class AudioTools {
// use freedv mode text instead if it is active
String freedvModeLabel = getFreedvModeAsText(sharedPreferences);
if (freedvModeLabel != null) return "DV: " + freedvModeLabel;
if (freedvModeLabel != null) return freedvModeLabel;
// codec2 speed
String speedModeInfo = "C2: " + AudioTools.extractCodec2Speed(codec2ModeName);

Wyświetl plik

@ -162,13 +162,7 @@ public class SoundModemFsk implements Transport, Runnable {
// read samples to record audio buffer if there is enough data
if (_recordAudioSampleBuffer.position() >= nin) {
_recordAudioSampleBuffer.flip();
try {
_recordAudioSampleBuffer.get(_recordAudioBuffer, 0, nin);
} catch (BufferUnderflowException e) {
e.printStackTrace();
_recordAudioSampleBuffer.clear();
return 0;
}
_recordAudioSampleBuffer.get(_recordAudioBuffer, 0, nin);
_recordAudioSampleBuffer.compact();
//Log.i(TAG, "read " + _recordAudioBuffer.position() + " " +audioSamples.length + " " + DebugTools.shortsToHex(audioSamples));
// otherwise return void to the user
@ -240,12 +234,14 @@ public class SoundModemFsk implements Transport, Runnable {
byte [] bitBufferTail = Arrays.copyOf(_playbackBitBuffer, j);
Codec2.fskModulate(_fskModem, _playbackAudioBuffer, bitBufferTail);
if (_isLoopback) {
for (short sample : _playbackAudioBuffer) {
try {
_recordAudioSampleBuffer.put(sample);
} catch (BufferOverflowException e) {
// client is transmitting and cannot consume the buffer, just discard
_recordAudioSampleBuffer.clear();
synchronized (_recordAudioSampleBuffer) {
for (short sample : _playbackAudioBuffer) {
try {
_recordAudioSampleBuffer.put(sample);
} catch (BufferOverflowException e) {
// client is transmitting and cannot consume the buffer, just discard
_recordAudioSampleBuffer.clear();
}
}
}
} else {
@ -289,7 +285,7 @@ public class SoundModemFsk implements Transport, Runnable {
Log.w(TAG, "" + readCnt + " != " + readSize);
continue;
}
synchronized (_recordAudioBuffer) {
synchronized (_recordAudioSampleBuffer) {
for (short sample : sampleBuf) {
try {
_recordAudioSampleBuffer.put(sample);

Wyświetl plik

@ -22,8 +22,8 @@
<string name="main_status_loopback_test">Loopback</string>
<string name="main_status_stop">STOPPED</string>
<string name="main_status_tx">TRANSMITTING</string>
<string name="main_status_rx">RECEIVING</string>
<string name="main_status_voice_received">(RECEIVING)</string>
<string name="main_status_rx">(RECEIVING)</string>
<string name="main_status_voice_received">RECEIVING</string>
<string name="main_status_rx_error">RECEIVING\nERROR</string>
<string name="main_status_tx_error">TRANSMITTING\nERROR</string>