/*
Tiamat - a role-playing game framework
AudioPlayer.java - abstract class for playing audio
 
 Copyright  (C) 2000-2004 Hugues Johnson
 
This program 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; either version 2
of the License, or (at your option) any later version.
 
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

package com.huguesjohnson.tiamat.audio;

import java.lang.String;
import java.lang.StringBuffer;

/** AudioPlayer - abstract class for playing audio
 * @author  Hugues Johnson
 */
public abstract class AudioPlayer{

/* begin protected properties */
    /**
     * The number of times to loop.
     */
    protected int loop; 
    /**
     * The list of tracks to play.
     */
    protected String[] trackList;
    /**
     * The index of the track currently being played.
     */
    protected int trackIndex;
/* end protected properties */

/* begin public constants */
    public final static int INFINITE_LOOP=-1;
/* end public constants */
    
/* begin abstract public methods */ 
    /** 
     * Play with no loop.
     * @param path The path of the audio file to play.
     */
    public abstract void play(String path);
    /** 
     * Play with looping.
     * @param path The path of the audio file to play.
     * @param loop The number of times to loop, if loop <0 the infinite loop.
     */
    public abstract void play(String path,int loop);
    /** 
     * Play with no loop.
     * @param paths The paths of the audio files to play.
     */
    public abstract void play(String[] paths); 
    /** 
     * Play with looping, loops back to the first track after playing the last one.
     * @param paths The paths of the audio files to play.
     * @param loop The number of times to loop, if loop <0 the infinite loop.
     */
    public abstract void play(String[] paths,int loop);
    /**
     * Stops playback.
     */
    public abstract void stop();
/* end abstract public methods */ 
    
/* begin public methods */    
    /** 
     * Returns a string representation of the object.
     * @return A string representation of the object.
     */
    public String toString(){
        StringBuffer tostring=new StringBuffer(this.getClass().getName());
        tostring.append("\n  loop="+this.loop);
        tostring.append("\n  trackIndex="+this.trackIndex);
        int length=this.trackList.length;
        for(int index=0;index<length;index++){
            tostring.append("\n  trackList["+index+"]="+this.trackList[index]);
        }
        return(tostring.toString());
    }
/* end public methods */    
}