kopia lustrzana https://github.com/sh123/codec2_talkie
Settings
rodzic
01fc1e86de
commit
cd15dcf3bc
|
@ -10,6 +10,7 @@ import com.radio.codec2talkie.app.AppWorker;
|
|||
import com.radio.codec2talkie.protocol.message.TextMessage;
|
||||
import com.radio.codec2talkie.protocol.position.Position;
|
||||
import com.radio.codec2talkie.settings.PreferenceKeys;
|
||||
import com.radio.codec2talkie.settings.SettingsWrapper;
|
||||
import com.radio.codec2talkie.tools.AudioTools;
|
||||
import com.radio.codec2talkie.transport.Transport;
|
||||
import com.ustadmobile.codec2.Codec2;
|
||||
|
@ -37,8 +38,7 @@ public class Freedv implements Protocol {
|
|||
_parentProtocolCallback = parentProtocolCallback;
|
||||
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String modemType = sharedPreferences.getString(PreferenceKeys.PORTS_SOUND_MODEM_TYPE, "1200");
|
||||
int mode = Integer.parseInt(modemType.substring(1));
|
||||
int mode = SettingsWrapper.getFreeDvSoundModemModulation(sharedPreferences);
|
||||
Log.i(TAG, "Using freedv mode " + AudioTools.getFreedvModeAsText(sharedPreferences));
|
||||
|
||||
_freedv = Codec2.freedvCreate(mode);
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.util.Log;
|
|||
import com.radio.codec2talkie.protocol.message.TextMessage;
|
||||
import com.radio.codec2talkie.protocol.position.Position;
|
||||
import com.radio.codec2talkie.settings.PreferenceKeys;
|
||||
import com.radio.codec2talkie.settings.SettingsWrapper;
|
||||
import com.radio.codec2talkie.tools.BitTools;
|
||||
import com.radio.codec2talkie.tools.ChecksumTools;
|
||||
import com.radio.codec2talkie.tools.DebugTools;
|
||||
|
@ -35,9 +36,7 @@ public class Hdlc implements Protocol {
|
|||
|
||||
public Hdlc(SharedPreferences sharedPreferences) {
|
||||
double preambleLenSec = Integer.parseInt(sharedPreferences.getString(PreferenceKeys.PORTS_SOUND_MODEM_PREAMBLE, "200")) / 1000.0;
|
||||
String modemType = sharedPreferences.getString(PreferenceKeys.PORTS_SOUND_MODEM_TYPE, "1200");
|
||||
// FIXME if more modulation schemes
|
||||
int modemSpeed = modemType.equals("300") ? 300 : 1200;
|
||||
int modemSpeed = SettingsWrapper.getFskSpeed(sharedPreferences);
|
||||
_prefixSymCount = (int) (preambleLenSec * modemSpeed / 8);
|
||||
|
||||
_rxDataBuffer = new byte[RX_BUFFER_SIZE];
|
||||
|
|
|
@ -48,6 +48,14 @@ public class SettingsWrapper {
|
|||
return -1;
|
||||
}
|
||||
|
||||
public static int getFskSpeed(SharedPreferences sharedPreferences) {
|
||||
String modemType = sharedPreferences.getString(PreferenceKeys.PORTS_SOUND_MODEM_TYPE, "1200");
|
||||
if (!modemType.startsWith("F")) {
|
||||
return Integer.parseInt(modemType);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static boolean isKissProtocolEnabled(SharedPreferences sharedPreferences) {
|
||||
return sharedPreferences.getBoolean(PreferenceKeys.KISS_ENABLED, true);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue