kopia lustrzana https://github.com/sh123/codec2_talkie
rodzic
638d9a4425
commit
4231791caf
|
@ -80,7 +80,7 @@ public class AudioTools {
|
||||||
|
|
||||||
// use freedv mode text instead if it is active
|
// use freedv mode text instead if it is active
|
||||||
String freedvModeLabel = getFreedvModeAsText(sharedPreferences);
|
String freedvModeLabel = getFreedvModeAsText(sharedPreferences);
|
||||||
if (freedvModeLabel != null) return "DV: " + freedvModeLabel;
|
if (freedvModeLabel != null) return freedvModeLabel;
|
||||||
|
|
||||||
// codec2 speed
|
// codec2 speed
|
||||||
String speedModeInfo = "C2: " + AudioTools.extractCodec2Speed(codec2ModeName);
|
String speedModeInfo = "C2: " + AudioTools.extractCodec2Speed(codec2ModeName);
|
||||||
|
|
|
@ -162,13 +162,7 @@ public class SoundModemFsk implements Transport, Runnable {
|
||||||
// read samples to record audio buffer if there is enough data
|
// read samples to record audio buffer if there is enough data
|
||||||
if (_recordAudioSampleBuffer.position() >= nin) {
|
if (_recordAudioSampleBuffer.position() >= nin) {
|
||||||
_recordAudioSampleBuffer.flip();
|
_recordAudioSampleBuffer.flip();
|
||||||
try {
|
_recordAudioSampleBuffer.get(_recordAudioBuffer, 0, nin);
|
||||||
_recordAudioSampleBuffer.get(_recordAudioBuffer, 0, nin);
|
|
||||||
} catch (BufferUnderflowException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
_recordAudioSampleBuffer.clear();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_recordAudioSampleBuffer.compact();
|
_recordAudioSampleBuffer.compact();
|
||||||
//Log.i(TAG, "read " + _recordAudioBuffer.position() + " " +audioSamples.length + " " + DebugTools.shortsToHex(audioSamples));
|
//Log.i(TAG, "read " + _recordAudioBuffer.position() + " " +audioSamples.length + " " + DebugTools.shortsToHex(audioSamples));
|
||||||
// otherwise return void to the user
|
// otherwise return void to the user
|
||||||
|
@ -240,12 +234,14 @@ public class SoundModemFsk implements Transport, Runnable {
|
||||||
byte [] bitBufferTail = Arrays.copyOf(_playbackBitBuffer, j);
|
byte [] bitBufferTail = Arrays.copyOf(_playbackBitBuffer, j);
|
||||||
Codec2.fskModulate(_fskModem, _playbackAudioBuffer, bitBufferTail);
|
Codec2.fskModulate(_fskModem, _playbackAudioBuffer, bitBufferTail);
|
||||||
if (_isLoopback) {
|
if (_isLoopback) {
|
||||||
for (short sample : _playbackAudioBuffer) {
|
synchronized (_recordAudioSampleBuffer) {
|
||||||
try {
|
for (short sample : _playbackAudioBuffer) {
|
||||||
_recordAudioSampleBuffer.put(sample);
|
try {
|
||||||
} catch (BufferOverflowException e) {
|
_recordAudioSampleBuffer.put(sample);
|
||||||
// client is transmitting and cannot consume the buffer, just discard
|
} catch (BufferOverflowException e) {
|
||||||
_recordAudioSampleBuffer.clear();
|
// client is transmitting and cannot consume the buffer, just discard
|
||||||
|
_recordAudioSampleBuffer.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -289,7 +285,7 @@ public class SoundModemFsk implements Transport, Runnable {
|
||||||
Log.w(TAG, "" + readCnt + " != " + readSize);
|
Log.w(TAG, "" + readCnt + " != " + readSize);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
synchronized (_recordAudioBuffer) {
|
synchronized (_recordAudioSampleBuffer) {
|
||||||
for (short sample : sampleBuf) {
|
for (short sample : sampleBuf) {
|
||||||
try {
|
try {
|
||||||
_recordAudioSampleBuffer.put(sample);
|
_recordAudioSampleBuffer.put(sample);
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
<string name="main_status_loopback_test">Loopback</string>
|
<string name="main_status_loopback_test">Loopback</string>
|
||||||
<string name="main_status_stop">STOPPED</string>
|
<string name="main_status_stop">STOPPED</string>
|
||||||
<string name="main_status_tx">TRANSMITTING</string>
|
<string name="main_status_tx">TRANSMITTING</string>
|
||||||
<string name="main_status_rx">RECEIVING</string>
|
<string name="main_status_rx">(RECEIVING)</string>
|
||||||
<string name="main_status_voice_received">(RECEIVING)</string>
|
<string name="main_status_voice_received">RECEIVING</string>
|
||||||
<string name="main_status_rx_error">RECEIVING\nERROR</string>
|
<string name="main_status_rx_error">RECEIVING\nERROR</string>
|
||||||
<string name="main_status_tx_error">TRANSMITTING\nERROR</string>
|
<string name="main_status_tx_error">TRANSMITTING\nERROR</string>
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue