Commit 5249e353 authored by hanriaca's avatar hanriaca
Browse files

resolve conflicts between files + fix submode description in the...

resolve conflicts between files + fix submode description in the sharedPreferences used at the session interruption
parents e6cc5bf9 b2a15e7a
......@@ -136,5 +136,6 @@
<string name="currentPCMSample">currentPCMSample</string>
<string name="sampleRate">sampleRate</string>
<string name="currentLine">currentLine</string>
<string name="elicitTextFile">elicitTextFile</string>
<string name="recordDuration">duration</string>
<string name="translation">translation</string>
</resources>
......@@ -259,8 +259,8 @@ public class ModeSelection extends Activity implements OnClickListener{
else if (submode.compareToIgnoreCase("image") == 0) { submodeDialog = "image"; }
else if (submode.compareToIgnoreCase("video") == 0) { submodeDialog = "video"; }
} else if (mode.compareToIgnoreCase(ThumbRespeakActivityLig.TAG) == 0) {
if (submode.compareToIgnoreCase("respeaking") == 0) { modeDialog = "Respeaking"; }
else if (submode.compareToIgnoreCase("translation") == 0) { modeDialog = "Translation"; }
if (submode.compareToIgnoreCase(getString(R.string.respeak)) == 0) { modeDialog = "Respeaking"; }
else if (submode.compareToIgnoreCase(getString(R.string.translation)) == 0) { modeDialog = "Translation"; }
submodeDialog = "None";
}
((TextView) ll.findViewById(R.id.session_mode)).setText(modeDialog);
......@@ -276,7 +276,7 @@ public class ModeSelection extends Activity implements OnClickListener{
((TextView) ll.findViewById(R.id.session_date)).setText(prefsUserSession.getString(getString(R.string.sessionDate), "undefined"));
}
((TextView) ll.findViewById(R.id.session_progress)).setText("" + prefsUserSession.getInt(getString(R.string.sessionProgress), 0));
((TextView) ll.findViewById(R.id.session_progress)).setText("" + prefsUserSession.getString(getString(R.string.sessionProgress), "0"));
// display only filename
String file = new File(prefsUserSession.getString(getString(R.string.sessionInputFile), "undefined")).getName();
......
......@@ -259,7 +259,7 @@ public class Recorder implements AudioHandler, MicrophoneListener, Sampler {
*/
public void save() {
file.write(audioBuffer, audioBufLength);
Log.d("DDaudioBufLength", "audioBufferLength = "+audioBufLength);
totalAudioLength += audioBufLength;
Log.d("DDtotalAudioLength", "totalAudioLength = "+totalAudioLength);
if (this.type == 0 &&
......
......@@ -105,6 +105,14 @@ public class Recording extends FileModel {
setFileType(sourceVerId, languages);
}
public void setRecordingUUID(UUID recordingUUID) {
this.recordingUUID = recordingUUID;
}
/**
* The constructor used when first creating a Recording.
*
......@@ -1222,7 +1230,7 @@ public class Recording extends FileModel {
this.speakersIds.add(speaker.getId());
}
private void setDeviceName(String deviceName) {
public void setDeviceName(String deviceName) {
if (deviceName == null) {
throw new IllegalArgumentException(
"The model name cannot be null");
......@@ -1428,7 +1436,7 @@ public class Recording extends FileModel {
}
return starFiles.length;
}
/**
* Gives the number of flags this recording has received.
*
......
package org.lp20.aikuma.model;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.lp20.aikuma.Aikuma;
......@@ -121,6 +123,7 @@ public class RecordingLig extends Recording {
this.speakerGender = spkrGndr;
}
/**
* Public constructor from super class Recording
* for existing recordings
......@@ -133,6 +136,7 @@ public class RecordingLig extends Recording {
r.respeakingId, r.sampleRate, r.durationMsec, r.format, r.fileType);
}
// Moves a WAV file with a temporary UUID from a no-sync directory to
// its rightful place in the connected world of Aikuma, with a proper name
// and where it will find it's best friend - a JSON metadata file.
......@@ -204,12 +208,7 @@ public class RecordingLig extends Recording {
File metadataFile = new File(getIndividualRecordingPath(),
this.name + METADATA_SUFFIX);
FileIO.writeJSONObject(metadataFile,encodedRecording);
Log.i(TAG, "Saved metadata file to " + metadataFile.getAbsolutePath());
// FileIO.writeJSONObject(new File(
// getRecordingsPath(), getGroupId() + "/" +
// id + METADATA_SUFFIX),
// encodedRecording);
Log.i(TAG, "Saved metadata file to " + metadataFile.getAbsolutePath());
}
/**
......@@ -224,14 +223,21 @@ public class RecordingLig extends Recording {
JSONObject jsonObj = FileIO.readJSONObject(metadataFile);
RecordingLig recording = new RecordingLig(read(jsonObj));
String code = (String) jsonObj.get(RecordingMetadataLig.metaRecordLang);
recording.recordLang = code.isEmpty() ? new Language(Aikuma.getLanguageCodeMap().get(code), code) : null;
recording.recordLang = code.isEmpty() ? null : new Language(Aikuma.getLanguageCodeMap().get(code), code);
JSONArray jsonArray = (JSONArray) jsonObj.get("languages");
recording.languages = Language.decodeJSONArray(jsonArray);
code = (String) jsonObj.get(RecordingMetadataLig.metaMotherTong);
recording.motherTong = code.isEmpty() ? new Language(Aikuma.getLanguageCodeMap().get(code), code) : null;
if (code != null)
recording.motherTong = code.isEmpty() ? null : new Language(Aikuma.getLanguageCodeMap().get(code), code);
recording.regionOrigin = (String) jsonObj.get(RecordingMetadataLig.metaOrigin);
recording.speakerName = (String) jsonObj.get(RecordingMetadataLig.metaSpkrName);
long age = (Long) jsonObj.get(RecordingMetadataLig.metaSpkrBirthYr);
recording.speakerBirthYear= (int) age;
recording.speakerGender = (String) jsonObj.get(RecordingMetadataLig.metaSpkrGender);
Long i = (Long)jsonObj.get("BitsPerSample");
recording.bitsPerSample = i.intValue();
i = (Long)jsonObj.get("NumChannels");
recording.numChannels = i.intValue();
return recording;
}
......@@ -248,7 +254,8 @@ public class RecordingLig extends Recording {
encodedRecording.put(RecordingMetadataLig.metaSpkrBirthYr, speakerBirthYear);
encodedRecording.put(RecordingMetadataLig.metaSpkrGender, speakerGender);
encodedRecording.put(RecordingMetadataLig.metaRecordLang, this.recordLang.getCode());
encodedRecording.put(RecordingMetadataLig.metaMotherTong, this.motherTong.getCode());
if (this.motherTong != null)
encodedRecording.put(RecordingMetadataLig.metaMotherTong, this.motherTong.getCode());
Log.i(TAG, "encoding metadata into json format");
return encodedRecording;
}
......
......@@ -56,15 +56,17 @@ public class RecordElicitation extends AikumaActivity {
private String eliciTextFile;
private ListenFragment fragment;
private Boolean isNewSession = true;
private Date date;
private SharedPreferences prefsUserSession;
private String strFolderDate;
private RecordingLig recordingLig;
/**
* the progress bar used to display the user's progression.
*/
private InterleavedSeekBar progressBar;
private int numberOfLines;
private Language recordLang;
/** Called when the activity is first created. */
@Override
......@@ -77,7 +79,7 @@ public class RecordElicitation extends AikumaActivity {
prefsUserSession = getSharedPreferences(getString(R.string.userSession), MODE_PRIVATE);
initSession();
initProgressBars();
try {
......@@ -120,42 +122,22 @@ public class RecordElicitation extends AikumaActivity {
@SuppressWarnings("unchecked")
private void initSession() {
if (prefsUserSession.getBoolean(getString(R.string.sessionActive), false)) {
Language recordLang = new Language(prefsUserSession.getString(getString(R.string.languageName), ""),
prefsUserSession.getString(getString(R.string.languageCode), ""));
Language motherTong = new Language(prefsUserSession.getString(getString(R.string.languageMotherName), ""),
prefsUserSession.getString(getString(R.string.languageMotherCode), ""));
ArrayList<Language> rspkLanguages = new ArrayList<Language>();
try {
rspkLanguages = (ArrayList<Language>) ObjectSerializer.deserialize(prefsUserSession.getString(RecordingMetadataLig.metaLanguages,
ObjectSerializer.serialize(new ArrayList<Language>())));
} catch (IOException e) {
e.printStackTrace();
}
if (prefsUserSession.getBoolean(getString(R.string.sessionActive), false)) {
strFolderDate=prefsUserSession.getString(getString(R.string.sessionDate), "");
recordLang = new Language(prefsUserSession.getString(getString(R.string.language_name), ""),
prefsUserSession.getString(getString(R.string.languageCode), ""));
try {
date = new SimpleDateFormat().parse(strFolderDate);
} catch (ParseException e) {
date = new Date();
e.printStackTrace();
}
String regionOrigin = prefsUserSession.getString(RecordingMetadataLig.metaOrigin, "");
String speakerName = prefsUserSession.getString(RecordingMetadataLig.metaSpkrName, "");
int speakerAge = prefsUserSession.getInt(RecordingMetadataLig.metaSpkrBirthYr, 0);
int speakerGender = prefsUserSession.getInt(RecordingMetadataLig.metaSpkrGender, 0);
phraseId = prefsUserSession.getInt(getString(R.string.currentLine), 0);
SharedPreferences.Editor ed = prefsUserSession.edit();
eliciTextFile = prefsUserSession.getString(getString(R.string.elicitTextFile), "");
/*DateFormat dateformat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
String metaDate = prefsUserSession.getString(getString(R.string.sessionDate), "");
try {
date = dateformat.parse(metaDate);
} catch (ParseException e) {
e.printStackTrace();
}*/
eliciTextFile = prefsUserSession.getString(getString(R.string.sessionInputFile), "");
phraseId = prefsUserSession.getInt(getString(R.string.currentLine), 0);
ed.clear();
ed.commit();
try {
......@@ -164,9 +146,9 @@ public class RecordElicitation extends AikumaActivity {
// TODO Auto-generated catch block
e1.printStackTrace();
}
MetadataSession.getMetadataSession().setSession(recordLang, motherTong,
rspkLanguages, regionOrigin, speakerName, speakerAge, speakerGender);
goToPreviousState();
isNewSession = false;
} else {
eliciTextFile = getIntent().getStringExtra(ElicitationMode.importFileName);
Log.i(TAG, "Selected file: " + eliciTextFile);
......@@ -178,9 +160,15 @@ public class RecordElicitation extends AikumaActivity {
e1.printStackTrace();
}
setMetadataSession();
recordLang = MetadataSession.getMetadataSession().getRecordLanguage();
strFolderDate = new SimpleDateFormat("yyMMdd-HHmmss").format(date);
}
}
/**
* Called to going to the previous state (phraseID and others graphical attributes
*/
private void goToPreviousState() {
String phrase;
int i = 0;
......@@ -197,6 +185,10 @@ public class RecordElicitation extends AikumaActivity {
}
}
/**
* Called to create the metadata session
*/
private void setMetadataSession() {
if (getIntent() != null) {
Intent metadataIntent = getIntent();
......@@ -216,16 +208,14 @@ public class RecordElicitation extends AikumaActivity {
Bundle bundle = getIntent().getBundleExtra(RecordingMetadataLig.metaBundle);
try {
date = new SimpleDateFormat().parse(bundle.getString(RecordingMetadataLig.metaDate));
// date = dateformat.parse(metaIntent.getStringExtra(RecordingMetadataLig.metaDate));
} catch (ParseException e1) {
date = new Date();
} catch (Exception e) {
Log.e(TAG, "Exception caught: " + e);
}
strFolderDate = new SimpleDateFormat("yyMMdd-HHmmss").format(date);
}
}
......@@ -272,27 +262,27 @@ public class RecordElicitation extends AikumaActivity {
}
}
/**
* called to set progressionBar behavior
* progressionBar is not modifiable by hand
*/
private void initProgressBars() {
progressBar = (InterleavedSeekBar) findViewById(R.id.seek_elicit_progression);
progressBar.setOnSeekBarChangeListener(
new SeekBar.OnSeekBarChangeListener() {
int originalProgress;
public void onProgressChanged(SeekBar seekBar,
int progress, boolean fromUser) {
if (fromUser) {
seekBar.setProgress(originalProgress);
}
}
public void onStopTrackingTouch(SeekBar _seekBar) {};
public void onStartTrackingTouch(SeekBar _seekBar) {
originalProgress = progressBar.getProgress();
};
});
}
/**
* called to set progressionBar behavior
* progressionBar is not modifiable by hand
*/
private void initProgressBars() {
progressBar = (InterleavedSeekBar) findViewById(R.id.seek_elicit_progression);
progressBar.setOnSeekBarChangeListener(
new SeekBar.OnSeekBarChangeListener() {
int originalProgress;
public void onProgressChanged(SeekBar seekBar,
int progress, boolean fromUser) {
if (fromUser) {
seekBar.setProgress(originalProgress);
}
}
public void onStopTrackingTouch(SeekBar _seekBar) {};
public void onStartTrackingTouch(SeekBar _seekBar) {
originalProgress = progressBar.getProgress();
};
});
}
@Override
public void onDestroy() {
......@@ -327,6 +317,67 @@ public class RecordElicitation extends AikumaActivity {
this.finish();
}
/**
* Function called to restore the recordingLig by a json file.
*/
private void restoreMetaDataFromJson() {
if (phraseId > 0) {
File metadataFile = new File(FileIO.getOwnerPath().getAbsolutePath() + "/"+ "recordings" + "/" +this.strFolderDate + "_"+recordLang.getCode()+"_"+Aikuma.getDeviceId(),
this.strFolderDate + "_" + recordLang.getCode() + "_" + Aikuma.getDeviceId() + "_" + (phraseId-1) + RecordingLig.METADATA_SUFFIX);
Log.d("metadataFile : ", "metadataFile : " + metadataFile.getAbsolutePath());
try {
recordingLig = RecordingLig.read(metadataFile);
recordingLig.setRecordingUUID(recordUUID);
recordingLig.setDeviceName(Aikuma.getDeviceName());
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* Function called when we need to initialize the recordingLig object
* used to write json and wav files.
*/
private void setRecordingLig() {
if (isNewSession) {
int duration = recorder.getCurrentMsec();
String deviceName = Aikuma.getDeviceName();
String androidID = Aikuma.getAndroidID();
ArrayList<String> speakerIds = new ArrayList<String>();
Double latitude = MainActivity.locationDetector.getLatitude();
Double longitude = MainActivity.locationDetector.getLongitude();
String suffix = new File(eliciTextFile).getName().replace(".txt", "").length() >= 10 ? new File(eliciTextFile).getName().substring(0, 10)
: new File(eliciTextFile).getName().replace(".txt", "");
String idDevice = Aikuma.getDeviceId();
String name = strFolderDate + "_" +
MetadataSession.getMetadataSession().getRecordLanguage().getCode()
+ "_" + idDevice;
// + "_elicit_" + new File(eliciTextFile).getName().substring(0,10);
// + "_" + eliciTextFile.substring(0, 10) + "_" + phraseId
Log.i(TAG, "recording name: " + name);
String gender = "";
int speakerGender = MetadataSession.getMetadataSession().getSpeakerGender();
if (speakerGender == RecordingMetadataLig.GENDER_MALE)
gender = "Male";
else if (speakerGender == RecordingMetadataLig.GENDER_FEMALE)
gender = "Female";
recordingLig = new RecordingLig(recordUUID, name, date,
AikumaSettings.getLatestVersion(),
AikumaSettings.getCurrentUserId(), MetadataSession.getMetadataSession().getRecordLanguage(),
MetadataSession.getMetadataSession().getMotherTongue(),
MetadataSession.getMetadataSession().getExtraLanguages(), speakerIds, deviceName, androidID,
null, null, sampleRate, duration,
recorder.getFormat(), recorder.getNumChannels(),
recorder.getBitsPerSample(), latitude, longitude,
MetadataSession.getMetadataSession().getRegionOrigin(), MetadataSession.getMetadataSession().getSpeakerName(),
MetadataSession.getMetadataSession().getSpeakerAge(), gender);
} else{
restoreMetaDataFromJson();
}
}
/**
* called when we want save a file.
* @return
......@@ -340,45 +391,16 @@ public class RecordElicitation extends AikumaActivity {
return false;
}
int duration = recorder.getCurrentMsec();
String deviceName = Aikuma.getDeviceName();
String androidID = Aikuma.getAndroidID();
ArrayList<String> speakerIds = new ArrayList<String>();
Double latitude = MainActivity.locationDetector.getLatitude();
Double longitude = MainActivity.locationDetector.getLongitude();
String suffix = new File(eliciTextFile).getName().replace(".txt", "").length() >= 10 ? new File(eliciTextFile).getName().substring(0, 10)
: new File(eliciTextFile).getName().replace(".txt", "");
String idDevice = Aikuma.getDeviceId();
String name = strFolderDate + "_" +
MetadataSession.getMetadataSession().getRecordLanguage().getCode()
+ "_" + idDevice;
// + "_elicit_" + new File(eliciTextFile).getName().substring(0,10);
// + "_" + eliciTextFile.substring(0, 10) + "_" + phraseId
Log.i(TAG, "recording name: " + name);
String gender = "";
int speakerGender = MetadataSession.getMetadataSession().getSpeakerGender();
if (speakerGender == RecordingMetadataLig.GENDER_MALE)
gender = "Male";
else if (speakerGender == RecordingMetadataLig.GENDER_FEMALE)
gender = "Female";
RecordingLig recording = new RecordingLig(recordUUID, name, date,
AikumaSettings.getLatestVersion(),
AikumaSettings.getCurrentUserId(), MetadataSession.getMetadataSession().getRecordLanguage(),
MetadataSession.getMetadataSession().getMotherTongue(),
MetadataSession.getMetadataSession().getExtraLanguages(), speakerIds, deviceName, androidID,
null, null, sampleRate, duration,
recorder.getFormat(), recorder.getNumChannels(),
recorder.getBitsPerSample(), latitude, longitude,
MetadataSession.getMetadataSession().getRegionOrigin(), MetadataSession.getMetadataSession().getSpeakerName(),
MetadataSession.getMetadataSession().getSpeakerAge(), gender);
setRecordingLig();
try {
// Move the wave file from the nosync directory to
// the synced directory and write the metadata
recording.write();
String filename = recording.getFile().getAbsolutePath();
FileUtils.copyFile(recording.getFile(),
recordingLig.write();
String filename = recordingLig.getFile().getAbsolutePath();
FileUtils.copyFile(recordingLig.getFile(),
new File(filename.replace(".wav", "_" + phraseId + ".wav")));
FileIO.delete(new File(filename));
FileUtils.copyFile(new File(filename.replace(".wav", "-metadata.json")),
......@@ -391,7 +413,6 @@ public class RecordElicitation extends AikumaActivity {
Toast.makeText(this, "An error occurred when saving the recording. Please try again.", Toast.LENGTH_LONG).show();
return false;
}
Toast.makeText(this, name+"_"+phraseId, Toast.LENGTH_LONG).show();
return true;
}
......@@ -471,26 +492,22 @@ public class RecordElicitation extends AikumaActivity {
return nbLine;
}
/**
* Called when we need to save the current state of the activity
*/
private void saveCurrentState() {
Toast.makeText(this, "save current not finished session", Toast.LENGTH_SHORT).show();
SharedPreferences.Editor ed = prefsUserSession.edit();
ed.putBoolean(getString(R.string.sessionActive), true);
ed.putString(getString(R.string.sessionMode),TAG);
//save metadataSession
ed.putInt(RecordingMetadataLig.metaSpkrGender, MetadataSession.getMetadataSession().getSpeakerGender());
ed.putString(getString(R.string.languageName), MetadataSession.getMetadataSession().getRecordLanguage().getName());
ed.putString(getString(R.string.languageCode), MetadataSession.getMetadataSession().getRecordLanguage().getCode());
ed.putString(getString(R.string.languageMotherName), MetadataSession.getMetadataSession().getMotherTongue().getName());
ed.putString(getString(R.string.languageMotherCode), MetadataSession.getMetadataSession().getMotherTongue().getCode());
ed.putString(RecordingMetadataLig.metaOrigin, MetadataSession.getMetadataSession().getRegionOrigin());
ed.putString(RecordingMetadataLig.metaSpkrName, MetadataSession.getMetadataSession().getSpeakerName());
ed.putInt(RecordingMetadataLig.metaSpkrBirthYr, MetadataSession.getMetadataSession().getSpeakerAge());
ed.putString(getString(R.string.language_name), recordLang.getName());
ed.putString(getString(R.string.languageCode), recordLang.getCode());
ed.putString(getString(R.string.sessionDate), strFolderDate);
ed.putInt(getString(R.string.currentLine), phraseId);
ed.putString(getString(R.string.elicitTextFile), eliciTextFile);
ed.putString(getString(R.string.sessionInputFile), eliciTextFile);
ed.putString(getString(R.string.sessionProgress), phraseId + " / " + numberOfLines);
ed.commit();
}
......@@ -499,7 +516,14 @@ public class RecordElicitation extends AikumaActivity {
if (phraseId<numberOfLines) {
saveCurrentState();
}
this.finish();
if (isNewSession)
this.finish();
else
{
Intent intent = new Intent(this, ElicitationMode.class);
startActivity(intent);
}
}
@Override
......@@ -507,6 +531,13 @@ public class RecordElicitation extends AikumaActivity {
if (phraseId<numberOfLines) {
saveCurrentState();
}
this.finish();
if (isNewSession)
this.finish();
else
{
Intent intent = new Intent(this, ElicitationMode.class);
startActivity(intent);
}
}
}
......@@ -11,6 +11,7 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.json.JSONObject;
import org.lp20.aikuma.Aikuma;
import org.lp20.aikuma.MainActivity;
import org.lp20.aikuma.ModeSelection;
......@@ -58,11 +59,11 @@ public class ThumbRespeakActivityLig extends AikumaActivity {
private String dirName;
private String recordName;
private int rewindAmount;
private MetadataSession metadataSession;
private String recordLangCode;
private Mapper mp;
private long curSampl;
private int payLoadSize;
private Language recordLang;
/**
* containing informations about mapping and start/stop/pause
* the original or respeaking recording.
......@@ -71,11 +72,13 @@ public class ThumbRespeakActivityLig extends AikumaActivity {
private String sourceId;
private UUID respeakingUUID;
private long sampleRate;
private RecordingLig recording;
private boolean edited = false;
private long totalAudioLength;
Boolean isNotNewSession;
private Boolean isNewSession;
private RecordingLig recording;
/** Called when the activity is first created. */
@SuppressWarnings("unchecked")
@Override
......@@ -86,11 +89,12 @@ public class ThumbRespeakActivityLig extends AikumaActivity {
prefsUserSession = getSharedPreferences(getString(R.string.userSession), MODE_PRIVATE);
fragment = (ThumbRespeakFragment)
getFragmentManager().findFragmentById(R.id.ThumbRespeakFragment);
isNotNewSession = false;
isNewSession = true;
if (prefsUserSession.getBoolean(getString(R.string.sessionActive), false)) {
//retrieve selected file handled in the last session
rewindAmount = prefsUserSession.getInt(getString(R.string.rewindAmount), 500);
duration = prefsUserSession.getInt(getString(R.string.sessionProgress), 0);
duration = prefsUserSession.getInt(getString(R.string.recordDuration), 0);
//retrieve result file handled in the last session
sourceName = prefsUserSession.getString(getString(R.string.sessionInputFile), "");
recordName = prefsUserSession.getString(getString(R.string.sessionOutputFile), "");
......@@ -100,7 +104,10 @@ public class ThumbRespeakActivityLig extends AikumaActivity {
dirName = prefsUserSession.getString(getString(R.string.dirname), "");
payLoadSize = prefsUserSession.getInt(getString(R.string.payLoadSize),0);
curSampl = prefsUserSession.getLong(getString(R.string.currentPCMSample),0);
recordLangCode = prefsUserSession.getString(getString(R.string.languageCode), "");
String recordLangCode = prefsUserSession.getString(getString(R.string.languageCode), "");
String recordLangName = prefsUserSession.getString(getString(R.string.language_name), "");
recordLang = new Language(recordLangName, recordLangCode);
ArrayList<Language> rspkLanguages = new ArrayList<Language>();
sampleRate = prefsUserSession.getLong(getString(R.string.sampleRate), 0);