/**
 * MP3 Player Thead Test
 * @author Philip Peng
 * 
 * Just tests the MP3Player class
 * 
 * Created by Philip Peng
 * Last updated: 2007/10/09
 * 
 * Licensed under GNU GPL (Version 3):
 * http://www.gnu.org/licenses/gpl.txt
 * 
 */

import java.util.Scanner;
import java.io.FileInputStream;

public class AdvancedPlayerThreadedTest {
	
	public static void main( String[] args )
		throws java.io.FileNotFoundException, javazoom.jl.decoder.JavaLayerException {

		// Ask for file name
		System.out.println("Type in location to song file:");
		
		Scanner input = new Scanner(System.in);
		String file = input.nextLine();
		
		FileInputStream inputStream = new FileInputStream(file);
		
		// Instantiate new MP3Player
		AdvancedPlayerThreaded foobar = new AdvancedPlayerThreaded(inputStream);
		
		// Start MP3Player
		foobar.play();
		
		// Start playback
		System.out.println("========================================");
		System.out.println("Starting playback of " + file);
		System.out.println("========================================");
		
		// Print progress
		while (!foobar.isComplete()) {
			System.out.println(foobar.getPosition());
		}
		
		// Finish playback
		System.out.println("========================================");
		System.out.println("Finished playback of " + file);
		System.out.println("========================================");
		
	}
	
}
