// This file is part of Penn TotalRecall <http://memory.psych.upenn.edu/TotalRecall>. // // TotalRecall is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, version 3 only. // // TotalRecall is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with TotalRecall. If not, see <http://www.gnu.org/licenses/>. package edu.upenn.psych.memory.totalrecall.tests; import java.io.FileNotFoundException; import java.io.IOException; import javax.sound.sampled.UnsupportedAudioFileException; import edu.upenn.psych.memory.precisionplayer.PrecisionPlayer; /** * @author Apurva Jatakia */ public class OpenTest implements Runnable{ private boolean finish; int lastError; private Object obj; private PrecisionPlayer player; public OpenTest() { player = null; finish = false; obj = new Object(); } public void run() { try { player.open("/Users/apurvaj/Desktop/0.wav"); long start = 0; while(!finish){ player.playAt(start); synchronized (obj) { try { obj.wait(100); } catch (InterruptedException e) { System.out.println("Here"); e.printStackTrace(); } } start = player.stop(); synchronized (obj) { try { obj.wait(100); } catch (InterruptedException e) { System.out.println("Here"); e.printStackTrace(); } } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (UnsupportedAudioFileException e) { e.printStackTrace(); } } public boolean isFinish() { return finish; } public void setFinish(boolean finish) { this.finish = finish; } }