package structures.data;

import exceptions.ResourceFailedException;

import javax.sound.sampled.AudioInputStream;

import authoring_environment.FileHandlers.FileManager;
import javafx.scene.media.AudioClip;
import structures.IResource;

public class DataSound implements IResource {

    private String myName;
    private String myBaseFileName;
    private String completeFileName;
    private AudioClip clip;
    private AudioInputStream audioInputStream;
    private boolean myHaveLoaded;

    public DataSound(String name, String baseFileName) {
        myName = name;
        myBaseFileName = baseFileName;
        myHaveLoaded = false;
    }

    public String getName() {
        return myName;
    }

    public String getBaseFileName() {
        return myBaseFileName;
    }
    public AudioInputStream getInputStream(){
    	
    	return audioInputStream;
    }
    public void setInputStream(AudioInputStream inputStream){
    	
    	audioInputStream = inputStream;
    	
    }

    @Override
    public boolean loaded() {
        return myHaveLoaded;
    }
    

    @Override
    public void load(String gameName) throws ResourceFailedException {
    	FileManager gmf = new FileManager(gameName);
        clip = gmf.getSound(myName, this);
    	myHaveLoaded = true;
    }
    
    public String getDirectory(){
    	return completeFileName;
    } 
    
    public AudioClip getClip(){
    	return clip;
    }
}

@@ -824,22 +824,17 @@
 ream()%7B%0A
-    %09
 %0A
+
     %09ret
@@ -923,22 +923,17 @@
 tream)%7B%0A
-    %09
 %0A
+
     %09aud
@@ -965,14 +965,9 @@
 am;%0A
-    %09
 %0A
+
     
@@ -1048,21 +1048,17 @@
 ;%0A    %7D%0A
-    
 %0A
+
 %0A    @Ov
@@ -1260,21 +1260,17 @@
 ;%0A    %7D%0A
-    
 %0A
+
     publ
@@ -1330,22 +1330,17 @@
 e;%0A    %7D
- %0A    
+%0A
 %0A    pub
@@ -1360,24 +1360,24 @@
  getClip()%7B%0A
-
     %09return 
@@ -1388,10 +1388,80 @@
 ;%0A    %7D%0A
+    @Override%0A    public String toString()%7B%0A    %09return myName;%0A    %7D%0A
 %7D%0A

add toString