/* this is startMap   */
package sound;
import java.applet.*;
import java.awt.*;

import dataSeries.*;
import sun.audio.*;
import java.awt.image.MemoryImageSource;
  
import java.net.URL;  
import java.io.*;
import java.util.*;
import java.lang.Math;
import java.net.*;
import steam.*;
public class viewSoundPictureApplic
 {
   public static void main(String args[])
   {
     viewSoundPictureFrame aFrame= new viewSoundPictureFrame(args);
     aFrame.setTitle("progAtmos");
     aFrame.setResizable(true);
     aFrame.resize(2048,768);
     aFrame.init();
     aFrame.show();
     aFrame.repaint();
     aFrame.start();
     aFrame.repaint();
    }
 }    
public class viewSoundPictureFrame extends Frame implements Runnable,ChMouseDown
  {
     soundAsPicture theSoundPicture;
     alphaButton  theSign;
     Image  theImage=null;
     int bW,bH;
     char aChar;
     phonoGram thePhonoGram;
    
     private int unsigned(byte aByte)
   {
     if (aByte>=0) return (int) aByte;
      else return (256+((int) aByte));
   }

     public void init()
     { int k,i,j,soundSize;
      Graphics g;
      double r,maxF;
      URL audioUrl;
      
      
      
      InputStream aStream = null,bStream = null;
      byte soundData[]=new byte[24],comment[]=new byte[100];
      MediaTracker aMediaTracker=new MediaTracker(this); 
      System.out.println("view hasStarted");
      String theSoundFile1 = "audio";
      String theSoundFile2 = "audio";
      System.out.println(theSoundFile1+" "+theSoundFile2);
       try
        { aStream =new FileInputStream( theSoundFile1+"0.wav");
	   bStream =new FileInputStream( theSoundFile2+"0.wav");
         theSoundPicture=new soundAsPicture("picture ",10,40,1024,1024);
         theSoundPicture.init(theSoundFile1,theSoundFile2,aStream,bStream,this);
         aStream.close();bStream.close();
       } catch(Exception e)
            {
            
            }
      bW=size().width;bH=size().height;
      
    
      System.out.println("view hasStarted");
      theSign=new alphaButton("",600,640,100,20);
      theSign.scaleX=20.0;theSign.scaleY=20.0;
      theSign.theText="christer juren"; 
	    theSign.addButton(theSoundPicture);
      }
      public void run()
      {
int i,j,k;
       Graphics gg;
       
      } 

      public void start()
      {
        System.out.println("view hasStarted Start");
      }
      public void stop() {}        
 public  void chMouseDown(Graphics g,steamButton aBut)
 {int i;
  
 }

 public boolean mouseDrag(Event e,int x,int y)
    {Graphics gg;
     gg=getGraphics();
     theSign.checkAllForDrag(gg,x,y);
     paint(gg);
     gg.dispose();
     return true;
    }
     public boolean mouseDown(Event e,int x,int y)
    {Graphics gg;
     int i,j,colorNaatt;
     gg=getGraphics();
     theSign.checkAllForClick(gg,x,y); 

    
     paint(gg);   
     gg.dispose();
     return true;
    }
   public boolean mouseMove(Event e,int x,int y)
    {
      Graphics gg;
      gg=getGraphics();
      theSign.checkAllForMove(gg,x,y);
      paint(gg); 
      gg.dispose();  
      return true;
    }
   public void paint(Graphics g)
   {Graphics gg; 
     int i,j;
      if (theImage==null)
          { theImage=createImage(bW,bH);
            bW=size().width;bH=size().height;
          }  
        gg=theImage.getGraphics();
        gg.setColor(Color.black);
        gg.fillRect(0,0,bW,bH);
        gg.setColor(Color.white);
        myPaint(gg); 
        g.drawImage(theImage,0,0,this);
        gg.dispose();
   }
   public synchronized void myPaint(Graphics g)
     { String aLine;
        Color savedColor;
        int i,j,magn,xb,yb,xmz,ymz,xbn,ybn;
        savedColor=g.getColor();
        theSign.paintAll(g);
      
     
    }
public synchronized void paintDirect(Graphics g)
     { String aLine;
        int i,j,magn,xb,yb,xmz,ymz,xbn,ybn;
      theSign.paint(g);
     
     } 


 }