Commit d9d7460c authored by Elodie Gauthier's avatar Elodie Gauthier

CheckTranscription: audio file loading fixed.

Audio files have to be in the same directory than the transcript file.
parent d8445e15
......@@ -40,6 +40,7 @@ public class CheckTranscription extends AikumaActivity {
private BufferedWriter outputFile;
private File checkedFile;
private String transcripTextFile;
private String transcriptFilename;
private String transcriptChecked;
private TextView transcriptID;
private CheckBox transcriptOK;
......@@ -171,15 +172,18 @@ public class CheckTranscription extends AikumaActivity {
fragment = (ListenFragment) getFragmentManager().findFragmentById(R.id.phrase_player);
//player initialisation
//player initialization
SimplePlayer player;
try {
player = new SimplePlayer(new File(dataPath+transcriptID.getText().toString()+".wav"),sampleRate, true);
transcriptFilename = transcripTextFile.substring(transcripTextFile.lastIndexOf("/") + 1);
String audioFileFullPath = transcripTextFile.replace(transcriptFilename, transcriptID.getText().toString()+".wav");
player = new SimplePlayer(new File(audioFileFullPath),sampleRate, true);
fragment.setPlayer(player);
Log.d(TAG, "Get corresponding audio:" + dataPath+transcriptID.getText().toString()+".wav");
} catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(this, "The corresponding audio file is unobtainable. Please proceed to the next transcript."+transcriptID.getText(), Toast.LENGTH_LONG).show();
Log.d(TAG, "Try to reach: "+transcripTextFile.replace(transcriptFilename, transcriptID.getText().toString()+".wav"));
Toast.makeText(this, "The corresponding audio file is unobtainable. Please proceed to the next transcript.", Toast.LENGTH_LONG).show();
transcriptOK.setEnabled(false);
}
}
......@@ -276,7 +280,9 @@ public class CheckTranscription extends AikumaActivity {
try {
//player release
fragment.releasePlayer();
SimplePlayer player = new SimplePlayer(new File(dataPath+transcriptID.getText().toString()+".wav"), sampleRate, true);
transcriptFilename = transcripTextFile.substring(transcripTextFile.lastIndexOf("/") + 1);
String audioFileFullPath = transcripTextFile.replace(transcriptFilename, transcriptID.getText().toString()+".wav");
SimplePlayer player = new SimplePlayer(new File(audioFileFullPath),sampleRate, true);
//allocation of the player to the fragment
fragment.setPlayer(player);
} catch (IOException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment