Class SoundExplorer

java.lang.Object
  extended bySoundExplorer
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, javax.sound.sampled.LineListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

public class SoundExplorer
extends java.lang.Object
implements java.awt.event.MouseMotionListener, java.awt.event.ActionListener, java.awt.event.MouseListener, javax.sound.sampled.LineListener

This class allows you to explore a Sound. You can see the line drawing of the sound samples and play all or part of a sound. You can zoom in to see all the samples in the sound or zoom out to see the entire sound. You can click on the sound wave to see the value at that index. Copyright Georgia Institute of Technology 2004

Author:
Keith McDermottt, gte047w@cc.gatech.edu, Barb Ericson ericson@cc.gatech.edu

Constructor Summary
SoundExplorer(SimpleSound sound, boolean inStereo)
          Constructor that takes a sound and a boolean flag
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Method to handle an action event
 void checkScroll()
          Method to check that the current position is in the viewing area and if not scroll to center the current position if possible
 void mouseClicked(java.awt.event.MouseEvent e)
          Handle a mouse click event
 void mouseDragged(java.awt.event.MouseEvent e)
          Method to handle a mouse dragged event
 void mouseEntered(java.awt.event.MouseEvent e)
          Method to handle a mouse entered event
 void mouseExited(java.awt.event.MouseEvent e)
          Method to handle a mouse exited event
 void mouseMoved(java.awt.event.MouseEvent e)
          Method to handle a mouse move event
 void mousePressed(java.awt.event.MouseEvent e)
          Method to handle a mouse press
 void mouseReleased(java.awt.event.MouseEvent e)
          Method to handle a mouse release
 void setBase(int base)
          Method to set the base for the index.
 void setTitle(java.lang.String s)
          Method to set the title on the main window
 void update(javax.sound.sampled.LineEvent e)
          Method to handle the line event update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoundExplorer

public SoundExplorer(SimpleSound sound,
                     boolean inStereo)
Constructor that takes a sound and a boolean flag

Parameters:
sound - the sound to view
inStereo - true if you want to show it in stereo
Method Detail

setTitle

public void setTitle(java.lang.String s)
Method to set the title on the main window

Parameters:
s - the string to use as the title

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Handle a mouse click event

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Method to handle a mouse press

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Method to handle a mouse release

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Method to handle a mouse entered event

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Method to handle a mouse exited event

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Method to handle a mouse dragged event

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
e - the mouse event

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Method to handle a mouse move event

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
e - the mouse event

update

public void update(javax.sound.sampled.LineEvent e)
Method to handle the line event update

Specified by:
update in interface javax.sound.sampled.LineListener
Parameters:
e - the line event

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Method to handle an action event

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - the action event

checkScroll

public void checkScroll()
Method to check that the current position is in the viewing area and if not scroll to center the current position if possible


setBase

public void setBase(int base)
Method to set the base for the index. The default is a base of 0.

Parameters:
base - the new base to use (for example use setBase(1)) to use base 1 instead of 0